Skip to content

Commit 79b9f6c

Browse files
author
David Ungar
committed
Fix SubscriptDecl end position
1 parent 8caf6f3 commit 79b9f6c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6393,7 +6393,7 @@ Parser::parseDeclSubscript(SourceLoc StaticLoc,
63936393
SignatureHasCodeCompletion |= whereStatus.hasCodeCompletion();
63946394
if (whereStatus.hasCodeCompletion() && !CodeCompletion) {
63956395
// Trigger delayed parsing, no need to continue.
6396-
Subscript->setEndLoc(getEndOfPreviousLoc());
6396+
Subscript->setEndLoc(getEndOfPreviousLoc().getAdvancedLoc(-1));
63976397
return whereStatus;
63986398
}
63996399
}
@@ -6437,7 +6437,7 @@ Parser::parseDeclSubscript(SourceLoc StaticLoc,
64376437

64386438
accessors.record(*this, Subscript, (Invalid || !Status.isSuccess()), Decls);
64396439

6440-
Subscript->setEndLoc(getEndOfPreviousLoc());
6440+
Subscript->setEndLoc(getEndOfPreviousLoc().getAdvancedLoc(-1));
64416441

64426442
// No need to setLocalDiscriminator because subscripts cannot
64436443
// validly appear outside of type decls.

test/SourceKit/CodeFormat/indent-implicit-getter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class var foo: Int {
6363
// CHECK: key.sourcetext: " subscript(a: Int) -> Int {"
6464
// CHECK: key.sourcetext: " let x = 3"
6565
// CHECK: key.sourcetext: " return x"
66-
// CHECK: key.sourcetext: " }"
66+
// CHECK: key.sourcetext: " }"
6767
// CHECK: key.sourcetext: "}"
6868
// CHECK: key.sourcetext: " var foo: Int {"
6969
// CHECK: key.sourcetext: " class var foo: Int {"

0 commit comments

Comments
 (0)