Skip to content

[Records] CFE rejects record constants with multiple named fields #49915

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

Closed
alexmarkov opened this issue Sep 7, 2022 · 0 comments
Closed

[Records] CFE rejects record constants with multiple named fields #49915

alexmarkov opened this issue Sep 7, 2022 · 0 comments
Assignees
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.

Comments

@alexmarkov
Copy link
Contributor

Part of #49713.

Example:

void main() {
  print(const (foo: 1, bar: 2));
}

CFE issues the following errors:

foo.dart:2:21: Error: Constant evaluation error:
  print(const (foo: 1, bar: 2));
                    ^
foo.dart:2:21: Context: The variable '(unnamed)' is not a constant, only constant expressions are allowed.
  print(const (foo: 1, bar: 2));
                    ^

The following constants work fine:

  print(const (1, 2));
  print(const (foo: 1));

/cc @johnniwinther

@alexmarkov alexmarkov added the legacy-area-front-end Legacy: Use area-dart-model instead. label Sep 7, 2022
@johnniwinther johnniwinther self-assigned this Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-front-end Legacy: Use area-dart-model instead.
Projects
None yet
Development

No branches or pull requests

2 participants