haxe
haxe copied to clipboard
`-D no-inline` breaks inline variables
When used with switches (possibly other places), inline variables are not always treated as constants when -D no-inline is used. I would not expect this flag to impact whether code compiles or not. I also wouldn't expect the flag to do anything at all to inline variables IMO.
final class Main {
static inline final A = 1;
static inline final B = 1 << 1; // allowed with -D no-inine, but breaks in the switch statement
static inline final C = A | B;
static function main() {
switch 5 {
case A:
case B: // Unknown identifier : B, pattern variables must be lower-case or with `var ` prefix
case C: // Unknown identifier : C, pattern variables must be lower-case or with `var ` prefix
default:
}
}
}
Also, it would be nice to be able to pass compiler flags into try haxe - similar to a site like godbolt.
Yeah, -D no-inline is a bit annoying to deal with because there are various places where we need to rely on inlining even if we don't want to inline generally. Identifying those is a little error-prone.
No worries. This is not really affecting me. It's just something I noticed when trying to workaround the inline constructor issue.