Skip to content

Instantly share code, notes, and snippets.

@boozook
Created January 3, 2016 14:51
Show Gist options
  • Save boozook/7142db7b174097f6b7f0 to your computer and use it in GitHub Desktop.
Save boozook/7142db7b174097f6b7f0 to your computer and use it in GitHub Desktop.
Haxe issue #4763 (compilable)
-main Main
-x main.n
-D dump=pretty
package ;
import haxe.macro.*;
import haxe.macro.Expr;
import haxe.macro.Type;
class Main
{
static var A:String = getConstA();
static var B:String = getConstB();
// Main.hx:9: characters 15-42 : Inline variable initialization must be a constant value
// Main.hx:10: characters 15-42 : Inline variable initialization must be a constant value
// I think this should not happen when macro returns Const value.
static macro function getConstA()
return macro "I'm a Const!";
static macro function getConstB()
return {expr:EConst(CString("I'm a Const too!")), pos:Context.currentPos()};
public static function main(){}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment