diff options
author | Chimrod <> | 2024-06-06 15:11:05 +0200 |
---|---|---|
committer | Chimrod <> | 2024-06-06 15:11:05 +0200 |
commit | 89c19613764368afba6659e8586dec010c9b9d6b (patch) | |
tree | 803ad12c0b9b7effc0e5d0b50ce049f036fa0811 /lib | |
parent | 4535058e48fc8edc44be20b92a182279eb9e1569 (diff) |
Forgot the case where + is used as a concatenation operator
Diffstat (limited to 'lib')
-rw-r--r-- | lib/syntax/get_type.ml | 4 | ||||
-rw-r--r-- | lib/syntax/type_of.ml | 17 |
2 files changed, 6 insertions, 15 deletions
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 |