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

Don't drop "?" on nullable empty record types. #1229

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
* Don't split before `.` following a record literal (#1213).
* Don't force split on a line comment before a switch expression case (#1215).
* Require `package:analyzer` `^5.12.0`.
* Preserve `?` on nullable empty record types (#1224).

# 2.3.1

1 change: 1 addition & 0 deletions lib/src/source_visitor.dart
Original file line number Diff line number Diff line change
@@ -2505,6 +2505,7 @@ class SourceVisitor extends ThrowingAstVisitor {
if (node.rightParenthesis.precedingComments != null) soloZeroSplit();

token(node.rightParenthesis);
token(node.question);
return;
}

6 changes: 5 additions & 1 deletion test/whitespace/record_types.unit
Original file line number Diff line number Diff line change
@@ -47,4 +47,8 @@
>>> nullable record type
( int , bool ) ? x;
<<<
(int, bool)? x;
(int, bool)? x;
>>> empty nullable record type
( ) ? x;
<<<
()? x;