File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -594,7 +594,12 @@ extension Parser {
594
594
// Check for a [expr] suffix.
595
595
// Note that this cannot be the start of a new line.
596
596
if let lsquare = self . consume ( if: . leftSquareBracket, where: { !$0. isAtStartOfLine } ) {
597
- let args = self . parseArgumentListElements ( inLetOrVar: inLetOrVar)
597
+ let args : [ RawTupleExprElementSyntax ]
598
+ if self . at ( . rightSquareBracket) {
599
+ args = [ ]
600
+ } else {
601
+ args = self . parseArgumentListElements ( inLetOrVar: inLetOrVar)
602
+ }
598
603
let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquareBracket)
599
604
600
605
// If we can parse trailing closures, do so.
Original file line number Diff line number Diff line change @@ -431,7 +431,13 @@ final class ExpressionTests: XCTestCase {
431
431
)
432
432
}
433
433
434
- func testRangeSubscript( ) {
434
+ func testSubscript( ) {
435
+ AssertParse (
436
+ """
437
+ array[]
438
+ """
439
+ )
440
+
435
441
AssertParse (
436
442
"""
437
443
text[...]
You can’t perform that action at this time.
0 commit comments