Skip to content

Commit

Permalink
[tests] Add type hole test for 10653
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Feb 22, 2024
1 parent c5a6ddc commit 8f3ae6a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/server/src/cases/issues/Issue10653.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package cases.issues;

import haxe.display.Diagnostic;

class Issue10653 extends TestCase {
function test(_) {
vfs.putContent("Test.hx", getTemplate("issues/Issue10653/Test.hx"));
Expand All @@ -16,4 +18,24 @@ class Issue10653 extends TestCase {
Assert.equals(0, res.length);
});
}

function testTypeHole(_) {
vfs.putContent("Test.hx", getTemplate("issues/Issue10653/Test.hx"));
vfs.putContent("Main.hx", getTemplate("issues/Issue10653/MainBefore.hx"));
var args = ["-main", "Main", "--js", "no.js", "--no-output"];
runHaxe(args);
vfs.putContent("Main.hx", getTemplate("issues/Issue10653/MainAfterWrong.hx"));
runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Main.hx")});
runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Main.hx")}, res -> {
Assert.equals(1, res.length);
var arg:MissingFieldDiagnostics = cast res[0].diagnostics[0].args;
Assert.equals("foo", arg.entries[0].fields[0].field.name);
});
runHaxeJson([], ServerMethods.Invalidate, {file: new FsPath("Main.hx")});
runHaxeJsonCb(args, DisplayMethods.Diagnostics, {file: new FsPath("Main.hx")}, res -> {
Assert.equals(1, res.length);
var arg:MissingFieldDiagnostics = cast res[0].diagnostics[0].args;
Assert.equals("foo", arg.entries[0].fields[0].field.name);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Main {
static function main() {
var x = Test.test();
x = new Main();
x.foo = "wtf";
}

function new() {}
}

0 comments on commit 8f3ae6a

Please sign in to comment.