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 @@ -596,7 +596,12 @@ extension Parser {
596
596
// Check for a [expr] suffix.
597
597
// Note that this cannot be the start of a new line.
598
598
if let lsquare = self . consume ( if: . leftSquareBracket, where: { !$0. isAtStartOfLine } ) {
599
- let args = self . parseArgumentListElements ( inLetOrVar: inLetOrVar)
599
+ let args : [ RawTupleExprElementSyntax ]
600
+ if self . at ( . rightSquareBracket) {
601
+ args = [ ]
602
+ } else {
603
+ args = self . parseArgumentListElements ( inLetOrVar: inLetOrVar)
604
+ }
600
605
let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquareBracket)
601
606
602
607
// If we can parse trailing closures, do so.
Original file line number Diff line number Diff line change @@ -437,7 +437,13 @@ final class ExpressionTests: XCTestCase {
437
437
)
438
438
}
439
439
440
- func testRangeSubscript( ) {
440
+ func testSubscript( ) {
441
+ AssertParse (
442
+ """
443
+ array[]
444
+ """
445
+ )
446
+
441
447
AssertParse (
442
448
"""
443
449
text[...]
You can’t perform that action at this time.
0 commit comments