COMMUNITY

Weird warning with extern classes

extern class Name
{
    public static var variable : Float;
}

Gives me the warning: “Extern non-inline function may not have an expression”
This used to work fine in older Haxe versions (using 4 preview 4).

Anyone recognizes this?

That code by itself doesn’t cause such an error. Are there any build macros or something running?

Quite a long time ago I posted this, but it indeed turned out I was generating a constructor for extern classes. Quick check fixed the issue. Thanks @Simn

I have a project using js-kit (https://github.com/clemos/haxe-js-kit) with this quirk. Currently compiling with Haxe 4.0.0-rc.1. Everything functions fine, but having a long list of warnings pop up is a little disconcerting. Is there a way to suppress the warning for a specific library or file with a compiler flag?

The exact warning is:

D:\HaxeToolkit\haxe\lib\js-kit/git/js/npm/express/Middleware.hx:22: characters 2-8 : Warning : Extern non-inline function may not have an expression

I’m also experiencing this. It pollutes the output of my build script and prevents me from seeing the output that matters.

I’ve tried to fix the issue with no avail. Check the ticket here and discussion here: :point_up: August 2, 2019 11:36 PM as reference.

Also, there’s a related discussion (to js-kit and Haxe js externs in general) here. Your input is welcome.

Lastly, It’d be nice also if Haxe had a way to suppress all warnings. If the Haxe gods are hearing me, please add that option!