HaxeFoundation / haxe

Haxe - The Cross-Platform Toolkit
https://haxe.org
6.03k stars 648 forks source link

Valid redefinition rework #11657

Closed Simn closed 1 month ago

Simn commented 1 month ago

This changes how valid_redefinition deals with type parameters by introducing type_param_mode to unification and using a special TpDefinition mode. When encountering a type parameter to type parameter assignment in that mode, we pair the two up and admit the unification. Once we're done with that, we check that the constraints.

Constraint checks now use unification instead of type equality, which means that they respect variance. See the tests for examples, I hope I got everything right.

This shouldn't outright break anything but there's a chance we're adding type holes.

Closes #11411.

Simn commented 1 month ago

There's a sequel commit that deals with #11624, but that one will break some code by design, so I'd like to handle it separately.