mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #65861 from xedin/rdar-109160060
[CSSimplify] Allow conversions between tuples with pack expansions and `Any`
This commit is contained in:
@@ -6831,9 +6831,13 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
|
||||
// becuase expansion could be defaulted to an empty pack which means
|
||||
// that under substitution that element would disappear and the type
|
||||
// would be just `(Int)`.
|
||||
//
|
||||
// Notable exception here is `Any` which doesn't require wrapping and
|
||||
// would be handled by existental promotion in cases where it's allowed.
|
||||
if (isTupleWithUnresolvedPackExpansion(origType1) ||
|
||||
isTupleWithUnresolvedPackExpansion(origType2)) {
|
||||
if (desugar1->is<TupleType>() != desugar2->is<TupleType>()) {
|
||||
if (desugar1->is<TupleType>() != desugar2->is<TupleType>() &&
|
||||
(!desugar1->isAny() && !desugar2->isAny())) {
|
||||
return matchTypes(
|
||||
desugar1->is<TupleType>() ? type1
|
||||
: TupleType::get({type1}, getASTContext()),
|
||||
|
||||
Reference in New Issue
Block a user