synth_variable

This commit is contained in:
Mylloon 2023-12-04 23:36:08 +01:00
parent 1af819d86d
commit 6338b05d39
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -97,7 +97,16 @@ and synth_variable
: HopixTypes.typing_environment -> identifier Position.located : HopixTypes.typing_environment -> identifier Position.located
-> ty Position.located list option -> HopixTypes.aty -> ty Position.located list option -> HopixTypes.aty
= =
fun tenv i tx -> failwith "Students! This is your job! (synth_variable)" fun tenv id tlist ->
(* Get variable type *)
let ty =
try HopixTypes.lookup_type_scheme_of_identifier id.position id.value tenv with
| HopixTypes.Unbound (pos, Identifier (Id i)) ->
HopixTypes.type_error pos (Printf.sprintf "%s unbound" i)
in
match tlist with
| None -> HopixTypes.instantiate_type_scheme ty []
| Some _ -> failwith "Students! This is your job! (synth_variable tlist not None)"
and synth_tagged and synth_tagged
: HopixTypes.typing_environment -> constructor Position.located : HopixTypes.typing_environment -> constructor Position.located