Commit cab95daa authored by POTTIER Francois's avatar POTTIER Francois

Add negative test cases where a warning should be issued (and the generated...

Add negative test cases where a warning should be issued (and the generated code is rejected by OCaml).
parent 19ee11b3
module Elt = struct
type t = int
end
type t =
| Leaf
| Node of { left: t; value: Elt.t; right: t }
[@@deriving visitors { variety = "iter" } ]
(*
Issue 3, reported by Gabriel Radanne.
https://gitlab.inria.fr/fpottier/visitors/issues/3
File "conflict.ml", line 5, characters 0-111:
Error: This expression has type Elt.t = int
but an expression was expected of type t
The naming convention for visitor methods causes a name clash:
the types [Elt.t] and [t] have visitor methods by the same name.
A warning should be issued.
*)
module Elt = struct
type elt = int
end
type t =
| Leaf
| Node of { left: t; value: (Elt.elt[@name "t"]); right: t }
[@@deriving visitors { variety = "iter" } ]
(*
In this example, a stupid [@name] attribute causes a name clash:
the types [elt] and [t] have visitor methods by the same name.
A warning should be issued.
*)
type t =
| Leaf
| Node of { left: t; value: elt; right: t }
[@@deriving visitors { variety = "iter" } ]
and elt = int[@@name "t"]
(*
In this example, a stupid [@name] attribute causes a name clash:
the types [elt] and [t] have visitor methods by the same name.
A warning should be issued.
*)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment