Skip to content

Instantly share code, notes, and snippets.

@jasononeil
Created June 24, 2013 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasononeil/5848408 to your computer and use it in GitHub Desktop.
Save jasononeil/5848408 to your computer and use it in GitHub Desktop.
Minimal reproducible test for this error message: /usr/lib/haxe/std/sys/db/Object.hx:29: characters 2-11 : You cannot use @:build inside a macro : make sure that your enum is not used in macro
import haxe.macro.Expr;
import haxe.macro.Context;
import neko.Lib;
class BuildInMacroTests {
public static function main() {
var s:MyModel = new MyModel();
Formatter.__Output_Formatter( s );
}
}
class MyModel extends sys.db.Object
{
var id:Int;
var name:String;
}
private class Formatter {
public static macro function __Output_Formatter(output : Expr) : Expr {
return output;
}
}
@jasononeil
Copy link
Author

Moving "Formatter" do a different .hx file / module solves the issue.

@jasononeil
Copy link
Author

You can also wrap "MyModel" and "BuildInMacroTests" in #if !macro ... #end conditionals which also resolves the issue.

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