-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
For instance:
type foo = int [@@deriving qcheck]
type 'foo s = ('foo * foo) [@@deriving qcheck]
type t = float s [@@deriving qcheck]will yield something in the lines of:
Error: Signature mismatch:
...
Values do not match:
val gen : (float * float) QCheck.Gen.t
is not included in
val gen : t QCheck.Gen.t
The type
(float * float) QCheck.Gen.t = Random.State.t -> float * float
is not compatible with the type
t QCheck.Gen.t = Random.State.t -> t
Type float * float is not compatible with type t = float * a
Type float is not compatible with type a
My guess is that it is because ppx_deriving_qcheck derives a variable name deterministically from the name of the type constructor or type parameter, both of which are foo in this example.
An easy patch is to add a prefix to disambiguate (eg. var_foo vs foo); a clean patch is to rely on Ppx_deriving's quoters. This is very much a corner case, and it would be rather ugly OCaml to do this in the first place, so I'm not even sure it is worth fixing; I only discovered it while testing my own deriver (that also doesn't use a quoter) for this precise corner case.
Metadata
Metadata
Assignees
Labels
No labels