Skip to content

Commit 19395d6

Browse files
authored
Merge pull request swiftlang#28446 from DougGregor/rdar57040259
2 parents 1383a63 + c4ed40d commit 19395d6

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2770,7 +2770,8 @@ StorageImplInfoRequest::evaluate(Evaluator &evaluator,
27702770

27712771
// Check if we have observers.
27722772
} else if (hasWillSet || hasDidSet) {
2773-
if (storage->getAttrs().hasAttribute<OverrideAttr>()) {
2773+
if (storage->getAttrs().hasAttribute<OverrideAttr>() &&
2774+
storage->getDeclContext()->isTypeContext()) {
27742775
readImpl = ReadImplKind::Inherited;
27752776
} else {
27762777
readImpl = ReadImplKind::Stored;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// RUN: not %target-swift-frontend -typecheck %s
2+
class A { }
3+
class B: A {
4+
func foo(_: () -> ()) {
5+
6+
override var prop: Any? {
7+
didSet { }
8+
}
9+
}

0 commit comments

Comments
 (0)