HaxeFoundation / HaxeFoundation/haxe
optimizer fails when using structural subtyping
Open
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
function main() {
var w = new World();
var wrapper = new Wrapper(w);
wrapper.use();
}
class World {
public function new() {}
}
abstract Wrapper({w:{}}) {
public inline function new(w:{}) this = {w: w}; // This doesn't optimize.
// public inline function new(w:T) this = {w: w}; // These do.
// public inline function new(w:{}) this = {w: cast w};
public inline function use() trace(this.w);
}
```
This generates `({ w : new World()}).w`. The commented-out `new` variants generate just `new World()`.
Contributor guide
Assessment
This issue has not been assessed yet.