[CSSolver/SILGen] Fix solver to support function conversion with collection subtyping

Fix collection subtyping relation in function argument position
by emiting special re-abstraction thunk with collection upcast.

Resolves: rdar://problem/35702810
This commit is contained in:
Pavel Yaskevich
2017-11-28 23:59:19 -08:00
parent e1db602212
commit 515520e524
4 changed files with 141 additions and 3 deletions

View File

@@ -2090,8 +2090,7 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
}
// Special implicit nominal conversions.
if (!type1->is<LValueType>() &&
kind >= ConstraintKind::Conversion) {
if (!type1->is<LValueType>() && kind >= ConstraintKind::Subtype) {
// Array -> Array.
if (isArrayType(desugar1) && isArrayType(desugar2)) {
assert(!type2->is<LValueType>() && "Unexpected lvalue type!");