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

Skip to content

Map comprehension difference between compiler & interpreter #9348

@michalmuskala

Description

@michalmuskala

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

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions