synth_variable
This commit is contained in:
parent
1af819d86d
commit
6338b05d39
1 changed files with 10 additions and 1 deletions
|
@ -97,7 +97,16 @@ and synth_variable
|
|||
: HopixTypes.typing_environment -> identifier Position.located
|
||||
-> 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
|
||||
: HopixTypes.typing_environment -> constructor Position.located
|
||||
|
|
Reference in a new issue