wip: record

This commit is contained in:
Mylloon 2023-12-05 12:30:16 +01:00
parent f44b7a585e
commit 4266ff5111
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -138,7 +138,18 @@ and synth_record
-> (label Position.located * expression Position.located) list
-> ty Position.located list option -> HopixTypes.aty
=
fun tenv field tlist -> failwith "Students! This is your job! (synth_record)"
fun tenv field tlist ->
let fl = fst (List.hd field) in
let cons, _, _ =
HopixTypes.lookup_type_constructor_of_label fl.position fl.value tenv
in
let tlist' =
match tlist with
| Some tlist -> List.map (fun t -> HopixTypes.internalize_ty tenv t) tlist
| None -> HopixTypes.type_error fl.position "No types ??"
in
(* TODO: Typecheck *)
ATyCon (cons, tlist')
and synth_fun
: HopixTypes.typing_environment -> pattern Position.located