synth_while

This commit is contained in:
Mylloon 2023-12-05 04:17:56 +01:00
parent 45bbd6a0dd
commit 419e3e962e
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -230,7 +230,12 @@ and synth_while
: HopixTypes.typing_environment -> expression Position.located
-> expression Position.located -> HopixTypes.aty
=
fun tenv ecase expr -> failwith "Students! This is your job! (synth_while)"
fun tenv ecase c ->
let ecasety = synth_expression tenv ecase in
check_equal_types ecase.position ~expected:ecasety ~given:HopixTypes.hbool;
let exprty = synth_expression tenv c in
check_equal_types c.position ~expected:exprty ~given:HopixTypes.hunit;
HopixTypes.hunit
and synth_for
: HopixTypes.typing_environment -> identifier Position.located