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

dartfmt removes "?" in "()?" typed field #1224

Closed
davidmorgan opened this issue May 17, 2023 · 2 comments · Fixed by #1229
Closed

dartfmt removes "?" in "()?" typed field #1224

davidmorgan opened this issue May 17, 2023 · 2 comments · Fixed by #1229
Labels

Comments

@davidmorgan
Copy link

While adding records support to built_value I thought I'd check the base case, and it doesn't quite work as dartfmt eats the ? in the generated output.

> cat foo.dart
class A {
  ()? x;
}
dartfmt foo.dart
Hit a bug in the formatter when formatting foo.dart.
The formatter produced unexpected output. Input was:
class A {
  ()? x;
}

Which formatted to:
class A {
  () x;
}
@munificent munificent added the bug label May 18, 2023
@munificent
Copy link
Member

Oof, that's bad. I'll take a look.

@tekert
Copy link

tekert commented May 21, 2023

Seem like a token(node.question); is missing when RecordTypeAnnotation fields are empty.

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue May 30, 2023
This includes a single commit which fixes:

dart-lang/dart_style#1224

This doesn't need to be coordinated with a pre-built SDK update.

Change-Id: Ifaabfde1d0d3dc180cf65a1052ba8dcff3324013
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306122
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Jun 6, 2023
Fixes: #52591

Bug: dart-lang/dart_style#1224
Change-Id: I5d87c487e036d69cb5e3ed3289f3b066132a8dea
Cherry-pick: https://dart-review.googlesource.com/c/sdk/+/306122
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306911
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants