Skip to content

Issue with unboxability check #9624

@hhugo

Description

@hhugo

The following use to compile with OCaml 4.10 and no longer does (OCaml 4.11).
It was first reported as #9607, The fix in #9609 was not enough and introduced in uncaught exception. It's unclear to me whether there are multiple issues at play here.

module Private_variant = struct

  type 'a t = A : 'e -> 'e t

end

module type Public = sig
  module Event : sig
    type 'e t = 'e Private_variant.t
  end
  type t = T : 'e Event.t -> t [@@unboxed]
end

module type Component = sig

  include Public

  module type Public = Public
    with type 'e Event.t = 'e Event.t
     and type t = t
end

Here is the error I get with @gasche 's patch from #9609 (comment)

File "/home/hheuzard/a.ml", line 20, characters 9-19:
20 |      and type t = t
              ^^^^^^^^^^
Error: This type cannot be unboxed because
       it might contain both float and non-float values,
       depending on the instantiation of an unnamed existential variable.
       You should annotate it with [@@ocaml.boxed].

@gasche proposed the following slightly simpler repro case

module type Sig = sig
  type 'a ind = 'a * int
  type t = T : 'e ind -> t [@@unboxed]
end

module type Problem = sig
  include Sig
  module type ReboundSig = Sig
    with type 'a ind = 'a ind
     and type t = t
end

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