We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Given the following module:
-module(test). -export([test/0]). test() -> #{A => B || X <- [1, 5], {A, B} <- [{X, X+1}, {X, X+3}]}.
Running in a shell:
1> c(test). {ok,test} 2> test:test(). #{1 => 4,5 => 8} 3> #{A => B || X <- [1, 5], {A, B} <- [{X, X+1}, {X, X+3}]}. #{1 => 2,5 => 6}
Expected behavior I'm not actually sure which result is correct - I expect the one from compiled code. Either way, the two should agree
Affected versions Tested on latest master
The text was updated successfully, but these errors were encountered:
I think you can further simplify the example:
-module(test). -export([test/0]). test() -> #{A => B || {A, B} <- [{1, 2}, {1, 3}]}.
And then:
1> c(test). {ok,test} 2> test:test(). #{1 => 3} 3> #{A => B || {A, B} <- [{1, 2}, {1, 3}]}. #{1 => 2}
Edit: https://www.erlang.org/eeps/eep-0058#semantics says that it should be equivalent to maps:from_list/1, and that seems to agree with the compiled version:
maps:from_list/1
4> maps:from_list([{1, 2}, {1, 3}]). #{1 => 3}
Sorry, something went wrong.
stdlib: Fix map comprehension result when a key value is replaced
8ad7a11
Fix erlang#9348
56ead49
Merge branch 'isabell/stdlib/map-fix/GH-9348/OTP-19459' into maint
8ce339f
* isabell/stdlib/map-fix/GH-9348/OTP-19459: stdlib: Fix map comprehension result when a key value is replaced
lucioleKi
Successfully merging a pull request may close this issue.
Describe the bug
Given the following module:
Running in a shell:
Expected behavior
I'm not actually sure which result is correct - I expect the one from compiled code. Either way, the two should agree
Affected versions
Tested on latest master
The text was updated successfully, but these errors were encountered: