HaxeFoundation / HaxeFoundation/haxe

abstract implicit cast prevents finding explicit one

Open
#10,187 5 comments 1 reaction 0 assignees View on GitHub
bug feature-abstracts
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
class Test {
static function main() {
var f:Foo = [new Baz(), new Baz()]; // Does not work.
var f:Foo = Foo.fromArr([new Baz(), new Baz()]); // Works.
}
}

// Commenting out `from ...` makes the issue go away.
abstract Foo(Array<{b:Bar}>) from Array<{b:Bar}> {
@:from public static inline function fromArr(arr:Array>)
return cast [for (b in arr) {b: b}];
}

class Bar {
public var a:T;
public function new() {}
}
class Baz extends Bar<{a:Int, b:Int}> {}
```
Seems to reproduce on all versions. Possibly related to #9169 and #9881.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.