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

Static macro methods on @:generic classes #4804

Closed
fussybeaver opened this issue Jan 21, 2016 · 1 comment
Closed

Static macro methods on @:generic classes #4804

fussybeaver opened this issue Jan 21, 2016 · 1 comment
Assignees
Milestone

Comments

@fussybeaver
Copy link

This is a regression from a previous fix: #3766

Example:

@:generic
class Main<T> {
    static function main() {
        new Main<String>();
    }

    function new() { }

    macro static function test() {
        return macro null;
    }
}

This fails to compile with the error "A generic class can't have static fields"

Macro static methods are an exception, and are allowed in a generic class https://github.com/HaxeFoundation/haxe/blob/3.2.1/codegen.ml#L418

@Simn Simn modified the milestone: 3.3.0-rc1 Feb 23, 2016
@Simn Simn self-assigned this Apr 2, 2016
@Simn
Copy link
Member

Simn commented Apr 2, 2016

This one confused me, but there's no regression here:

  1. Your example is invalid because you do in fact have the static function main on your @:generic class.
  2. You have to #if !macro your macro function, the error you're getting actually occurs in macro context because there the macro is not really considered a macro (don't ask).

@Simn Simn closed this as completed Apr 2, 2016
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