From 419e3e962ec0b9d5bc1b5d8b45d987cbc348865a Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 5 Dec 2023 04:17:56 +0100 Subject: [PATCH] synth_while --- flap/src/hopix/hopixTypechecker.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/flap/src/hopix/hopixTypechecker.ml b/flap/src/hopix/hopixTypechecker.ml index 694c74f..594ace2 100644 --- a/flap/src/hopix/hopixTypechecker.ml +++ b/flap/src/hopix/hopixTypechecker.ml @@ -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