Browse Source

[tests] add

closes #10793
Simon Krajewski 2 years ago
parent
commit
674136c79e

+ 25 - 0
tests/misc/projects/Issue10793/Main.hx

@@ -0,0 +1,25 @@
+import haxe.macro.Context;
+import haxe.macro.Expr;
+
+using haxe.macro.Tools;
+
+abstract Foo(Dynamic) from Dynamic to Dynamic {
+	@:op(A.B) function get(prop:String) {
+		return Reflect.field(this, prop);
+	}
+
+	@:op(A.B) macro function set(obj:Expr, prop:Expr, val:Expr) {
+		var s = Context.getTypedExpr(Context.typeExpr(obj)).toString();
+		Sys.stderr().writeString(s);
+		return macro $val;
+	}
+}
+
+class Main {
+	static function main() {
+		var foo:Foo = {
+			n: 5
+		};
+		foo.n += 4;
+	}
+}

+ 3 - 0
tests/misc/projects/Issue10793/compile.hxml

@@ -0,0 +1,3 @@
+--main Main
+--interp
+-D warn-var-shadowing

+ 1 - 0
tests/misc/projects/Issue10793/compile.hxml.stderr

@@ -0,0 +1 @@
+foo