HaxeFoundation / HaxeFoundation/haxe
Regression with generic method overloads
- Dominant language
- Haxe
- Stars
- 6.9k
- Forks
- 715
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 11
Description
The following example [compiles and runs perfectly fine](https://try.haxe.org/#0ecF1abB) on versions from 4.2.0 to 4.3.6:
```haxe
class Test {
static extern inline overload function foo>(src:S):Int {
return src.iterator().next() + 1;
}
static extern inline overload function foo>(src:S):String {
return src.iterator().next() + "!";
}
static function main() {
trace(foo([12, 34, 56]));
trace(foo(["hello", "world"]));
}
}
```
However, on the development branch, the compilation fails:
```
[ERROR] Test.hx:3: lines 3-5
3 | static extern inline overload function foo>(src:S):Int {
4 | return src.iterator().next() + 1;
5 | }
|
| Another overloaded field of same signature was already declared : foo
7 | static extern inline overload function foo>(src:S):String {
8 | return src.iterator().next() + "!";
9 | }
|
| The second field is declared here
```
Contributor guide
Research direction
Start by reproducing the provided Test.hx example on the development branch and compare it with versions 4.2.0 through 4.3.6. Investigate generic method overload handling in the compiler; done means both overloads compile and the example produces the expected results without the duplicate-signature error.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100