@@ -100,7 +100,7 @@ Type FailureDiagnostic::resolveType(Type rawType, bool reconstituteSugar,
100
100
if (auto *typeVar = type->getAs <TypeVariableType>()) {
101
101
auto resolvedType = S.simplifyType (typeVar);
102
102
103
- if (!resolvedType->hasUnresolvedType ())
103
+ if (!resolvedType->hasError ())
104
104
return resolvedType;
105
105
106
106
// If type variable was simplified to an unresolved pack expansion
@@ -117,7 +117,7 @@ Type FailureDiagnostic::resolveType(Type rawType, bool reconstituteSugar,
117
117
}
118
118
119
119
Type GP = typeVar->getImpl ().getGenericParameter ();
120
- return resolvedType->is <UnresolvedType >() && GP
120
+ return resolvedType->is <ErrorType >() && GP
121
121
? ErrorType::get (GP)
122
122
: resolvedType;
123
123
}
@@ -128,7 +128,7 @@ Type FailureDiagnostic::resolveType(Type rawType, bool reconstituteSugar,
128
128
}
129
129
130
130
if (type->isPlaceholder ())
131
- return Type (type->getASTContext (). TheUnresolvedType );
131
+ return ErrorType::get (type->getASTContext ());
132
132
133
133
return std::nullopt ;
134
134
});
@@ -183,7 +183,7 @@ StringRef FailureDiagnostic::getEditorPlaceholder(
183
183
llvm::SmallVectorImpl<char > &scratch) const {
184
184
llvm::raw_svector_ostream OS (scratch);
185
185
OS << " <#" ;
186
- if (!ty || ty->is <UnresolvedType> ()) {
186
+ if (!ty || ty->isBareErrorType ()) {
187
187
OS << description;
188
188
} else {
189
189
OS << " T##" ;
@@ -5681,7 +5681,7 @@ bool MissingArgumentsFailure::diagnoseMissingResultBuilderElement() const {
5681
5681
auto fixIt = getEditorPlaceholder (" result" , paramType, scratch);
5682
5682
auto fixItLoc = call->getStartLoc ();
5683
5683
5684
- if (paramType->is <UnresolvedType> ()) {
5684
+ if (paramType->isBareErrorType ()) {
5685
5685
emitDiagnostic (diag::result_builder_missing_element,
5686
5686
resultBuilder->getName ())
5687
5687
.fixItInsertAfter (fixItLoc, fixIt);
@@ -5804,7 +5804,7 @@ bool MissingArgumentsFailure::isMisplacedMissingArgument(
5804
5804
auto argType = solution.simplifyType (solution.getType (unaryArg));
5805
5805
auto paramType = fnType->getParams ()[1 ].getPlainType ();
5806
5806
5807
- if (isExpr<ClosureExpr>(unaryArg) && argType->is <UnresolvedType >()) {
5807
+ if (isExpr<ClosureExpr>(unaryArg) && argType->is <ErrorType >()) {
5808
5808
auto unwrappedParamTy = paramType->lookThroughAllOptionalTypes ();
5809
5809
if (unwrappedParamTy->is <FunctionType>() || unwrappedParamTy->isAny ())
5810
5810
return true ;
@@ -5958,7 +5958,7 @@ bool ClosureParamDestructuringFailure::diagnoseAsError() {
5958
5958
};
5959
5959
5960
5960
auto isValidType = [](Type resultType) -> bool {
5961
- return resultType && !resultType->hasUnresolvedType () &&
5961
+ return resultType && !resultType->hasError () &&
5962
5962
!resultType->hasTypeVariable ();
5963
5963
};
5964
5964
@@ -6619,7 +6619,7 @@ bool CollectionElementContextualFailure::diagnoseAsError() {
6619
6619
// statement it has to be diagnosed as pattern match if there are
6620
6620
// holes present in the contextual type.
6621
6621
if (purpose == ContextualTypePurpose::CTP_ForEachSequence &&
6622
- contextualType->hasUnresolvedType ()) {
6622
+ contextualType->hasError ()) {
6623
6623
auto diagnostic = emitDiagnostic (
6624
6624
(contextualType->is <TupleType>() && !eltType->is <TupleType>())
6625
6625
? diag::cannot_match_expr_tuple_pattern_with_nontuple_value
@@ -7490,7 +7490,7 @@ bool ArgumentMismatchFailure::diagnoseAsError() {
7490
7490
if (argType->isKeyPath () && !paramType->isKnownKeyPathType ()) {
7491
7491
auto keyPathTy = argType->castTo <BoundGenericType>();
7492
7492
auto rootTy = keyPathTy->getGenericArgs ()[0 ];
7493
- if (rootTy->is <UnresolvedType> ()) {
7493
+ if (rootTy->isBareErrorType ()) {
7494
7494
emitDiagnostic (diag::cannot_convert_unresolved_key_path_argument_value,
7495
7495
paramType);
7496
7496
return true ;
@@ -7627,7 +7627,7 @@ bool ArgumentMismatchFailure::diagnosePatternMatchingMismatch() const {
7627
7627
auto rhsType = getType (rhsExpr);
7628
7628
7629
7629
auto diagnostic =
7630
- lhsType->is <UnresolvedType> ()
7630
+ lhsType->isBareErrorType ()
7631
7631
? emitDiagnostic (
7632
7632
diag::cannot_match_unresolved_expr_pattern_with_value, rhsType)
7633
7633
: emitDiagnostic (diag::cannot_match_expr_pattern_with_value, lhsType,
@@ -8286,7 +8286,7 @@ bool UnableToInferClosureParameterType::diagnoseAsError() {
8286
8286
if (parentExpr) {
8287
8287
// Missing or invalid member reference in call.
8288
8288
if (auto *AE = dyn_cast<ApplyExpr>(parentExpr)) {
8289
- if (getType (AE->getFn ())->is <UnresolvedType >())
8289
+ if (getType (AE->getFn ())->is <ErrorType >())
8290
8290
return false ;
8291
8291
}
8292
8292
0 commit comments