Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning : Extern non-inline function may not have an expression #179

Open
fullofcaffeine opened this issue May 23, 2019 · 12 comments

Comments

@fullofcaffeine
Copy link

commented May 23, 2019

Getting the following warnings when compiling with Haxe 4 RC2:

/home/fullofcaffeine/haxe/haxe_libraries/js-kit/0.0.3/git/f5c1e23e0ef5c5b04288d03f8fa3af746a70c9d3/js/npm/express/Middleware.hx:25: characters 2-8 : Warning : Extern non-inline function may not have an expression
/home/fullofcaffeine/haxe/haxe_libraries/js-kit/0.0.3/git/f5c1e23e0ef5c5b04288d03f8fa3af746a70c9d3/js/npm/express/Middleware.hx:26: characters 2-7 : Warning : Extern non-inline function may not have an expression
/home/fullofcaffeine/haxe/haxe_libraries/js-kit/0.0.3/git/f5c1e23e0ef5c5b04288d03f8fa3af746a70c9d3/js/npm/express/Middleware.hx:27: characters 2-8 : Warning : Extern non-inline function may not have an expression
/home/fullofcaffeine/haxe/haxe_libraries/js-kit/0.0.3/git/f5c1e23e0ef5c5b04288d03f8fa3af746a70c9d3/js/npm/express/Middleware.hx:28: characters 2-10 : Warning : Extern non-inline function may not have an expression
/home/fullofcaffeine/haxe/haxe_libraries/js-kit/0.0.3/git/f5c1e23e0ef5c5b04288d03f8fa3af746a70c9d3/js/npm/express/Middleware.hx:29: characters 2-11 : Warning : Extern non-inline function may not have an expression
... and a lot more

Full list of errors have been pasted here: https://www.pastiebin.com/5ce653c96e3bd

Any ideas what this is about and how to fix them? If not, I'd be happy if I just could suppress these warnings, is that possible?

@clemos

This comment has been minimized.

Copy link
Owner

commented May 23, 2019

Mh all I know is these lines are generated with this macro:
https://github.com/clemos/haxe-js-kit/blob/develop/util/CopyMethods.hx#L31
I guess fun.expr should be nulled somewhere

@varadig

This comment has been minimized.

Copy link

commented Jul 11, 2019

I try to compile with Haxe 4 RC3, and also got this warnings.
But I also use mongoose and I got error too

/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/support/Error.hx:5: characters 6-14 : Warning : This typedef is deprecated in favor of js.lib.Error
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/support/Error.hx:5: characters 18-26 : Warning : This typedef is deprecated in favor of js.lib.Error
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/npm/Package.hx:74: lines 74-80 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:59: characters 2-7 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:60: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:61: characters 2-7 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:62: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:63: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:64: characters 2-11 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:65: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:66: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:67: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:68: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:69: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:70: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:71: characters 2-12 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:72: characters 2-13 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:73: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:74: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:75: characters 2-14 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:76: characters 2-12 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:77: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:79: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:80: characters 2-13 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:81: characters 2-15 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:82: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:83: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:84: characters 2-11 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:85: characters 2-7 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:22: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:23: characters 2-7 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:24: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:25: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:26: characters 2-11 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:27: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:28: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:29: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:30: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:31: characters 2-8 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:32: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:33: characters 2-12 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:34: characters 2-13 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:35: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:36: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:37: characters 2-14 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:38: characters 2-12 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:39: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:41: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:42: characters 2-13 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:43: characters 2-15 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:44: characters 2-9 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:45: characters 2-10 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:46: characters 2-11 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/js/npm/express/Middleware.hx:47: characters 2-7 : Warning : Extern non-inline function may not have an expression
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/util/Mongoose.hx:327: characters 30-36 : error: { field : String, expr : haxe.macro.Expr } has no field quotes
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/util/Mongoose.hx:327: characters 30-36 :  have: Array<{ field, expr }>
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/util/Mongoose.hx:327: characters 30-36 :  want: Array<haxe.macro.ObjectField>
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/util/Mongoose.hx:327: characters 30-36 : For function argument 'fields'
src/model/database/model/User.hx:34: character 1 : Build failure
@varadig

