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

[cs] Conflict between addGlobalMetadata and nativeGen #10920

Closed
acarioni opened this issue Jan 5, 2023 · 2 comments · Fixed by #11551
Closed

[cs] Conflict between addGlobalMetadata and nativeGen #10920

acarioni opened this issue Jan 5, 2023 · 2 comments · Fixed by #11551
Milestone

Comments

@acarioni
Copy link

acarioni commented Jan 5, 2023

When I use the initialization macro addGlobalMetadata("", "@:nativeGen") with haxe 4.3.0-rc.1 and target cs, I get the following errors

~/haxe/versions/779b005/std/cs/_std/Type.hx:33: lines 33-43 : Only flat enums may be @:nativeGen
~/haxe/versions/779b005/std/haxe/CallStack.hx:28: lines 28-34 : Only flat enums may be @:nativeGen
~/haxe/versions/779b005/std/haxe/io/Error.hx:31: lines 31-43 : Only flat enums may be @:nativeGen

If the errors can make sense when @:nativeGen is put by hand on a non-flat enum, I think that when the annotation is put by addGlobalMetadata, the compiler should be more lenient because the user has no way to avoid the error.

@Simn
Copy link
Member

Simn commented Jan 5, 2023

This is not a matter of leniency, you're adding a metadata to everything and some things can't deal with it. The solution is to not add that metadata to everything. In this particular case, it's very likely that @:nativeGen is going to cause other problems anyway. What problem are you trying to solve here?

@acarioni
Copy link
Author

acarioni commented Jan 5, 2023

The problem is that the classes generated by Haxe extend HxObject in order to speed up reflection.
Since in my project I make only a limited use of reflection, I’d like to get rid of HxObject and the overridden methods like __hx_invokeField that pollute every class.
And annotating every class is too awkward, so I want to apply nativeGen automatically.

By the way I tried the targets jvm, python and js, and they don’t raise any errors.

@Simn Simn added this to the Later milestone Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants