From 89c19613764368afba6659e8586dec010c9b9d6b Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Thu, 6 Jun 2024 15:11:05 +0200 Subject: Forgot the case where + is used as a concatenation operator --- lib/syntax/get_type.ml | 4 ++-- lib/syntax/type_of.ml | 17 ++++------------- 2 files changed, 6 insertions(+), 15 deletions(-) (limited to 'lib/syntax') diff --git a/lib/syntax/get_type.ml b/lib/syntax/get_type.ml index c8af9ec..442f49f 100644 --- a/lib/syntax/get_type.ml +++ b/lib/syntax/get_type.ml @@ -7,9 +7,9 @@ type type_of = | NumericString [@printer fun fmt _ -> Format.pp_print_string fmt "Integer as String"] (** String containing a numeric value *) -[@@deriving show { with_path = false }] +[@@deriving show { with_path = false }, eq] -type t = Variable of type_of | Raw of type_of +type t = Variable of type_of | Raw of type_of [@@deriving show, eq] type t' = t let v = Fun.id diff --git a/lib/syntax/type_of.ml b/lib/syntax/type_of.ml index d0437c9..6c02e91 100644 --- a/lib/syntax/type_of.ml +++ b/lib/syntax/type_of.ml @@ -324,20 +324,11 @@ module TypedExpression = struct match operator with | T.Plus -> - let d = Helper.DynType.t () in - (* Remove the empty elements *) - let types = - List.filter_map - [ (type_1, t1); (type_2, t2) ] - ~f:(fun (type_of, t) -> - (* TODO could be added in the logs *) - match t.empty with - | true -> None - | false -> Some (arg_of_repr type_of t.pos)) - in - let expected = List.map types ~f:(fun _ -> Helper.Dynamic d) in + (* We cannot really much here, because the (+) function can be used to + concatenate string or add numbers. - let report = Helper.compare_args pos expected types report in + When concatenating, it’s allowed to add an integer and a number. + *) ({ pos; empty = false }, report) | T.Eq | T.Neq | Lt | Gte | Lte | Gt -> (* If the expression is '' or 0, we accept the comparaison as if -- cgit v1.2.3