From f82e28cd8ba8c1c5ceca19a299b0304e2efd1baf Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 5 Dec 2023 04:08:51 +0100 Subject: [PATCH] synth_assign --- flap/src/hopix/hopixTypechecker.ml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flap/src/hopix/hopixTypechecker.ml b/flap/src/hopix/hopixTypechecker.ml index 017134e..c07e501 100644 --- a/flap/src/hopix/hopixTypechecker.ml +++ b/flap/src/hopix/hopixTypechecker.ml @@ -191,7 +191,13 @@ and synth_assign : HopixTypes.typing_environment -> expression Position.located -> expression Position.located -> HopixTypes.aty = - fun tenv ref expr -> failwith "Students! This is your job! (synth_assign)" + fun tenv ref expr -> + let refty = synth_expression tenv ref in + match HopixTypes.destruct_reference_type expr.position refty with + | expected -> + let given = synth_expression tenv expr in + check_equal_types expr.position ~expected ~given; + HopixTypes.hunit and synth_read : HopixTypes.typing_environment -> expression Position.located -> HopixTypes.aty