@@ -100,7 +100,7 @@ Type FailureDiagnostic::resolveType(Type rawType, bool reconstituteSugar,
100100 if (auto *typeVar = type->getAs <TypeVariableType>()) {
101101 auto resolvedType = S.simplifyType (typeVar);
102102
103- if (!resolvedType->hasUnresolvedType ())
103+ if (!resolvedType->hasError ())
104104 return resolvedType;
105105
106106 // If type variable was simplified to an unresolved pack expansion
@@ -117,7 +117,7 @@ Type FailureDiagnostic::resolveType(Type rawType, bool reconstituteSugar,
117117 }
118118
119119 Type GP = typeVar->getImpl ().getGenericParameter ();
120- return resolvedType->is <UnresolvedType >() && GP
120+ return resolvedType->is <ErrorType >() && GP
121121 ? ErrorType::get (GP)
122122 : resolvedType;
123123 }
@@ -128,7 +128,7 @@ Type FailureDiagnostic::resolveType(Type rawType, bool reconstituteSugar,
128128 }
129129
130130 if (type->isPlaceholder ())
131- return Type (type->getASTContext (). TheUnresolvedType );
131+ return ErrorType::get (type->getASTContext ());
132132
133133 return std::nullopt ;
134134 });
@@ -183,7 +183,7 @@ StringRef FailureDiagnostic::getEditorPlaceholder(
183183 llvm::SmallVectorImpl<char > &scratch) const {
184184 llvm::raw_svector_ostream OS (scratch);
185185 OS << " <#" ;
186- if (!ty || ty->is <UnresolvedType> ()) {
186+ if (!ty || ty->isBareErrorType ()) {
187187 OS << description;
188188 } else {
189189 OS << " T##" ;
@@ -5681,7 +5681,7 @@ bool MissingArgumentsFailure::diagnoseMissingResultBuilderElement() const {
56815681 auto fixIt = getEditorPlaceholder (" result" , paramType, scratch);
56825682 auto fixItLoc = call->getStartLoc ();
56835683
5684- if (paramType->is <UnresolvedType> ()) {
5684+ if (paramType->isBareErrorType ()) {
56855685 emitDiagnostic (diag::result_builder_missing_element,
56865686 resultBuilder->getName ())
56875687 .fixItInsertAfter (fixItLoc, fixIt);
@@ -5804,7 +5804,7 @@ bool MissingArgumentsFailure::isMisplacedMissingArgument(
58045804 auto argType = solution.simplifyType (solution.getType (unaryArg));
58055805 auto paramType = fnType->getParams ()[1 ].getPlainType ();
58065806
5807- if (isExpr<ClosureExpr>(unaryArg) && argType->is <UnresolvedType >()) {
5807+ if (isExpr<ClosureExpr>(unaryArg) && argType->is <ErrorType >()) {
58085808 auto unwrappedParamTy = paramType->lookThroughAllOptionalTypes ();
58095809 if (unwrappedParamTy->is <FunctionType>() || unwrappedParamTy->isAny ())
58105810 return true ;
@@ -5958,7 +5958,7 @@ bool ClosureParamDestructuringFailure::diagnoseAsError() {
59585958 };
59595959
59605960 auto isValidType = [](Type resultType) -> bool {
5961- return resultType && !resultType->hasUnresolvedType () &&
5961+ return resultType && !resultType->hasError () &&
59625962 !resultType->hasTypeVariable ();
59635963 };
59645964
@@ -6619,7 +6619,7 @@ bool CollectionElementContextualFailure::diagnoseAsError() {
66196619 // statement it has to be diagnosed as pattern match if there are
66206620 // holes present in the contextual type.
66216621 if (purpose == ContextualTypePurpose::CTP_ForEachSequence &&
6622- contextualType->hasUnresolvedType ()) {
6622+ contextualType->hasError ()) {
66236623 auto diagnostic = emitDiagnostic (
66246624 (contextualType->is <TupleType>() && !eltType->is <TupleType>())
66256625 ? diag::cannot_match_expr_tuple_pattern_with_nontuple_value
@@ -7490,7 +7490,7 @@ bool ArgumentMismatchFailure::diagnoseAsError() {
74907490 if (argType->isKeyPath () && !paramType->isKnownKeyPathType ()) {
74917491 auto keyPathTy = argType->castTo <BoundGenericType>();
74927492 auto rootTy = keyPathTy->getGenericArgs ()[0 ];
7493- if (rootTy->is <UnresolvedType> ()) {
7493+ if (rootTy->isBareErrorType ()) {
74947494 emitDiagnostic (diag::cannot_convert_unresolved_key_path_argument_value,
74957495 paramType);
74967496 return true ;
@@ -7627,7 +7627,7 @@ bool ArgumentMismatchFailure::diagnosePatternMatchingMismatch() const {
76277627 auto rhsType = getType (rhsExpr);
76287628
76297629 auto diagnostic =
7630- lhsType->is <UnresolvedType> ()
7630+ lhsType->isBareErrorType ()
76317631 ? emitDiagnostic (
76327632 diag::cannot_match_unresolved_expr_pattern_with_value, rhsType)
76337633 : emitDiagnostic (diag::cannot_match_expr_pattern_with_value, lhsType,
@@ -8286,7 +8286,7 @@ bool UnableToInferClosureParameterType::diagnoseAsError() {
82868286 if (parentExpr) {
82878287 // Missing or invalid member reference in call.
82888288 if (auto *AE = dyn_cast<ApplyExpr>(parentExpr)) {
8289- if (getType (AE->getFn ())->is <UnresolvedType >())
8289+ if (getType (AE->getFn ())->is <ErrorType >())
82908290 return false ;
82918291 }
82928292
0 commit comments