diff options
author | John Högberg <[email protected]> | 2019-05-03 09:55:37 +0200 |
---|---|---|
committer | John Högberg <[email protected]> | 2019-05-03 10:39:59 +0200 |
commit | c267e7d5f69bcd620c698df0c807c5e3d4492f21 (patch) | |
tree | 09c249b1e893585ef6ad2b404642dad40109c506 /lib | |
parent | 04607bbbcd03806ce49149229267436b00317f52 (diff) | |
download | otp-c267e7d5f69bcd620c698df0c807c5e3d4492f21.tar.gz otp-c267e7d5f69bcd620c698df0c807c5e3d4492f21.tar.bz2 otp-c267e7d5f69bcd620c698df0c807c5e3d4492f21.zip |
beam_validator: Fail when trying to set the type of a dead value
The comment is outdated; trying to update the type of a dead value
will result in a type conflict, making this code unreachable.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index 79bd6480a4..5d017a0568 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -1848,16 +1848,9 @@ get_reg_vref({y,_}=Src, #vst{current=#st{ys=Ys}}) -> end. set_type(Type, #value_ref{}=Ref, #vst{current=#st{vs=Vs0}=St}=Vst) -> - case Vs0 of - #{ Ref := #value{}=Entry } -> - Vs = Vs0#{ Ref => Entry#value{type=Type} }, - Vst#vst{current=St#st{vs=Vs}}; - #{} -> - %% Dead references may happen during type inference and are not an - %% error in and of themselves. If a problem were to arise from this - %% it'll explode elsewhere. - Vst - end. + #{ Ref := #value{}=Entry } = Vs0, + Vs = Vs0#{ Ref => Entry#value{type=Type} }, + Vst#vst{current=St#st{vs=Vs}}. new_value(Type, Op, Ss, #vst{current=#st{vs=Vs0}=St,ref_ctr=Counter}=Vst) -> Ref = #value_ref{id=Counter}, |