Thinks Polymorphic Exceptions Don't Typecheck
Environment
- Millet version: 0.14.3
- Editor version: VS Code 1.87.2
- OS version: macOS 14.3.1
Steps to reproduce
Have this piece of code:
fun funny x =
let
exception Poly of 'a
in
raise Poly x
end
which compiles just fine
Expected behavior
I expect Millet to know this is valid SML code
Actual behavior
However, Millet gives me
undefined type variable: `'a`
fixed in 8fffb42c25d05ad60dbff63f5e9ec127c7da3170.
i want to update an internal dep of millet before making a release containing this change. that update will require careful refactoring, so it might be a while longer.
as a side note, i also followed up on the above commit with some further commits to improve the docs and tests of the implicit ty var scoping code. we also now correctly handle implicit scoping in datatype and type.
for example, consider this:
fun f x =
let
datatype t = Poly of 'a
(** ^^ not allowed here *)
in
Poly x; 4
end
this used to error with "undefined type variable: 'a", but now 'a is correctly implicitly scoped to fun f. however we still emit error 5030 (the "not allowed here" error), which i believe i added to duplicate the behavior of sml/nj, which rejects the above. mlton does not error at all for the above.
fixed released in v0.14.4