This comment has been minimized.

Copy link

commented Jul 11, 2019

with 3.4.7 works fine:

{
"version": "3.4.7",
"resolveLibs": "scoped"
}

@fullofcaffeine

This comment has been minimized.

Copy link
Author

commented Jul 31, 2019

Does anyone know how to suppress / fix those warnings? It's beyond annoying for me at this point :(

@varadig

This comment has been minimized.

Copy link

commented Jul 31, 2019

And there is not just a warning, but error too. So can’t use js-kit of mongoose with haxe 4 :(

@fullofcaffeine

This comment has been minimized.

Copy link
Author

commented Jul 31, 2019

@varadig What error are you experiencing when using the mongoose externs? So far, js-kit has worked relatively well with Haxe 4 for me, but I have only used the Express externs.

@varadig

This comment has been minimized.

Copy link

commented Aug 1, 2019

@fullofcaffeine , yes I have compile error

/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/util/Mongoose.hx:327: characters 30-36 :  have: Array<{ field, expr }>
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/util/Mongoose.hx:327: characters 30-36 :  want: Array<haxe.macro.ObjectField>
/Users/varadig/haxe/haxe_libraries/js-kit/0.0.3/github/d9615f45a332fca9ac868093fca96da5077a1e93/util/Mongoose.hx:327: characters 30-36 : For function argument 'fields'
src/model/database/model/User.hx:34: character 1 : Build failure

So I can't compile my project if I use haxe 4.x

@fullofcaffeine

This comment has been minimized.

Copy link
Author

commented Aug 4, 2019

Mh all I know is these lines are generated with this macro:
https://github.com/clemos/haxe-js-kit/blob/develop/util/CopyMethods.hx#L31
I guess fun.expr should be nulled somewhere

@clemos I've tried nullifying func.expr but Haxe won't compile if so, it complains that "Function must have a body". If I enable AInline for all fields, it seems to misgenerate the functions (don't ask me how as I don't know) so that calling any of the middleware aliases (i.e .post, get ...) for example, will always generate a ['m-search'].

Check my message here for more details: https://community.haxe.org/t/weird-warning-with-extern-classes/1511/5?u=fullofcaffeine.

@clemos

This comment has been minimized.

Copy link
Owner

commented Aug 4, 2019

You may want to try to just add expr: null as part of var f = { ... } initial assignment.
The rest of the code should correctly overwrite expr and access if needed (ie if the method needs to be renamed)

@fullofcaffeine

This comment has been minimized.

Copy link
Author

commented Aug 4, 2019

@fullofcaffeine

This comment has been minimized.

Copy link
Author

commented Aug 5, 2019

@clemos I've added expr: null as you suggested, here (CopyMethods.hx):

jskit

But then I get the following errors:

haxe build-server.hxml                                            [2.5.0]
src/hx/server/externs/util/CopyMethods.hx:75: characters 20-21 : { pos : haxe.macro.Position, name : String, meta : Array<{ pos : haxe.macro.Position, params : Array<haxe.macro.Expr>, name : String }>, kind : haxe.macro.FieldType, expr : Unknown<0>, access : Array<haxe.macro.Access> } should be haxe.macro.Field
src/hx/server/externs/util/CopyMethods.hx:75: characters 20-21 : { pos : haxe.macro.Position, name : String, meta : Array<{ pos : haxe.macro.Position, params : Array<haxe.macro.Expr>, name : String }>, kind : hax... has extra field expr
src/hx/server/externs/util/CopyMethods.hx:75: characters 20-21 : For function argument 'x'
src/hx/server/externs/express/Middleware.hx:68: characters 1-8 : Build failure

Using Haxe 4RC3. The version of js-kit is git HEAD, although I copied only the express externs (and related types) over to my app in order to make it easier to modify locally.

Any hints?

@clemos

This comment has been minimized.

Copy link
Owner

commented Aug 5, 2019

You're right. You may try

if ( method != verb ) {
   ...
} else {
    fun.expr = null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.