HaxeFoundation / HaxeFoundation/haxe

Strange `Unknown<0> cannot be called` error after evaluating static functions

Open
#12,407 2 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 a simple macro where you provide classes and it goes over their static functions to create wrapper fields for them.
However I'm running into an odd error that seems completely unrelated.
```
[ERROR] .../hxflx-sample/.haxelib/haxeui-core/git/haxe/ui/tooltips/ToolTip.hx:7: characters 9-16

7 | super();
| ^^^^^^^
| Unknown<0> cannot be called
```

I messed around with the macro and realized this error would only occur when I ran `expr()` on a field or `Context.follow` on that field's type, but strangely this only occurred when the function field executed anything from the class `Dialogs` that comes with the Haxe UI library, just like the one below. Commenting it out will cause the error to disappear.
```haxe
public static function sumFunc()
{
Dialogs.messageBox('');
}
```

Reproduced on Haxe `4.3.7` and `5.0.0-preview1`, I also made a [small project](https://drive.google.com/file/d/1NuAIsxr7zpSGAeBbyj0k4nngZkLixlA4/view?usp=sharing) where I replicated the error.

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction and the macro path that calls expr() or Context.follow on a field type. Compare behavior with and without Dialogs.messageBox in sumFunc(), then inspect the reported super() location in haxe/ui/tooltips/ToolTip.hx. Done means the reproduction no longer reports Unknown<0> cannot be called and the affected macro behavior remains intact.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.