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

Uninitialized Final Field Ignored When Using Macro in Haxe Compiler #12023

Open
NipponSunrise opened this issue Feb 21, 2025 · 0 comments
Open

Comments

@NipponSunrise
Copy link

Description

When defining a final variable in an interface, implementing it in an abstract class, and inheriting that abstract class in another class, we are expected to initialize the final variable either in the abstract class or the derived class. Otherwise, the compiler correctly throws an error:

Some final fields are uninitialized in this class

However, when using a macro that adds a new variable to the abstract class and invoking it via @:autoBuild(Macro.build()), the compiler fails to enforce initialization for the final variable defined in the interface. This results in an uninitialized final variable being accepted, which contradicts expected behavior.

Steps to Reproduce

Reproduction Example in Haxe Sandbox

Expected Behavior

The compiler should enforce initialization of the final variable defined in the interface, regardless of the applied macro.

Actual Behavior

When the macro is applied, the compiler does not report an error for an uninitialized final variable.

Environment

Haxe Compiler Version: 4.3.6
Target Platform: JavaScript (others are not tested)

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

No branches or pull requests

1 participant