Skip to content

Commit

Permalink
Don't drop "?" on nullable empty record types. (#1229)
Browse files Browse the repository at this point in the history
Fix #1224.
  • Loading branch information
munificent authored May 25, 2023
1 parent a36eb20 commit 2956b1a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

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

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

0 comments on commit 2956b1a

Please sign in to comment.