From 8f3f3589b949e1d6b8041414cec86f901d800b69 Mon Sep 17 00:00:00 2001
From: Chimrod <>
Date: Tue, 11 Jun 2024 22:11:08 +0200
Subject: Regression in the latest modifications

---
 lib/syntax/type_of.ml | 9 +++++----
 test/type_of.ml       | 2 ++
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/lib/syntax/type_of.ml b/lib/syntax/type_of.ml
index 6c02e91..91b8c57 100644
--- a/lib/syntax/type_of.ml
+++ b/lib/syntax/type_of.ml
@@ -439,7 +439,7 @@ module Instruction = struct
       T.assignation_operator ->
       expression ->
       t =
-   fun pos variable _ expression ->
+   fun pos variable op expression ->
     let right_expression, report = expression in
 
     let report' = Option.map snd variable.index |> Option.value ~default:[] in
@@ -447,13 +447,14 @@ module Instruction = struct
     let report = List.rev_append report' report in
     match
       ( right_expression.empty,
+        op,
         Get_type.get_type (Lazy.force right_expression.result) )
     with
-    | true, _
+    | true, _, _
     (* It’s allowed to assign an integer in any kind of variable *)
-    | _, Get_type.(Integer) ->
+    | _, T.Eq', Get_type.(Integer) ->
         report
-    | false, _ -> (
+    | false, _, _ -> (
         let var_type = Lazy.from_val (Get_type.ident variable) in
         let op1 = arg_of_repr var_type variable.pos in
         let op2 = arg_of_repr right_expression.result right_expression.pos in
diff --git a/test/type_of.ml b/test/type_of.ml
index aac928e..e5db14e 100644
--- a/test/type_of.ml
+++ b/test/type_of.ml
@@ -74,6 +74,7 @@ let wrong_predicate () =
     ]
 
 let concat_text () = _test_instruction {|$a = 'A' + 1|} []
+let increment_string () = _test_instruction {|$a += 1|} (message' Error)
 
 let test =
   ( "Typechecking",
@@ -93,4 +94,5 @@ let test =
       Alcotest.test_case "Comparaison Mismatch" `Quick type_comparaison_mismatch;
       Alcotest.test_case "Wrong predicate" `Quick wrong_predicate;
       Alcotest.test_case "+(int, str)" `Quick concat_text;
+      Alcotest.test_case "str +=  int" `Quick increment_string;
     ] )
-- 
cgit v1.2.3