From c98eb70a06e7b48fd343953308a5a0ad5b81e1f0 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 6 Dec 2023 09:53:01 +0100 Subject: [PATCH] move synth_branch --- flap/src/hopix/hopixTypechecker.ml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/flap/src/hopix/hopixTypechecker.ml b/flap/src/hopix/hopixTypechecker.ml index b55c267..d4037f4 100644 --- a/flap/src/hopix/hopixTypechecker.ml +++ b/flap/src/hopix/hopixTypechecker.ml @@ -444,6 +444,17 @@ and synth_read let refty = synth_expression tenv ref in HopixTypes.destruct_reference_type ref.position refty +and synth_case + : HopixTypes.typing_environment -> expression Position.located + -> branch Position.located list -> HopixTypes.aty + = + fun tenv expr branches -> + let casety = synth_expression tenv expr in + (* Test les branches *) + match List.fold_right (synth_branch tenv casety) branches None with + | Some branchesty -> branchesty + | None -> HopixTypes.type_error expr.position "No types found." + and synth_branch : HopixTypes.typing_environment -> HopixTypes.aty -> branch Position.located -> HopixTypes.aty option -> HopixTypes.aty option @@ -458,17 +469,6 @@ and synth_branch | Some ty' -> check_equal_types e.position ~expected:ty' ~given:given_branch); Some given_branch -and synth_case - : HopixTypes.typing_environment -> expression Position.located - -> branch Position.located list -> HopixTypes.aty - = - fun tenv expr branches -> - let casety = synth_expression tenv expr in - (* Test les branches *) - match List.fold_right (synth_branch tenv casety) branches None with - | Some branchesty -> branchesty - | None -> HopixTypes.type_error expr.position "No types found." - and synth_ifthenelse : HopixTypes.typing_environment -> expression Position.located -> expression Position.located -> expression Position.located -> HopixTypes.aty