aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_validator.erl
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2019-05-28 11:36:33 +0200
committerJohn Högberg <[email protected]>2019-05-28 11:36:33 +0200
commit840d77f10ed5897a1eb69e179dbdca5e47deb152 (patch)
treef365a1b47e88e4bbf755f6b555945396ec7fd95e /lib/compiler/src/beam_validator.erl
parent4953ee5e5f02adba1bd511a8f628f198d14676e7 (diff)
parent0e72e780498e47614de5730c8d4453948c9ad1da (diff)
downloadotp-840d77f10ed5897a1eb69e179dbdca5e47deb152.tar.gz
otp-840d77f10ed5897a1eb69e179dbdca5e47deb152.tar.bz2
otp-840d77f10ed5897a1eb69e179dbdca5e47deb152.zip
Merge branch 'maint'
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-rw-r--r--lib/compiler/src/beam_validator.erl12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index 0ae3b4ed1f..717ea17475 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -2854,10 +2854,14 @@ call_return_type_1(erlang, setelement, 3, Vst) ->
setelement(3, TupleType, #{})
end;
call_return_type_1(erlang, '++', 2, Vst) ->
- case get_term_type({x,0}, Vst) =:= cons orelse
- get_term_type({x,1}, Vst) =:= cons of
- true -> cons;
- false -> list
+ LType = get_term_type({x,0}, Vst),
+ RType = get_term_type({x,1}, Vst),
+ case LType =:= cons orelse RType =:= cons of
+ true ->
+ cons;
+ false ->
+ %% `[] ++ RHS` yields RHS, even if RHS is not a list
+ join(list, RType)
end;
call_return_type_1(erlang, '--', 2, _Vst) ->
list;