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

@:generic ignores @:unreflective #1102

Open
acarioni opened this issue Apr 23, 2024 · 5 comments
Open

@:generic ignores @:unreflective #1102

acarioni opened this issue Apr 23, 2024 · 5 comments

Comments

@acarioni
Copy link
Contributor

When a Haxe class is annotated with both @:generic and @:unreflective, the corresponding C++ class still retains the reflection machinery.

For example, compiling the following code with these annotations generates a class named MyClass_Int.cpp, which contains declarations such as HX_DEFINE_DYNAMIC_FUNC0(MyClass_Int_obj, get, return).

I am using Haxe 4.3.4 (but Haxe 4.3.3 exhibits the same behaviour).

@:generic
@:unreflective
class MyClass<T> {
  var _v: T;
  public function new(v: T) _v = v;
  public function get() return _v;
}

class Main {
  static function main() {
    trace(new MyClass(1).get());
  }
}
Simn added a commit to HaxeFoundation/haxe that referenced this issue Apr 23, 2024
@Simn
Copy link
Member

Simn commented Apr 23, 2024

Fixed by the linked commit, but I don't know how to test this robustly.

@acarioni
Copy link
Contributor Author

Thanks. I'll try the nightly build.

@acarioni
Copy link
Contributor Author

The patch seems to work.

@acarioni
Copy link
Contributor Author

Is it possible to backport the patch on branch 4.3.x?

@Simn
Copy link
Member

Simn commented Apr 24, 2024

Yeah @kLabz

kLabz pushed a commit to HaxeFoundation/haxe that referenced this issue Jun 28, 2024
kLabz pushed a commit to HaxeFoundation/haxe that referenced this issue Jul 18, 2024
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

2 participants