Skip to content

Instantly share code, notes, and snippets.

@grapefrukt
Last active August 29, 2015 13:57
Show Gist options
  • Save grapefrukt/9386278 to your computer and use it in GitHub Desktop.
Save grapefrukt/9386278 to your computer and use it in GitHub Desktop.
Compiler bug? "Variable initialization must be a constant value" despite being just that.
class Main {
// this particular setup gives me the error:
// Main.hx:12: characters 22-85 : Variable initialization must be a constant value
// set either GRID_SIZE, CELL_SIZE or OUTLINE_RATIO to anything else and it's fine
public static inline var GRID_SIZE :Int = 20;
public static inline var CELL_SIZE :Int = GRID_SIZE - 2;
public static inline var OUTLINE_RATIO :Float = 1.2;
public static inline var CELL_OUTLINE_W :Int = Std.int(CELL_SIZE * OUTLINE_RATIO);
public static function main() {
// do nothing
}
}
@grapefrukt
Copy link
Author

Aaaand, as I went to the haxe website to report this I saw that 3.1.0 was released and fixed this. (this affected 3.0.0)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment