haxe icon indicating copy to clipboard operation
haxe copied to clipboard

Nightly Haxe/Hxcpp - Invalid constant when setting an abstract function param to a enum abstract value.

Open Jarrio opened this issue 3 months ago • 1 comments

abstract class Foo {
	abstract public function getData(type:Items = Sword):Void;
}

enum abstract Items(String) {
	var Sword;
}

This code is considered fine on all targets besides hxcpp where we get the following error

[ERROR] src/Main.hx:8: characters 48-53
 8 |  abstract public function getData(type:Items = Sword):Void;
   |                                                ^^^^^
   | Invalid constant :  Sword

Error does not occur on haxe 4.3.7, on nightly haxe(5.0.0-preview.1+90a2a3c) js/neko/hl/eval all compile fine (https://try.haxe.org/#bf87b284)

Jarrio avatar Sep 18 '25 22:09 Jarrio

I wonder if it could be somehow related to #11666?

tobil4sk avatar Sep 19 '25 08:09 tobil4sk