mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use "TypeBase::hasError()" rather than "is<ErrorType>()" where needed.
In most places where we were checking "is<ErrorType>()", we now mean "any error occurred". The few exceptions are in associated type inference, code completion, and expression diagnostics, where we might still work with partial errors.
This commit is contained in:
@@ -250,7 +250,7 @@ void Mangler::mangleContext(const DeclContext *ctx) {
|
||||
auto ExtD = cast<ExtensionDecl>(ctx);
|
||||
auto ExtTy = ExtD->getExtendedType();
|
||||
// Recover from erroneous extension.
|
||||
if (ExtTy.isNull() || ExtTy->is<ErrorType>())
|
||||
if (ExtTy.isNull() || ExtTy->hasError())
|
||||
return mangleContext(ExtD->getDeclContext());
|
||||
|
||||
auto decl = ExtTy->getAnyNominal();
|
||||
@@ -388,7 +388,7 @@ static bool isInPrivateOrLocalContext(const ValueDecl *D) {
|
||||
}
|
||||
|
||||
auto declaredType = DC->getDeclaredTypeOfContext();
|
||||
if (!declaredType || declaredType->is<ErrorType>())
|
||||
if (!declaredType || declaredType->hasError())
|
||||
return false;
|
||||
|
||||
auto *nominal = declaredType->getAnyNominal();
|
||||
@@ -507,7 +507,7 @@ Type Mangler::getDeclTypeForMangling(const ValueDecl *decl,
|
||||
}
|
||||
|
||||
// Shed the 'self' type and generic requirements from method manglings.
|
||||
if (isMethodDecl(decl) && type && !type->is<ErrorType>()) {
|
||||
if (isMethodDecl(decl) && type && !type->hasError()) {
|
||||
// Drop the Self argument clause from the type.
|
||||
type = type->castTo<AnyFunctionType>()->getResult();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user