浏览代码

[tests] add failing test demonstrating the issue

Rudy Ges 1 年之前
父节点
当前提交
57c39a0b7e

+ 6 - 0
tests/misc/projects/Issue11740/Baz.hx

@@ -0,0 +1,6 @@
+import foo.Foo;
+
+class Baz {
+	function baz(data:foo.FooData) {}
+}
+

+ 17 - 0
tests/misc/projects/Issue11740/Macro.macro.hx

@@ -0,0 +1,17 @@
+import haxe.macro.Context;
+
+class Macro {
+	public static function build() {
+		trace("build FooData");
+
+		Context.defineType({
+			pos : Context.currentPos(),
+			name : "FooData",
+			pack : ["foo"],
+			kind : TDClass(),
+			fields : [],
+		});
+
+		return null;
+	}
+}

+ 5 - 0
tests/misc/projects/Issue11740/Main.hx

@@ -0,0 +1,5 @@
+import foo.Foo;
+
+function main() {
+	trace(Baz);
+}

+ 2 - 0
tests/misc/projects/Issue11740/compile1.hxml

@@ -0,0 +1,2 @@
+-main Main
+--interp

+ 2 - 0
tests/misc/projects/Issue11740/compile1.hxml.stdout

@@ -0,0 +1,2 @@
+Macro.macro.hx:5: build FooData
+Main.hx:4: Class<Baz>

+ 3 - 0
tests/misc/projects/Issue11740/compile2.hxml

@@ -0,0 +1,3 @@
+-main Main
+Baz
+--interp

+ 4 - 0
tests/misc/projects/Issue11740/foo/Foo.hx

@@ -0,0 +1,4 @@
+package foo;
+
+@:build(Macro.build())
+class Foo {}