From 4266ff51113d4506edf0524f918112e88555d9d4 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 5 Dec 2023 12:30:16 +0100 Subject: [PATCH] wip: record --- flap/src/hopix/hopixTypechecker.ml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/flap/src/hopix/hopixTypechecker.ml b/flap/src/hopix/hopixTypechecker.ml index 9b5e0e5..a32f3aa 100644 --- a/flap/src/hopix/hopixTypechecker.ml +++ b/flap/src/hopix/hopixTypechecker.ml @@ -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