Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Treat let-module expressions as non-expansive where possible #4838
Original bug ID: 4838
Expressions of the form
let module M = in e
are currently always treated as expansive by the type checker. As a result, in the following declaration "id" is given a non-polymorphic type:
let id = let module M = struct end in fun x -> x
(There are, of course, useful examples as well, particularly where the module expression declares types.)
It seems that many such expressions (including all those where the module-expr is built from non-expansive terms) could be safely treated as non-expansive, increasing the number of typeable programs.
Patch against 3.11.1 attached.