Skip to content

[Macro] Unable to use enum instance in macro constructor. #59765

@LacticWhale

Description

@LacticWhale

Example:

enum A {
  a,
  b,
  c;
}
  
class B {
  @CMacro<A>(A.c)
          // ^ Not supported: PrefixedIdentifierImpldart(macro_application_argument_error)
  static final key = 'object.location';
}
macro class CMacro<T> implements FieldDeclarationsMacro {
  const CMacro(this.value);

  final T value;

  @override
  FutureOr<void> buildDeclarationsForField(FieldDeclaration field, MemberDeclarationBuilder builder) {

  }
}

I don't know if it works as intended but I coudn't find any information.
So this issue more like a question: is this gonna be supported later?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).feature-macrosImplementation of the macros featurepkg-macrosThe experimental package:_macros librarytype-questionA question about expected behavior or functionality

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions