Sema: Solve Bind constraints involving to two variables of different lvalue-ness

The restriction here only applies to Equal constraints.

Fixes <rdar://problem/45511838>, <https://bugs.swift.org/browse/SR-9068>.
This commit is contained in:
Slava Pestov
2019-01-11 22:21:38 -05:00
parent 33871548b3
commit 353b4cc4c4
2 changed files with 12 additions and 4 deletions

View File

@@ -1730,7 +1730,8 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
// If exactly one of the type variables can bind to an lvalue, we
// can't merge these two type variables.
if (rep1->getImpl().canBindToLValue()
if (kind == ConstraintKind::Equal &&
rep1->getImpl().canBindToLValue()
!= rep2->getImpl().canBindToLValue())
return formUnsolvedResult();