gluon-lang / gluon

A static, type inferred and embeddable language written in Rust.
https://gluon-lang.org
MIT License
3.16k stars 145 forks source link

Stack overflow with polymorphic recursion #952

Open lukechu10 opened 1 year ago

lukechu10 commented 1 year ago

The following code currently produces a stack overflow:

type Foo a = | FooA a
let f x = f (FooA x)

Polymorphic recursion is generally not allowed is other languages because it makes type inference undecidable. I'm guessing the stack overflow is because it's not possible to unify the type of f here?

Marwes commented 1 year ago

Yeah, that should be an error just that the error isn't detected (might have had detection for it, but I guess I broke it in that case)