mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Improved handling of mixed lvalues & rvalues in tuple exprs
My previous commit here didn’t work correctly for nested tuples, both because it didn’t recurse into them to propagate access kind correctly and because an outer TupleIndex overload (when indexing into the nested tuple) could still be expecting an lvalue type. This fix is much better. ConstraintSystem::resolveOverload now correctly always expects rvalue types from rvalue tuples. And during applyMemberRefExpr, if the overload expects an rvalue but the tuple contains lvalues, coerceToType() correctly does any recursive munging of the tuple expr required.
This commit is contained in:
@@ -1385,7 +1385,7 @@ void ConstraintSystem::resolveOverload(ConstraintLocator *locator,
|
||||
} else {
|
||||
// When the base is a tuple rvalue, the member is always an rvalue.
|
||||
auto tuple = choice.getBaseType()->castTo<TupleType>();
|
||||
refType = tuple->getElementType(choice.getTupleIndex());
|
||||
refType = tuple->getElementType(choice.getTupleIndex())->getRValueType();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user