RblSb 2 mesi fa
parent
commit
be188c882a

+ 32 - 0
tests/server/src/cases/issues/Issue11311.hx

@@ -0,0 +1,32 @@
+package cases.issues;
+
+import utest.Assert;
+
+class Issue11311 extends TestCase {
+	function test(_) {
+		vfs.putContent("Main.hx", getTemplate("issues/Issue11311/Main.hx"));
+		var args = [
+			"-main",
+			"Main",
+			"--js",
+			"test.js",
+			"-D",
+			"dce=full",
+			"-D",
+			"analyzer-optimize",
+			"--cmd",
+			"node test.js"
+		];
+
+		runHaxe(args);
+		assertSuccess();
+
+		vfs.putContent("Main.hx", getTemplate("issues/Issue11311/Main.hx").replace("// ", ""));
+		runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Main.hx")});
+		runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Main.hx")}, res -> {});
+
+		runHaxe(args);
+		assertSuccess();
+		Assert.isTrue(vfs.getContent("test.js").contains("iterator: function() {"));
+	}
+}

+ 13 - 0
tests/server/test/templates/issues/Issue11311/Main.hx

@@ -0,0 +1,13 @@
+using Lambda;
+
+abstract KeyMap(Map<Int, Bool>) {}
+
+class Main {
+	static function main() {
+		log("Hello, world!");
+		// log([0 => 0].empty());
+	}
+}
+
+@:pure(false)
+function log(v:Any):Void {}