HaxeFoundation / HaxeFoundation/haxe

`@:generic` leaks type parameters

Open
#4,599 6 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

The following code:

``` haxe
class Main {
static function main() {
Test2.somethingElse(10);
}
}

class Test {
@:generic public static function something(t:T) {
return t;
}
}

@:forward
abstract Test2(Test) {
@:extern inline public static function somethingElse(t:T) {
return Test.something(t);
}
}
```

Will generate the following `-D dump` for `Test.something`:

```
static public something_somethingElse_T(method) : t : somethingElse.T -> somethingElse.T

= function(t:somethingElse.T) = {
var tmp = t;
return tmp;
}
```

That `somethingElse.T` comes from the abstract type

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.