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

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

Open
LacticWhale opened this issue Dec 19, 2024 · 1 comment
Open

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

LacticWhale opened this issue Dec 19, 2024 · 1 comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-question A question about expected behavior or functionality

Comments

@LacticWhale
Copy link

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?

@dart-github-bot
Copy link
Collaborator

Summary: Users report inability to pass enum instances as arguments to macro constructors. They ask if this functionality will be supported in the future.

@dart-github-bot dart-github-bot added area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-question A question about expected behavior or functionality labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). triage-automation See https://github.com/dart-lang/ecosystem/tree/main/pkgs/sdk_triage_bot. type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

2 participants