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:
Doug Gregor
2016-10-06 17:04:16 -07:00
parent 66e20116f2
commit 50341da32b
37 changed files with 186 additions and 174 deletions

View File

@@ -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();