Skip to content

flutter builds / reloads / restarts fail when using a macro's builder.report() regardless of severity #56364

Open
@Lootwig

Description

@Lootwig

Not sure if this is the analyzer declaring any "Diagnostic"s an error, or flutter being too strict in processing the output, this shows up when trying to build a project with a macro reporting anything:

lib/test.dart: Error: Success!
class X {}
      ^
@SomeMacro()
class X {}

macro class SomeMacro implements ClassDeclarationsMacro {
  const SomeMacro();

  @override
  Future<void> buildDeclarationsForClass(
      ClassDeclaration clazz,
      MemberDeclarationBuilder builder,
      ) async {
    builder.report(
      Diagnostic(
        DiagnosticMessage(
          'Success!',
          target: DeclarationDiagnosticTarget(clazz),
        ),
        Severity.info,
      ),
    );
  }
}
flutter doctor

Flutter version 3.24.0-1.0.pre.403 on channel [user-branch]
• Upstream repository https://github.com/luminateenterprises/flutter.git
• Framework revision fa9b991b0d (3 months ago), 2024-04-25 17:23:02 +0200
• Engine revision 230879c793
• Dart version 3.6.0 (build 3.6.0-105.0.dev)
• DevTools version 2.37.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    cfe-feature-macrosImplement macros features in the CFElegacy-area-front-endLegacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions