diff options
author | John Högberg <[email protected]> | 2019-05-24 15:47:37 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-05-27 11:32:02 +0200 |
commit | 00dc96a9a0086e829e574b651b4a28155aa826df (patch) | |
tree | 83c34f5785dc7595c148848e5d646c42014c9a79 /lib/compiler/src/beam_ssa_type.erl | |
parent | d32991afaf3fc5f9f73e3e2448672bb9a1b80101 (diff) | |
download | otp-00dc96a9a0086e829e574b651b4a28155aa826df.tar.gz otp-00dc96a9a0086e829e574b651b4a28155aa826df.tar.bz2 otp-00dc96a9a0086e829e574b651b4a28155aa826df.zip |
compiler: Fix broken type for erlang:'++'/2
Diffstat (limited to 'lib/compiler/src/beam_ssa_type.erl')
-rw-r--r-- | lib/compiler/src/beam_ssa_type.erl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/compiler/src/beam_ssa_type.erl b/lib/compiler/src/beam_ssa_type.erl index 06b42f1928..fe229d25df 100644 --- a/lib/compiler/src/beam_ssa_type.erl +++ b/lib/compiler/src/beam_ssa_type.erl @@ -896,11 +896,15 @@ type(call, [#b_remote{mod=#b_literal{val=Mod}, {_,_} -> #t_tuple{} end; - {erlang,'++',[List1,List2]} -> - case get_type(List1, Ts) =:= cons orelse - get_type(List2, Ts) =:= cons of - true -> cons; - false -> list + {erlang,'++',[LHS,RHS]} -> + LType = get_type(LHS, Ts), + RType = get_type(RHS, Ts), + case LType =:= cons orelse RType =:= cons of + true -> + cons; + false -> + %% `[] ++ RHS` yields RHS, even if RHS is not a list. + join(list, RType) end; {erlang,'--',[_,_]} -> list; |