Skip to content

Commit 12fa026

Browse files
committed
Sema: Use AbstractStorageDecl::getValueInterfaceType() in a couple of spots
1 parent e18a61c commit 12fa026

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

lib/Sema/MiscDiagnostics.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4224,8 +4224,7 @@ Optional<Identifier> TypeChecker::omitNeedlessWords(VarDecl *var) {
42244224
return None;
42254225

42264226
// Dig out the type of the variable.
4227-
Type type = var->getInterfaceType()->getReferenceStorageReferent()
4228-
->getWithoutSpecifierType();
4227+
Type type = var->getValueInterfaceType();
42294228
while (auto optObjectTy = type->getOptionalObjectType())
42304229
type = optObjectTy;
42314230

lib/Sema/TypeCheckDecl.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3865,13 +3865,8 @@ void TypeChecker::validateDecl(ValueDecl *D) {
38653865
auto valueParams = accessor->getParameters();
38663866

38673867
// Determine the value type.
3868-
Type valueIfaceTy;
3869-
if (auto VD = dyn_cast<VarDecl>(storage)) {
3870-
valueIfaceTy = VD->getInterfaceType()->getReferenceStorageReferent();
3871-
} else {
3872-
auto SD = cast<SubscriptDecl>(storage);
3873-
valueIfaceTy = SD->getElementInterfaceType();
3874-
3868+
Type valueIfaceTy = storage->getValueInterfaceType();
3869+
if (auto SD = dyn_cast<SubscriptDecl>(storage)) {
38753870
// Copy the index types instead of re-validating them.
38763871
auto indices = SD->getIndices();
38773872
for (size_t i = 0, e = indices->size(); i != e; ++i) {

0 commit comments

Comments
 (0)