Skip to content

let module value restriction regression in 5.5? #14554

@anmonteiro

Description

@anmonteiro

I'm wondering whether #13839 meant to introduce this change in how the following program gets type checked (cc @nojb).Take this minimal example:

type 'a t

let dog : 'this =
  let module Dog = struct
    external make
      : bark:('self -> unit)
      -> < bark : ('self -> unit) > t = "" ""
  end
  in
  Dog.make ~bark:(fun (o : 'this) -> ())

Before #13839:

$ ocamlc -stop-after typing x.ml
$ echo $?
0

After #13839:

$ ./ocamlc.opt -I stdlib -stop-after typing x.ml
File "x.ml", line 4, characters 4-7:
4 | let dog : 'this =
        ^^^
Error: The type of this expression, < bark : '_this -> unit > t,
       contains the non-generalizable type variable(s): '_this.
       (see manual section 6.1.2)

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