HaxeFoundation / HaxeFoundation/haxe
[hl] Cannot extend @:structInit class with constructor in subclass
Open
feature-structInit
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
On HL, I am not able to extend a `@:structInit` class if the subclass has a constructor, receiving `Invalid_argument("List.map2")`. See below example, which works in try.haxe.org on JS but not HL.
```haxe
package;
class Main {
static public function main():Void {
// Invalid_argument("List.map2")
var b:B = new B();
trace(b.a);
}
}
@:structInit
class A {
public var a:Int;
}
class B extends A {
public function new() {
a = 1;
}
}
```
Occurs at least on Haxe 4.0.5 through 4.2.5 and 6bcae15, with HL 1.11
Contributor guide
Assessment
This issue has not been assessed yet.