Skip to content

Commit

Permalink
[tests] add failing tests for known unbound ttp hxb issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed May 14, 2024
1 parent a13e0ea commit 3109257
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/server/src/cases/ServerTests.hx
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,30 @@ class ServerTests extends TestCase {
assertSuccess();
}

function testHxbUnbound1() {
vfs.putContent("Main.hx", getTemplate("hxb/UnboundLocalFunGeneric.hx"));
var args = ["-main", "Main"];
runHaxe(args);
assertSuccess();
Assert.equals("", lastResult.stderr);
}

function testHxbUnbound2() {
vfs.putContent("Main.hx", getTemplate("hxb/UnboundAbstractUnderlyingAnonField.hx"));
var args = ["-main", "Main"];
runHaxe(args);
assertSuccess();
Assert.equals("", lastResult.stderr);

runHaxe(args);
assertSuccess();
Assert.equals("", lastResult.stderr);

runHaxe(args);
assertSuccess();
Assert.equals("", lastResult.stderr);
}

// See https://github.com/HaxeFoundation/haxe/issues/8368#issuecomment-525379060
#if false
function testXRedefinedFromX() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function main() {}

typedef Foo = {
function get<TField>():Null<TField>;
}

abstract HaxeMemento(Foo) {
public function getInner<TAbstract>():Null<TAbstract> {
return this.get();
}
}
11 changes: 11 additions & 0 deletions tests/server/test/templates/hxb/UnboundLocalFunGeneric.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Main {
static function main() {
function foo<T>(arr:Array<T>) sortDesc(arr);

foo([""]);
foo([42]);
}

@:generic
public inline static function sortDesc<T>(array : Array<T>) {}
}

0 comments on commit 3109257

Please sign in to comment.