summaryrefslogtreecommitdiff
path: root/lib/compiler/src/beam_validator.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-rw-r--r--lib/compiler/src/beam_validator.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl
index f19ea897fe..285db8a26a 100644
--- a/lib/compiler/src/beam_validator.erl
+++ b/lib/compiler/src/beam_validator.erl
@@ -2830,7 +2830,13 @@ unpack_typed_arg(#tr{r=Reg,t=Type}, Vst) ->
%% The validator is not yet clever enough to do proper range analysis like
%% the main type pass, so our types will be a bit cruder here, but they
%% should at the very least not be in direct conflict.
- true = none =/= beam_types:meet(get_movable_term_type(Reg, Vst), Type),
+ Current = get_movable_term_type(Reg, Vst),
+ case beam_types:meet(Current, Type) of
+ none ->
+ throw({bad_typed_register, Current, Type});
+ _ ->
+ ok
+ end,
Reg;
unpack_typed_arg(Arg, _Vst) ->
Arg.