diff --git a/flap/src/hopix/hopixTypechecker.ml b/flap/src/hopix/hopixTypechecker.ml index cb2028b..2d7918a 100644 --- a/flap/src/hopix/hopixTypechecker.ml +++ b/flap/src/hopix/hopixTypechecker.ml @@ -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