haxe icon indicating copy to clipboard operation
haxe copied to clipboard

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

Open NotHyper-474 opened this issue 1 month ago • 2 comments

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.

public static function sumFunc()
{
    Dialogs.messageBox('');
}

Reproduced on Haxe 4.3.7 and 5.0.0-preview1, I also made a small project where I replicated the error.

NotHyper-474 avatar Nov 18 '25 00:11 NotHyper-474

I don't really know what to do with this issue because it involves haxeui, which usually means the real problem is hidden behind multiple layers of macro insanity. I am a little curious how we end up with a super expression being typed as a monomorph, but then again who knows what this is actually transformed to before the compiler sees it...

Simn avatar Nov 25 '25 12:11 Simn

Happens because of a recursive dependency (Tooltip extends Box etc. up to Component and ComponentBase (and further) which use TooltipManager which uses Tooltip), and likely because of build macros trying to type some thing in there while the whole tree is building.

Edit: was introduced by this commit (on haxeui-core side)

kLabz avatar Dec 05 '25 09:12 kLabz