HaxeFoundation / HaxeFoundation/haxe

The compiler doesn't understand type parameters in @:overload

Open
#5,765 1 comment 0 reactions 1 assignee Claimed by @Simn View on GitHub
feature-overload
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Revision: 0fc630d

``` haxe

var op:Operation = null;
op.run(function(c) c.next()); // Failed with: Operation.T has no field next

typedef Operation = {
@:overload(function(cb:T->Void):Void {})
function run():Void;
}
typedef Cursor = {
function next():Void;
}
```

The above code will fail to compile.

Changing `Operation` to the following will make it go through:

``` haxe
typedef Operation = {
@:overload(function():Void {})
function run(cb:T->Void):Void;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.