Skip to content

Unboxability check breaks with module constraints #9607

@stedolan

Description

@stedolan

This program was accepted with 4.10:

module type T  = sig type 'k t end

module M : T with type 'k t = string = struct
  type 'k t = string
end

type t = T : 'k M.t -> t [@@unboxed]

but with 4.11 or trunk, gives this error:

File "/home/sdolan/q/hax/unbox.ml", line 7, characters 0-36:
7 | type t = T : 'k M.t -> t [@@unboxed]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: This type cannot be unboxed because
       it might contain both float and non-float values,
       depending on the instantiation of the existential variable 'k.
       You should annotate it with [@@ocaml.boxed].

Removing the no-op with type 'k t = string constraint makes it pass again.

Curiously, manually expanding module M : T with type 'k t = string into module M : sig type 'k t = string end makes it pass as well, so the issue is probably something to do with with-constraints?

(cc @rlepigre, @gasche)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions