@@ -884,7 +884,6 @@ GenericArgumentsMismatchFailure::getDiagnosticFor(
884
884
885
885
case CTP_CaseStmt:
886
886
case CTP_ThrowStmt:
887
- case CTP_ForEachStmt:
888
887
case CTP_ForEachSequence:
889
888
case CTP_ComposedPropertyWrapper:
890
889
case CTP_Unused:
@@ -2787,7 +2786,7 @@ bool ContextualFailure::diagnoseAsError() {
2787
2786
}
2788
2787
}
2789
2788
2790
- if (CTP == CTP_ForEachStmt || CTP == CTP_ForEachSequence) {
2789
+ if (CTP == CTP_ForEachSequence) {
2791
2790
if (fromType->isAnyExistentialType ()) {
2792
2791
Type constraintType = fromType;
2793
2792
if (auto existential = constraintType->getAs <ExistentialType>())
@@ -2986,7 +2985,6 @@ getContextualNilDiagnostic(ContextualTypePurpose CTP) {
2986
2985
case CTP_CaseStmt:
2987
2986
case CTP_ThrowStmt:
2988
2987
case CTP_DiscardStmt:
2989
- case CTP_ForEachStmt:
2990
2988
case CTP_ForEachSequence:
2991
2989
case CTP_YieldByReference:
2992
2990
case CTP_WrappedProperty:
@@ -3774,7 +3772,6 @@ ContextualFailure::getDiagnosticFor(ContextualTypePurpose context,
3774
3772
return diag::cannot_match_value_with_pattern;
3775
3773
3776
3774
case CTP_ThrowStmt:
3777
- case CTP_ForEachStmt:
3778
3775
case CTP_ForEachSequence:
3779
3776
case CTP_ComposedPropertyWrapper:
3780
3777
case CTP_Unused:
@@ -6610,8 +6607,7 @@ bool CollectionElementContextualFailure::diagnoseAsError() {
6610
6607
// If this is a conversion failure related to binding of `for-each`
6611
6608
// statement it has to be diagnosed as pattern match if there are
6612
6609
// holes present in the contextual type.
6613
- if ((purpose == ContextualTypePurpose::CTP_ForEachStmt ||
6614
- purpose == ContextualTypePurpose::CTP_ForEachSequence) &&
6610
+ if (purpose == ContextualTypePurpose::CTP_ForEachSequence &&
6615
6611
contextualType->hasUnresolvedType ()) {
6616
6612
auto diagnostic = emitDiagnostic (
6617
6613
(contextualType->is <TupleType>() && !eltType->is <TupleType>())
0 commit comments