Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[hxb] Unbound type parameter issues #11628

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>) {}
}
Loading