@@ -884,7 +884,6 @@ GenericArgumentsMismatchFailure::getDiagnosticFor(
884884
885885 case CTP_CaseStmt:
886886 case CTP_ThrowStmt:
887- case CTP_ForEachStmt:
888887 case CTP_ForEachSequence:
889888 case CTP_ComposedPropertyWrapper:
890889 case CTP_Unused:
@@ -2787,7 +2786,7 @@ bool ContextualFailure::diagnoseAsError() {
27872786 }
27882787 }
27892788
2790- if (CTP == CTP_ForEachStmt || CTP == CTP_ForEachSequence) {
2789+ if (CTP == CTP_ForEachSequence) {
27912790 if (fromType->isAnyExistentialType ()) {
27922791 Type constraintType = fromType;
27932792 if (auto existential = constraintType->getAs <ExistentialType>())
@@ -2986,7 +2985,6 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
29862985 case CTP_CaseStmt:
29872986 case CTP_ThrowStmt:
29882987 case CTP_DiscardStmt:
2989- case CTP_ForEachStmt:
29902988 case CTP_ForEachSequence:
29912989 case CTP_YieldByReference:
29922990 case CTP_WrappedProperty:
@@ -3774,7 +3772,6 @@ ContextualFailure::getDiagnosticFor(ContextualTypePurpose context,
37743772 return diag::cannot_match_value_with_pattern;
37753773
37763774 case CTP_ThrowStmt:
3777- case CTP_ForEachStmt:
37783775 case CTP_ForEachSequence:
37793776 case CTP_ComposedPropertyWrapper:
37803777 case CTP_Unused:
@@ -6610,8 +6607,7 @@ bool CollectionElementContextualFailure::diagnoseAsError() {
66106607 // If this is a conversion failure related to binding of `for-each`
66116608 // statement it has to be diagnosed as pattern match if there are
66126609 // holes present in the contextual type.
6613- if ((purpose == ContextualTypePurpose::CTP_ForEachStmt ||
6614- purpose == ContextualTypePurpose::CTP_ForEachSequence) &&
6610+ if (purpose == ContextualTypePurpose::CTP_ForEachSequence &&
66156611 contextualType->hasUnresolvedType ()) {
66166612 auto diagnostic = emitDiagnostic (
66176613 (contextualType->is <TupleType>() && !eltType->is <TupleType>())
0 commit comments