mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[CS] Better diagnose conformance failures for EnumElementPatterns
Previously we could end up with a ContextualMismatch fix and a MissingConformance fix for different elements of the `matchTypes` disjunction, leading to an ambiguity. Instead, avoid recording the ContextualMismatch if we're matching an existential, and tweak the MissingConformance failure to have a custom diagnostic for EnumElementPattern matching.
This commit is contained in:
@@ -6667,6 +6667,11 @@ bool ConstraintSystem::repairFailures(
|
||||
if (lhs->isPlaceholder() || rhs->isPlaceholder())
|
||||
return true;
|
||||
|
||||
// If we're converting to an existential, we'll diagnose failures in
|
||||
// the conformance constraint.
|
||||
if (hasConversionOrRestriction(ConversionRestrictionKind::Existential))
|
||||
return false;
|
||||
|
||||
conversionsOrFixes.push_back(ContextualMismatch::create(
|
||||
*this, lhs, rhs, getConstraintLocator(locator)));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user