haxe
haxe copied to clipboard
`Sys.programPath()` fails on Interp target: `[0] Instance prototype not found: haxe.macro.Error`
Haxe v4.2.5
Main.hx:
function main()
trace(Sys.programPath());
haxe --run Main
Results in:
[0] Instance prototype not found: haxe.macro.Error
I'm getting the same result on both Mac (M1) and Linux (amd64).
This is quite funny, apparently it tries to report the Main class, but doesn't find one because there isn't one. The actual error is Module Main does not define type Main. So there are two problems here:
- It has to account for module-level main
- It should not fail while trying to locate
haxe.macro.Error
Indeed. I've wrapped this code in a class and now it works!
class Main {
public static function main()
trace(Sys.programPath());
}