Closed nadako closed 5 years ago
It's explicitly implemented here: https://github.com/HaxeFoundation/haxe/blob/bdddb588cbb99e2bb0428a79e6a6aef614715225/src/typing/matcher.ml#L244-L248 I didn't find any clue to why it is done. Disabling it doesn't break any tests. @Simn ?
are you sure it's about this issue and not #8579? :)
Oh, right :)
There's been some kind of "selective methods" or whatever they're termed. IIRC it was even in the manual at some point in time, but I can't find it anymore.
For @:to
casts, it allows you to specialize on type parameter: http://try-haxe.mrcdk.com/#c0c9D
I guess it would look less weird if the argument were the abstract instead of the underlying type.
Checklist for any change regarding @:multiType
:
Map
?Map
differently.Static @:to
is actually intended to work with non-multitype abstracts to allow specialization of @:to
methods based on type parameters: #1419
https://github.com/HaxeFoundation/haxe/blob/c60166a8272726b42fdc9f7858b3337ed8151f6e/tests/unit/src/unit/MyAbstract.hx#L107-L115
This compiles, while it probably should not:
Looks like there are some missing checks for
@:impl
and friends (or they are done at the wrong time).Maybe static
@:to
methods shouldn't be allowed at all for non-@:multiType
abstracts?