HaxeFoundation / HaxeFoundation/haxe
@:structInit ambiguity when @:from between abstract forwarded types
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
Oh god I hope this title makes sense.
This is a followup to #11535, it seems I cut down my repro a bit too much to expose all the fun exciting quirks.
The fix for the previous issue works fine for direct classes, but breaks when pointing through abstracts, as below. The only change from the previous repro is that we're now coming `@:from` the `Bar` abstract instead of `BarImpl` directly.
Tested against haxe nightly 6ab9980d461f9994a6ceb203a3ded05587d2e901
Repro:
```
// Bar
// Removing this @:structInit will fix the build.
@:structInit
class BarImpl {
public function new() {}
}
@:forward
abstract Bar(BarImpl) from BarImpl to BarImpl {
}
// FooImpl
@:structInit
class FooImpl {
public var x:Float;
public function new(x:Float) {
this.x = x;
}
}
// Foo
@:forward
abstract Foo(FooImpl) from FooImpl to FooImpl {
public function new(x:Float) {
this = new FooImpl(x);
}
@:from
static public function fromBar(v:Bar):Foo {
return new Foo(1);
}
}
// Main
class Test {
static function main() {
var v:Foo = {x: 2};
trace(v.x);
}
}
```
try.haxe: https://try.haxe.org/#54AAA5cC
Contributor guide
Assessment
This issue has not been assessed yet.