Skip to content

Commit 67bf1a9

Browse files
committed
[Parser] Improve fix-it for subscription in protocol
https://bugs.swift.org/browse/SR-8340
1 parent 5e2c815 commit 67bf1a9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6226,7 +6226,7 @@ Parser::parseDeclSubscript(ParseDeclOptions Flags,
62266226
if (!Status.isError()) {
62276227
if (Flags.contains(PD_InProtocol)) {
62286228
diagnose(Tok, diag::expected_lbrace_subscript_protocol)
6229-
.fixItInsertAfter(ElementTy.get()->getEndLoc(), " { get set }");
6229+
.fixItInsertAfter(ElementTy.get()->getEndLoc(), " { get <#set#> }");
62306230
} else {
62316231
diagnose(Tok, diag::expected_lbrace_subscript);
62326232
}

test/decl/subscript/subscripting.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ class Foo {
346346
protocol r23952125 {
347347
associatedtype ItemType
348348
var count: Int { get }
349-
subscript(index: Int) -> ItemType // expected-error {{subscript in protocol must have explicit { get } or { get set } specifier}} {{36-36= { get set \}}}
349+
subscript(index: Int) -> ItemType // expected-error {{subscript in protocol must have explicit { get } or { get set } specifier}} {{36-36= { get <#set#> \}}}
350350

351351
var c : Int // expected-error {{property in protocol must have explicit { get } or { get set } specifier}}
352352
}

0 commit comments

Comments
 (0)