mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #30185 from hborla/dependent-type-requirement-failure
[ConstraintSystem] Replace dependent member types with holes when the…
This commit is contained in:
@@ -3560,14 +3560,6 @@ bool ConstraintSystem::repairFailures(
|
||||
if (lhs->hasHole() || rhs->hasHole())
|
||||
return true;
|
||||
|
||||
// If dependent members are present here it's because the base doesn't
|
||||
// conform to the associated type's protocol. We can only get here if we
|
||||
// already applied a fix for the conformance failure.
|
||||
if (lhs->hasDependentMember() || rhs->hasDependentMember()) {
|
||||
increaseScore(SK_Fix);
|
||||
return true;
|
||||
}
|
||||
|
||||
// If requirement is something like `T == [Int]` let's let
|
||||
// type matcher a chance to match generic parameters before
|
||||
// recording a fix, because then we'll know exactly how many
|
||||
@@ -4195,15 +4187,6 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
|
||||
llvm_unreachable("type variables should have already been handled by now");
|
||||
|
||||
case TypeKind::DependentMember: {
|
||||
// If one of the dependent member types has no type variables, the
|
||||
// dependent member can't be simplified because the base doesn't conform
|
||||
// to the associated type's protocol. We can only get here if we already
|
||||
// applied a fix for the conformance failure.
|
||||
if (!desugar1->hasTypeVariable() || !desugar2->hasTypeVariable()) {
|
||||
increaseScore(SK_Fix);
|
||||
return getTypeMatchSuccess();
|
||||
}
|
||||
|
||||
// Nothing we can solve yet, since we need to wait until
|
||||
// type variables will get resolved.
|
||||
return formUnsolvedResult();
|
||||
|
||||
Reference in New Issue
Block a user