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] ClassTypeBuilder.declareType with mixin crashes the dart analysis server in vscode #55892

Open
littleGnAl opened this issue May 31, 2024 · 0 comments
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-macros Implementation of the macros feature P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@littleGnAl
Copy link

I'm not very sure if it a bug or by design at this time, ClassTypeBuilder.declareType with mixin crashes the dart analysis server in vscode

  @override
  FutureOr<void> buildTypesForClass(ClassDeclaration clazz, ClassTypeBuilder builder) {
    final mixinName = '${clazz.identifier.name}Mixin';

    builder.declareType(
      mixinName,
      DeclarationCode.fromParts([
        // Crash the dart analysis server in vscode
        'mixin $mixinName {}',
      ]),
    );

    builder.appendMixins([RawTypeAnnotationCode.fromString(mixinName)]);
  }

But with mixin class works fine

  @override
  FutureOr<void> buildTypesForClass(ClassDeclaration clazz, ClassTypeBuilder builder) {
    final mixinName = '${clazz.identifier.name}Mixin';

    builder.declareType(
      mixinName,
      DeclarationCode.fromParts([
        // Works fine
        'mixin class $mixinName {}',
      ]),
    );

    builder.appendMixins([RawTypeAnnotationCode.fromString(mixinName)]);
  }
@jakemac53 jakemac53 transferred this issue from dart-lang/language May 31, 2024
@jakemac53 jakemac53 added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-macros Implementation of the macros feature type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P2 A bug or feature request we're likely to work on labels May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. feature-macros Implementation of the macros feature P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
Development

No branches or pull requests

2 participants