HaxeFoundation / HaxeFoundation/haxe

Interface accessor generation problems with overloads

Open
#9,782 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

I have fixed the straightforward case in https://github.com/HaxeFoundation/haxe/commit/72e61e05db6b718fb0f6008b3ae969bfbcf0ede6, but as suspected there are problems with overloads:

```haxe
abstract A(I) {
var x(get, set):Int;

overload function get_x():Int
return this.x;

overload function get_x(i:Int):Int {
return 0;
}

function set_x(v:Int):Int
return 0;
}

interface I {
var x(get, set):Int;
}

function main() {}
```

```
source/Main.hx:5: characters 10-16 : Could not resolve accessor
```

I don't know if any real world Haxe code like this will ever exist, but it still shows that we have problems with typing passes.

The only idea I have right now is to lazily generate interface accessors if we can't find them when resolving field access. We should still keep the current generation mechanism in place to make sure all accessors are ultimately generated.

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.