Skip to content

Commit 2956b1a

Browse files
authored
Don't drop "?" on nullable empty record types. (#1229)
Fix #1224.
1 parent a36eb20 commit 2956b1a

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Don't split before `.` following a record literal (#1213).
88
* Don't force split on a line comment before a switch expression case (#1215).
99
* Require `package:analyzer` `^5.12.0`.
10+
* Preserve `?` on nullable empty record types (#1224).
1011

1112
# 2.3.1
1213

lib/src/source_visitor.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2505,6 +2505,7 @@ class SourceVisitor extends ThrowingAstVisitor {
25052505
if (node.rightParenthesis.precedingComments != null) soloZeroSplit();
25062506

25072507
token(node.rightParenthesis);
2508+
token(node.question);
25082509
return;
25092510
}
25102511

test/whitespace/record_types.unit

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,8 @@
4747
>>> nullable record type
4848
( int , bool ) ? x;
4949
<<<
50-
(int, bool)? x;
50+
(int, bool)? x;
51+
>>> empty nullable record type
52+
( ) ? x;
53+
<<<
54+
()? x;

0 commit comments

Comments
 (0)