synth_for

This commit is contained in:
Mylloon 2023-12-05 04:29:42 +01:00
parent 419e3e962e
commit 52eabc2697
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -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