HaxeFoundation / HaxeFoundation/haxe
[eval] enum abstract with @:native
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
Compiling the following test with `haxe --run Test` fails with the error:
`Field index for fromString not found on prototype MyType`
```haxe
class Test {
static function main()
{
var myType = MyType.ONE;
trace(myType);
myType = "two";
trace(myType);
}
}
@:native("MyType")
enum abstract MyType(String) to String {
public var ONE = "one";
public var TWO = "two";
@:from static public function fromString(str:String):MyType {
return cast str;
}
}
```
Removing `@:native` or renaming the value inside it seems to fix it.
Tested and working at least on js. neko, java, cpp, hl.
haxe 4 preview 5 (latest from git)
Contributor guide
Assessment
This issue has not been assessed yet.