diff options
| author | Alasdair | 2019-01-22 03:08:46 +0000 |
|---|---|---|
| committer | Alasdair | 2019-01-22 03:09:27 +0000 |
| commit | 63a3cdcd18972cdc2b6fa24d6a2deb5cae7549cc (patch) | |
| tree | 7912ef0c4e1af79847c6245a8bf1efc847929dcc /src | |
| parent | 8a3c75dfd07d7264a82450aaebce86b5e82c974b (diff) | |
Make sure we optimize constrained union constructors
Diffstat (limited to 'src')
| -rw-r--r-- | src/c_backend.ml | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/c_backend.ml b/src/c_backend.ml index 65702764..f02cdb9c 100644 --- a/src/c_backend.ml +++ b/src/c_backend.ml @@ -1399,9 +1399,11 @@ let compile_type_def ctx (TD_aux (type_def, _)) = CTD_struct (id, Bindings.bindings ctors), { ctx with records = Bindings.add id ctors ctx.records } - | TD_variant (id, _, _, tus, _) -> + | TD_variant (id, _, typq, tus, _) -> let compile_tu = function - | Tu_aux (Tu_ty_id (typ, id), _) -> ctyp_of_typ ctx typ, id + | Tu_aux (Tu_ty_id (typ, id), _) -> + let ctx = { ctx with local_env = add_typquant (id_loc id) typq ctx.local_env } in + ctyp_of_typ ctx typ, id in let ctus = List.fold_left (fun ctus (ctyp, id) -> Bindings.add id ctyp ctus) Bindings.empty (List.map compile_tu tus) in CTD_variant (id, Bindings.bindings ctus), |
