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

Macros: Declaring a constructor on a generic class with an implements breaks generation #55762

Open
rrousselGit opened this issue May 17, 2024 · 1 comment
Labels
area-fe-analyzer-shared Assigned by engineers; when triaging, prefer either area-front-end or area-analyzer. cfe-feature-augmentation Implement augmentation features in the CFE cfe-feature-macros Implement macros features in the CFE feature-macros Implementation of the macros feature

Comments

@rrousselGit
Copy link

rrousselGit commented May 17, 2024

Consider:

macro class Example implements ClassDeclarationsMacro {
  const Example();

  @override
  FutureOr<void> buildDeclarationsForClass(
    ClassDeclaration clazz,
    MemberDeclarationBuilder builder,
  ) async {
    builder.declareInType(DeclarationCode.fromParts([
      'SimpleA();',
    ]);
  }
}

Then used as:

class Simple {}

@Example()
class SimpleA<T> implements Simple {}

The code-generation appears to fail in this case.

Removing <T> or the implements fixes the issue

@rrousselGit rrousselGit changed the title Macros: Declaring a constructor on a generic sealed class breaks generation Macros: Declaring a constructor on a generic class with an implements breaks generation May 17, 2024
@lrhn lrhn added feature-macros Implementation of the macros feature area-fe-analyzer-shared Assigned by engineers; when triaging, prefer either area-front-end or area-analyzer. labels May 19, 2024
@johnniwinther johnniwinther added cfe-feature-macros Implement macros features in the CFE cfe-feature-augmentation Implement augmentation features in the CFE labels May 23, 2024
@davidmorgan
Copy link
Contributor

Thanks! This will need fixing but it's not high priority right now, so moving to the backlog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-fe-analyzer-shared Assigned by engineers; when triaging, prefer either area-front-end or area-analyzer. cfe-feature-augmentation Implement augmentation features in the CFE cfe-feature-macros Implement macros features in the CFE feature-macros Implementation of the macros feature
Projects
None yet
Development

No branches or pull requests

4 participants