Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix map type inference #457

Merged
merged 5 commits into from
Sep 19, 2022
Merged

Fix map type inference #457

merged 5 commits into from
Sep 19, 2022

Conversation

erszcz
Copy link
Collaborator

@erszcz erszcz commented Sep 19, 2022

This fixes #432 and fixes #378.

@@ -3,11 +3,19 @@
-compile([nowarn_unused_function]).
-export([not_good/1]).

-spec good(#{ good := A }) -> A.
good(#{ good := X }) -> X.
-gradualizer([infer]).
Copy link
Owner

Choose a reason for hiding this comment

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

The test suite is a little disorganized wrt infer. But I think it would be helpful to have separate files for things which are tested with infer enabled and have infer in the name.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point, I'll split out the parts relying on infer.

Copy link
Collaborator

@zuiderkwast zuiderkwast left a comment

Choose a reason for hiding this comment

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

Looks good in general. The fix looks simpler than I though.

not_good(M).

-spec kaboom2() -> integer().
kaboom2() ->
Copy link
Collaborator

Choose a reason for hiding this comment

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

The test machinery makes use of the number of exported functions and compares it to the number of failures per test suite. The idea is that all the 'should fail' functions should be exported.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm aware of the mechanism using exports. The thing is this was failing when it was broken - with the fix, it doesn't anymore. Another reason to split out the test into a corresponding should_pass test.

test/should_pass/map_creation.erl Show resolved Hide resolved
@erszcz erszcz merged commit e874016 into josefs:master Sep 19, 2022
@erszcz erszcz deleted the fix-map-type-inference branch September 19, 2022 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants