synth_for
This commit is contained in:
parent
419e3e962e
commit
52eabc2697
1 changed files with 14 additions and 1 deletions
|
@ -242,7 +242,20 @@ and synth_for
|
||||||
-> expression Position.located -> expression Position.located
|
-> expression Position.located -> expression Position.located
|
||||||
-> expression Position.located -> HopixTypes.aty
|
-> expression Position.located -> HopixTypes.aty
|
||||||
=
|
=
|
||||||
fun tenv id estart eend expr -> failwith "Students! This is your job! (synth_for)"
|
fun tenv id estart eend expr ->
|
||||||
|
let estart_ty = synth_expression tenv estart in
|
||||||
|
check_equal_types estart.position ~expected:estart_ty ~given:HopixTypes.hint;
|
||||||
|
let eend_ty = synth_expression tenv eend in
|
||||||
|
check_equal_types eend.position ~expected:eend_ty ~given:HopixTypes.hint;
|
||||||
|
let tenv' =
|
||||||
|
HopixTypes.bind_value
|
||||||
|
id.value
|
||||||
|
(HopixTypes.monomorphic_type_scheme HopixTypes.hint)
|
||||||
|
tenv
|
||||||
|
in
|
||||||
|
let e_ty = synth_expression tenv' expr in
|
||||||
|
check_equal_types expr.position ~expected:e_ty ~given:HopixTypes.hunit;
|
||||||
|
HopixTypes.hunit
|
||||||
|
|
||||||
and check_expression
|
and check_expression
|
||||||
: HopixTypes.typing_environment -> HopixAST.expression Position.located
|
: HopixTypes.typing_environment -> HopixAST.expression Position.located
|
||||||
|
|
Reference in a new issue