Merge pull request #30185 from hborla/dependent-type-requirement-failure

[ConstraintSystem] Replace dependent member types with holes when the…
This commit is contained in:
Holly Borla
2020-03-03 19:55:07 -08:00
committed by GitHub
5 changed files with 43 additions and 25 deletions

View File

@@ -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();