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

Erlang fails to compile valid code on tuple element guards #7488

Closed
ityonemo opened this issue Jul 10, 2023 · 1 comment · Fixed by #7489
Closed

Erlang fails to compile valid code on tuple element guards #7488

ityonemo opened this issue Jul 10, 2023 · 1 comment · Fixed by #7489
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@ityonemo
Copy link

The following minimized code fails to compile:

-module(broken).
-export([bar/1]).

bar(X) ->
    case foo(X) of
        Tuple when element(1, Tuple) =:= ok ->
            ok;
        Tuple when element(1, Tuple) =:= error ->
            element(2, Tuple)
    end.

foo(X) ->
    case X of
        true -> {ok};
        false -> {error, <<"aaaa">>}
    end.

with the error:
Sub pass ssa_opt_type_continue

OTP 26-only

@jhogberg
Copy link
Contributor

Thanks for your report! I've fixed it in #7489 :)

jhogberg added a commit to jhogberg/otp that referenced this issue Jul 14, 2023
jhogberg added a commit to jhogberg/otp that referenced this issue Jul 14, 2023
jhogberg added a commit to jhogberg/otp that referenced this issue Jul 14, 2023
jhogberg added a commit that referenced this issue Jul 24, 2023
…18678' into maint

* john/compiler/fix-missing-type-subtraction/GH-7488/OTP-18678:
  beam_ssa_type: Fix bugs relating to subtraction in type inference
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