Skip to content

Commit d2ddbc8

Browse files
committed
[Type checker] Cope with null function/subscript types but not error types.
We always ensure that functions and subscripts have appropriately-shaped interface types, so the "error" check is unnecessary. However, if we end up in a recursive-validation case, the interface type *might* be null. Replace a check for the former with a check for the latter. Thanks @slavapestov.
1 parent 5d96862 commit d2ddbc8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Sema/TypeCheckAttr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,8 +2068,8 @@ static Type getDynamicComparisonType(ValueDecl *value) {
20682068
}
20692069

20702070
auto interfaceType = value->getInterfaceType();
2071-
if (interfaceType->hasError())
2072-
return interfaceType;
2071+
if (!interfaceType)
2072+
return ErrorType::get(value->getASTContext());
20732073

20742074
return interfaceType->removeArgumentLabels(numArgumentLabels);
20752075
}

0 commit comments

Comments
 (0)