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
As a followup to #429 I've stumbled upon test/should_fail/covariant_map_keys_fail.erl. There's no error reported for kaboom/0 by default (even with the --infer flag), but there is if we apply the following change:
$ git diff
diff --git a/test/should_fail/covariant_map_keys_fail.erl b/test/should_fail/covariant_map_keys_fail.erl
index 99c5883..98e38f0 100644
--- a/test/should_fail/covariant_map_keys_fail.erl
+++ b/test/should_fail/covariant_map_keys_fail.erl
@@ -10,4 +10,6 @@ good(#{ good := X }) -> X.
not_good(M) -> good(M). %% This call should fail
-spec kaboom() -> integer().
-kaboom() -> not_good(#{ bad => 0 }).
+kaboom() ->
+ M = #{ bad => 0 },
+ not_good(M).
This shows that map type inference does not always work as expected. It might or might not be related to #378. I have a hunch it's related, as it's inference of a nested map creation expression which doesn't work as expected, not a top-level one.
The text was updated successfully, but these errors were encountered:
erszcz
changed the title
Map type inference not working when map creation expression is an argument
Map type inference not working when map creation expression is not an argument
Sep 17, 2022
erszcz
added a commit
to erszcz/Gradualizer
that referenced
this issue
Sep 19, 2022
As a followup to #429 I've stumbled upon
test/should_fail/covariant_map_keys_fail.erl
. There's no error reported forkaboom/0
by default (even with the--infer
flag), but there is if we apply the following change:This shows that map type inference does not always work as expected. It might or might not be related to #378. I have a hunch it's related, as it's inference of a nested map creation expression which doesn't work as expected, not a top-level one.
The text was updated successfully, but these errors were encountered: