hkust-taco / mlscript

The MLscript programming language. Functional and object-oriented; structurally typed and sound; with powerful type inference. Soon to have full interop with TypeScript!
https://hkust-taco.github.io/mlscript
MIT License
175 stars 27 forks source link

Improve self-type handling #206

Closed LPTK closed 10 months ago

LPTK commented 10 months ago

This PR fixes various issues with the handling of self types and adds self-type checking. As a byproduct, it makes class constructors return proper type refs, which has the welcome benefit of simplifying some inferred recursive types by tying the knot earlier!

To deal with:

LPTK commented 10 months ago

@NeilKleistGao Wow, nice catch! Funnily the SOF happened in type simplification. It was an easy fix.

LPTK commented 10 months ago

Thanks for the quick review!