Skip to content

Commit 8550799

Browse files
committed
[CodeCompletion] Call hasStorage instead of getImplInfo().hasStorage() to determine if a variable is stored
This uncovered a discrepancy between `getImplInfo().hasStorage()` and `hasStorage()`.
1 parent 17e6a25 commit 8550799

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/IDE/CompletionLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2251,7 +2251,7 @@ void CompletionLookup::foundDecl(ValueDecl *D, DeclVisibilityKind Reason,
22512251
return;
22522252
case LookupKind::StoredProperty:
22532253
if (auto *VD = dyn_cast<VarDecl>(D)) {
2254-
if (VD->getImplInfo().hasStorage()) {
2254+
if (VD->hasStorage()) {
22552255
addVarDeclRef(VD, Reason, dynamicLookupInfo);
22562256
}
22572257
return;

lib/Sema/TypeCheckStorage.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3533,7 +3533,8 @@ bool HasStorageRequest::evaluate(Evaluator &evaluator,
35333533
storage->getParsedAccessor(AccessorKind::Address) ||
35343534
storage->getParsedAccessor(AccessorKind::Set) ||
35353535
storage->getParsedAccessor(AccessorKind::Modify) ||
3536-
storage->getParsedAccessor(AccessorKind::MutableAddress))
3536+
storage->getParsedAccessor(AccessorKind::MutableAddress) ||
3537+
storage->getParsedAccessor(AccessorKind::Init))
35373538
return false;
35383539

35393540
// willSet or didSet in an overriding property imply that there is no storage.

0 commit comments

Comments
 (0)