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

Wrong error raised when calling function with wrong arity #8316

Closed
josevalim opened this issue Mar 27, 2024 · 1 comment · Fixed by #8318
Closed

Wrong error raised when calling function with wrong arity #8316

josevalim opened this issue Mar 27, 2024 · 1 comment · Fixed by #8318
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@josevalim
Copy link
Contributor

Describe the bug

Take this code:

-module(foo).
-compile(export_all).

start() ->
  G = fun(X, Y) -> X + Y end,
  F = fun(A) -> G(A, 0) end,
  F(1, 2).

Then you run it:

$ erl -s foo
Erlang/OTP 26 [erts-14.0.2] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit]

Runtime terminating during boot ({{badfun,2},[{foo,-start/0-fun-1-,2,[{_},{_}]},{init,do_boot,3,[]}]})

Notice it failed with badfun, but it should have been badarity.

Affected versions

I have reproduced it on Erlang/OTP 26.0 and 27.0-rc2. I didn't check earlier versions (because I personally don't find it high priority :D).

Additional context

Originally reported here: elixir-lang/elixir#13447

Thank you. ❤️

@josevalim josevalim added the bug Issue is reported as a bug label Mar 27, 2024
@jhogberg jhogberg self-assigned this Mar 27, 2024
@jhogberg jhogberg added the team:VM Assigned to OTP team VM label Mar 27, 2024
@jhogberg
Copy link
Contributor

Thanks for your report, I've fixed it in #8318 :-)

jhogberg added a commit that referenced this issue Mar 28, 2024
…P-19045' into maint

* john/compiler/fix-local-fun-call-environment/GH-8316/OTP-19045:
  beam_ssa_type: Fix environment check in local fun call optimization
jhogberg added a commit that referenced this issue Apr 2, 2024
…P-19045' into maint

* john/compiler/fix-local-fun-call-environment/GH-8316/OTP-19045:
  fun_SUITE: Fix test snafu in fun_inline_SUITE variant
rickard-green pushed a commit that referenced this issue Apr 12, 2024
…P-19045' into maint-26

* john/compiler/fix-local-fun-call-environment/GH-8316/OTP-19045:
  fun_SUITE: Fix test snafu in fun_inline_SUITE variant
  beam_ssa_type: Fix environment check in local fun call optimization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants