Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

thalesmg
Copy link
Contributor

Fixes a dialyzer annoyance when overriding fields other than type.

Fixes a dialyzer annoyance when overriding fields other than `type`.
thalesmg added a commit to thalesmg/emqx that referenced this pull request Jun 25, 2025
emqx/hocon#309

Fixes `hocon_schema:override/2` typespec so dialyzer doesn't yell when you don't want to
override the field type.
-type field_schema_fun() :: fun((_) -> _).
-type field_schema_map() ::
#{
type := type(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given how loosely defined other types are, I think just changing to type => type() here could be a good practical solution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For defining a schema, the type is really required, so I think it's good to make it explicit in the type.

Though, if the macro hack had not worked, I probably would have gone that way too. 😅

@thalesmg thalesmg merged commit 640f2fe into emqx:master Jun 26, 2025
4 checks passed
@thalesmg thalesmg deleted the 20250624-override-typespec branch June 26, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants