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

Anonymous function has incorrect arity when contains other anon function #13447

Closed
Ljzn opened this issue Mar 27, 2024 · 1 comment
Closed

Anonymous function has incorrect arity when contains other anon function #13447

Ljzn opened this issue Mar 27, 2024 · 1 comment

Comments

@Ljzn
Copy link
Contributor

Ljzn commented Mar 27, 2024

Elixir and Erlang/OTP versions

Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.16.2 (compiled with Erlang/OTP 26)

Operating system

MacOS

Current behavior

  test "anoymous function arity error" do
    f = fn a -> a end
    f.(1)
    assert_raise(BadArityError, fn -> f.(1, 2) end)

    g = fn x, y -> x + y end
    f = fn a -> g.(a, 0) end

    f.(1)
    # this assertion failed
    assert_raise(BadArityError, fn -> f.(1, 2) end)
  end

Expected behavior

no incorrect arity

@josevalim
Copy link
Member

Thanks for the report, I have reported it upstream, you can follow it here: erlang/otp#8316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants