HaxeFoundation / HaxeFoundation/haxe
[typer] regression with calling static @:to method statically
Open
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
```haxe
class Main {
static function main() {
Abstract.toInt(0);
}
}
abstract Abstract(Int) from Int {
@:to public static function toInt(a:Abstract):Int {
return cast a;
}
}
```
Introduced by https://github.com/HaxeFoundation/haxe/commit/4f15210171949802a0550cf841c88b5695fa7f4f. This used to compile fine, but now errors with:
```
Main.hx:3: characters 3-17 : Cannot access non-static abstract field statically
```
I guess `@:to`-methods are internally treated as not being static, even if they're declared like that? Note: this [breaks Lime](https://github.com/openfl/lime/blob/5.2.1/lime/ui/ScanCode.hx#L252).
Contributor guide
Assessment
This issue has not been assessed yet.