HaxeFoundation / HaxeFoundation/haxe

"Uncaught TypeError: itf.GenericRetval is not a function" when calling a generic function via interface

Open
#10,542 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

```
interface IBar {
function GenericRetval Void>>():T;
}

class Test {
static function main() {
var itf:IBar = new Bar();
var fails:Foo = itf.GenericRetval(); // Uncaught TypeError: itf.GenericRetval is not a function,
trace('fails = ${fails.number}');
}
}

```
Doing the exact same thing via var obj : Bar = new Bar() works as expected.
Full test case can be found in [Test.zip](https://github.com/HaxeFoundation/haxe/files/7820508/Test.zip) and at https://try.haxe.org/#1d3F0529

**Remark:** Possibly related to JS target, I only tested this one (and spent about an hour on it) but I'm not 100% sure either.

Contributor guide

Open the contributing guide

Research direction

Start with the attached Test.zip or the try.haxe.org reproduction and confirm the failure when the generic function is called through IBar on the JavaScript target. Trace the compiler's interface and generic-function handling; done means the interface call works without the TypeError while the existing direct Bar call remains working.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.