summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Bauereiss2019-01-23 14:49:05 +0000
committerThomas Bauereiss2019-01-23 14:49:05 +0000
commit69fec085c3c35f4834c28b92f418afa7960ca969 (patch)
tree02d98a57c51c934d3526b3f3104b6362a572d52c /src
parent8883d3a5a516e65825ad844a8b985f8be79f4f89 (diff)
Make rewriting of E_assign a bit more robust
Diffstat (limited to 'src')
-rw-r--r--src/rewrites.ml10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/rewrites.ml b/src/rewrites.ml
index fdcfb71c..39f753ef 100644
--- a/src/rewrites.ml
+++ b/src/rewrites.ml
@@ -3887,12 +3887,10 @@ let rec rewrite_var_updates ((E_aux (expaux,((l,_) as annot))) as exp) =
let v = fix_eff_exp (annot_exp expaux pl env typ) in
Added_vars (v, tuple_pat (if overwrite then varpats else pat :: varpats))
| E_assign (lexp,vexp) ->
- let mk_id_pat id = match Env.lookup_id id env with
- | Local (_, typ) ->
- add_p_typ typ (annot_pat (P_id id) pl env typ)
- | _ ->
- raise (Reporting.err_unreachable pl __POS__
- ("Failed to look up type of variable " ^ string_of_id id)) in
+ let mk_id_pat id =
+ let typ = lvar_typ (Env.lookup_id id env) in
+ add_p_typ typ (annot_pat (P_id id) pl env typ)
+ in
if effectful exp then
Same_vars (E_aux (E_assign (lexp,vexp),annot))
else