Skip to content

Commit caceece

Browse files
committed
Add check in StorageImplInfoRequest::evaluate instead
1 parent b678171 commit caceece

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/Sema/TypeCheckStorage.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3064,6 +3064,13 @@ StorageImplInfoRequest::evaluate(Evaluator &evaluator,
30643064
readImpl = ReadImplKind::Stored;
30653065
}
30663066

3067+
// Extensions can't have stored properties. If there are braces, assume
3068+
// this is an incomplete computed property. This avoids an "extensions
3069+
// must not contain stored properties" error later on.
3070+
} else if (isa<ExtensionDecl>(storage->getDeclContext()) &&
3071+
storage->getBracesRange().isValid()) {
3072+
readImpl = ReadImplKind::Get;
3073+
30673074
// Otherwise, it's stored.
30683075
} else {
30693076
readImpl = ReadImplKind::Stored;

0 commit comments

Comments
 (0)