Skip to content

scoping compiler bug on cond #8542

@vans163

Description

@vans163

Environment

OTP 21.2
Elixir 1.7.3

defmodule Test do
    def handle_ms(ms) do
        Map.put(ms, 5, 5)
    end

    def test() do
        ms = %{}
        ms_new = cond do
            true ->
                ms = Map.put(ms, :wtf, 5)
                handle_ms(ms)
        end
        {ms, ms_new}
    end
end

1> Test.test
{%{wtf: 5}, %{5 => 5, :wtf => 5}}

Its clear the evaluation of this is incorrect and should be {%{}, %{5 => 5, :wtf => 5}}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions