File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -553,10 +553,12 @@ extension Parser {
553
553
554
554
// Check for a .foo suffix.
555
555
if self . at ( any: [ . period, . prefixPeriod] ) {
556
- // A key path is special, because it allows .[, unlike anywhere else. The
557
- // period itself should be left in the token stream. (.? and .! end up
558
- // being operators, and so aren't handled here.)
559
- if periodHasKeyPathBehavior && self . peek ( ) . tokenKind == . leftSquareBracket {
556
+ // A key path is special, because it allows .[ and .<N>, unlike
557
+ // anywhere else. The period itself should be left in the token stream.
558
+ // (.? and .! end up being operators, and so aren't handled here.)
559
+ if periodHasKeyPathBehavior &&
560
+ ( self . peek ( ) . tokenKind == . leftSquareBracket ||
561
+ self . peek ( ) . tokenKind == . integerLiteral) {
560
562
break
561
563
}
562
564
Original file line number Diff line number Diff line change @@ -111,6 +111,12 @@ final class ExpressionTests: XCTestCase {
111
111
#"""
112
112
_ = \Lens<[Int]>.[0]
113
113
"""# )
114
+
115
+ AssertParse (
116
+ #"""
117
+ \(UnsafeRawPointer?, String).1
118
+ """#
119
+ )
114
120
}
115
121
116
122
func testBasicLiterals( ) {
You can’t perform that action at this time.
0 commit comments