You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is to emit a warning every time a spec for an exported function uses a local type that's not exported.
Should be on by default?
YES
Reasoning
If you put a type in a spec of an exported function, that means that people writing modules that call that function should know what that type is and they may as well pass instances of that type around before calling your function. So, to add their own specs, and also to keep dialyzer messages cleaner, they should put your_mod:your_type() in their specs, instead of the actual definition of the type.
To be able to do that, the type must be exported.
Refactoring Proposal
Add the non-exported types to an -export_type(…). attribute.
Export All Used Types
Brief Description
The idea is to emit a warning every time a spec for an exported function uses a local type that's not exported.
Should be on by default?
YES
Reasoning
If you put a type in a spec of an exported function, that means that people writing modules that call that function should know what that type is and they may as well pass instances of that type around before calling your function. So, to add their own specs, and also to keep dialyzer messages cleaner, they should put
your_mod:your_type()
in their specs, instead of the actual definition of the type.To be able to do that, the type must be exported.
Refactoring Proposal
Add the non-exported types to an
-export_type(…).
attribute.Examples
The text was updated successfully, but these errors were encountered: