Skip to content

Commit 854c258

Browse files
authored
Merge pull request swiftlang#35698 from CodaFi/localization
2 parents 0183c0d + 0009209 commit 854c258

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2814,7 +2814,7 @@ static void finishProtocolStorageImplInfo(AbstractStorageDecl *storage,
28142814
if (auto *var = dyn_cast<VarDecl>(storage)) {
28152815
SourceLoc typeLoc;
28162816
if (auto *repr = var->getTypeReprOrParentPatternTypeRepr())
2817-
typeLoc = repr->getLoc();
2817+
typeLoc = repr->getEndLoc();
28182818

28192819
if (info.hasStorage()) {
28202820
// Protocols cannot have stored properties.

test/decl/protocol/protocols.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,15 @@ protocol LetThereBeCrash {
516516
let x: Int
517517
// expected-error@-1 {{protocols cannot require properties to be immutable; declare read-only properties by using 'var' with a '{ get }' specifier}} {{13-13= { get \}}}
518518
// expected-note@-2 {{declared here}}
519+
let xs: [Int]
520+
// expected-error@-1 {{protocols cannot require properties to be immutable; declare read-only properties by using 'var' with a '{ get }' specifier}} {{3-6=var}} {{16-16= { get \}}}
521+
// expected-note@-2 {{declared here}}
519522
}
520523

521524
extension LetThereBeCrash {
522-
init() { x = 1 }
525+
init() { x = 1; xs = [] }
523526
// expected-error@-1 {{'let' property 'x' may not be initialized directly; use "self.init(...)" or "self = ..." instead}}
527+
// expected-error@-2 {{'let' property 'xs' may not be initialized directly; use "self.init(...)" or "self = ..." instead}}
524528
}
525529

526530
// SR-11412

0 commit comments

Comments
 (0)