New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@:structInit on forwarded abstracts breaks when using @:from another structInit type #11535
Comments
That looks a bit painful... What probably happens is that the compiler refuses to top-down infer because of multiple choices ( |
|
That's a different case which doesn't even involve |
In my case at least, I wouldn't have expected @:structInit initializers to work through @:from types, so I'd be perfectly OK with the compiler just only accepting the forwarded type's option. |
We had a similar problem before and allowed Perhaps not allowing this at all would be better because going through both a |
One thing I've been doing in my codebase is using forwarded abstract types over structInit classes. This enabled some neat trickery, like a vector class that can seamlessly convert between several other vector classes from other libs, as well as inline itself when possible, saving on allocs.
However, I noticed recently that if you @:from against another
@:structInit
type, you somehow lose the ability to initialize with struct syntax.In the demo below, the code will fail to compile unless we remove the
@:structInit
tagging fromBarImpl
Try.haxe: https://try.haxe.org/#cB1428eD
The text was updated successfully, but these errors were encountered: