@@ -39,7 +39,7 @@ class MacroStringTools {
The returned expression is a concatenation of string parts and escaped
elements.
**/
- static public function formatString(s:String, pos:Position) {
+ static public function formatString(s:String, pos:Position):Expr {
#if (neko || eval)
return Context.load("format_string", 2)(s, pos);
#end
@@ -0,0 +1,19 @@
+package unit.issues;
+#if !macro
+class Issue9928 extends unit.Test {
+ function test() {
+ var w = Std.random(10);
+ eq('hello $w', format('hello $w'));
+ }
+
+ macro static function format(s:String):haxe.macro.Expr;
+}
+#else
+ macro static function format(s:String):haxe.macro.Expr {
+ var p = haxe.macro.Context.currentPos();
+ var ed:{expr:haxe.macro.Expr.ExprDef} = haxe.macro.MacroStringTools.formatString(s, p);
+ return haxe.macro.MacroStringTools.formatString(s, p);
+#end