[CSBindings] Open collection before binding parameter only if original argument type failed

Instead of always opening argument type represented by a collection
without type variables (to support subtyping when element is a labeled tuple),
let's try original type first and if that fails use a slower path with
indirection which attempts `array upcast`. Doing it this way helps to
propagate contextual information faster which fixes a performance regression.

Resolves: rdar://problem/54580247
This commit is contained in:
Pavel Yaskevich
2020-02-27 15:04:43 -08:00
parent 0fb4ea1ec3
commit 20fc51d4f4
4 changed files with 25 additions and 21 deletions

View File

@@ -3799,9 +3799,11 @@ bool ConstraintSystem::repairFailures(
if (tupleLocator->isLastElement<LocatorPathElt::SequenceElementType>())
break;
// Generic argument failures have a more general fix which is attached to a
// parent type and aggregates all argument failures into a single fix.
if (tupleLocator->isLastElement<LocatorPathElt::GenericArgument>())
// Generic argument/requirement failures have a more general fix which
// is attached to a parent type and aggregates all argument failures
// into a single fix.
if (tupleLocator->isLastElement<LocatorPathElt::AnyRequirement>() ||
tupleLocator->isLastElement<LocatorPathElt::GenericArgument>())
break;
ConstraintFix *fix;