millet icon indicating copy to clipboard operation
millet copied to clipboard

Thinks Polymorphic Exceptions Don't Typecheck

Open qtgeo1248 opened this issue 1 year ago • 1 comments

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`

qtgeo1248 avatar Mar 18 '24 20:03 qtgeo1248

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.

azdavis avatar Apr 03 '24 17:04 azdavis

fixed released in v0.14.4

azdavis avatar Apr 26 '24 03:04 azdavis