aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorHans Bolinder <[email protected]>2014-11-25 09:04:13 +0100
committerHans Bolinder <[email protected]>2014-11-25 09:04:13 +0100
commit872fa86ddebbc84b07dc5426d25f7fb300731f52 (patch)
tree3c43332e7dd1eb6c83c2f685d8a571d1347a0087 /lib/stdlib
parentee11116c547c4559ed899ecadef9cf2038b2b336 (diff)
parentd09c774343b78d663143ecc8930743ccded5f1c1 (diff)
downloadotp-872fa86ddebbc84b07dc5426d25f7fb300731f52.tar.gz
otp-872fa86ddebbc84b07dc5426d25f7fb300731f52.tar.bz2
otp-872fa86ddebbc84b07dc5426d25f7fb300731f52.zip
Merge branch 'hb/dialyzer/fix_a_record_bug/OTP-12319' into maint
* hb/dialyzer/fix_a_record_bug/OTP-12319: dialyzer: correct record updates
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/erl_expand_records.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/stdlib/src/erl_expand_records.erl b/lib/stdlib/src/erl_expand_records.erl
index c74f68647f..64a00acd88 100644
--- a/lib/stdlib/src/erl_expand_records.erl
+++ b/lib/stdlib/src/erl_expand_records.erl
@@ -702,9 +702,10 @@ record_update(R, Name, Fs, Us0, St0) ->
record_match(R, Name, Lr, Fs, Us, St0) ->
{Ps,News,St1} = record_upd_fs(Fs, Us, St0),
NLr = neg_line(Lr),
+ RLine = record_offset(Lr, St1),
{{'case',Lr,R,
- [{clause,Lr,[{tuple,Lr,[{atom,Lr,Name} | Ps]}],[],
- [{tuple,Lr,[{atom,Lr,Name} | News]}]},
+ [{clause,Lr,[{tuple,RLine,[{atom,Lr,Name} | Ps]}],[],
+ [{tuple,RLine,[{atom,Lr,Name} | News]}]},
{clause,NLr,[{var,NLr,'_'}],[],
[call_error(NLr, {tuple,NLr,[{atom,NLr,badrecord},{atom,NLr,Name}]})]}
]},
@@ -733,6 +734,10 @@ record_setel(R, Name, Fs, Us0) ->
Lr = element(2, hd(Us)),
Wildcards = duplicate(length(Fs), {var,Lr,'_'}),
NLr = neg_line(Lr),
+ %% Note: calling record_offset() here is not necessary since it is
+ %% targeted at Dialyzer which always calls the compiler with
+ %% 'strict_record_updates' meaning that record_setel() will never
+ %% be called.
{'case',Lr,R,
[{clause,Lr,[{tuple,Lr,[{atom,Lr,Name} | Wildcards]}],[],
[foldr(fun ({I,Lf,Val}, Acc) ->