HaxeFoundation / HaxeFoundation/haxe

Possible transitive cast prevents direct implicit cast

Open
#9,169 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```haxe
class Main {
public static var views:IReadOnlyList;

static function main() {
views = [new Child()];
}
}

abstract IReadOnlyList(Array) from Array to Array {
// This method breaks compilation
// @:from static inline function fromList(list:List):IReadOnlyList {
// return cast list;
// }

public function new() {
this = [];
}
}

abstract List(Array) from Array to Array {
public inline function new() {
this = [];
}
}

class Base {
public function new() { }
}

class Child extends Base {
public function new() {super(); }
}
```
Uncommenting `@:from fromList` method breaks compilation:
```
Main.hx:5: characters 9-30 : Array should be IReadOnlyList
```

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.