Normalize struct field types to be shallow

Reviewed By: cristianoc

Differential Revision: D3791867

fbshipit-source-id: 3f115b1
master
Josh Berdine 8 years ago committed by Facebook Github Bot 6
parent 548338bb4e
commit 4706f25bf7

@ -40,6 +40,21 @@ let mk_struct
supers::supers=?
annots::annots=?
name => {
let normalize_fields fs =>
IList.map_changed
(
fun ((fld, typ, ann) as fta) =>
switch typ {
| Typ.Tstruct {name} => (fld, Typ.Tvar name, ann)
| _ => fta
}
)
fs;
let fields =
switch fields {
| Some fields => Some (normalize_fields fields)
| None => fields
};
let struct_typ =
Typ.internal_mk_struct
default::?default

@ -494,12 +494,11 @@ let internal_mk_struct
()
};
let name t =>
switch t {
let name =
fun
| Tvar name
| Tstruct {name} => Some name
| _ => None
};
| _ => None;
let unsome s =>
fun

Loading…
Cancel
Save