synth_ifthenelse

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

View file

@ -216,7 +216,15 @@ and synth_ifthenelse
: HopixTypes.typing_environment -> expression Position.located
-> expression Position.located -> expression Position.located -> HopixTypes.aty
=
fun tenv ecase eif eelse -> failwith "Students! This is your job! (synth_ifthenelse)"
fun tenv ecase eif eelse ->
(* Pas testé !! *)
let ecasety = synth_expression tenv ecase in
check_equal_types ecase.position ~expected:ecasety ~given:HopixTypes.hbool;
let eifty = synth_expression tenv eif in
check_equal_types eif.position ~expected:eifty ~given:HopixTypes.hunit;
let eelsety = synth_expression tenv eelse in
check_equal_types eelse.position ~expected:eelsety ~given:HopixTypes.hunit;
HopixTypes.hunit
and synth_while
: HopixTypes.typing_environment -> expression Position.located