mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #67326 from xedin/rdar-110721928
[CSSimplify] Deplay member lookup until single-element tuple with pac…
This commit is contained in:
@@ -9378,6 +9378,17 @@ performMemberLookup(ConstraintKind constraintKind, DeclNameRef memberName,
|
||||
return result;
|
||||
}
|
||||
|
||||
// Delay member lookup until single-element tuple with pack expansion
|
||||
// is sufficiently resolved.
|
||||
if (isSingleUnlabeledPackExpansionTuple(instanceTy)) {
|
||||
auto elementTy = instanceTy->castTo<TupleType>()->getElementType(0);
|
||||
if (elementTy->is<TypeVariableType>()) {
|
||||
MemberLookupResult result;
|
||||
result.OverallResult = MemberLookupResult::Unsolved;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// Okay, start building up the result list.
|
||||
MemberLookupResult result;
|
||||
result.OverallResult = MemberLookupResult::HasResults;
|
||||
|
||||
@@ -707,3 +707,18 @@ do {
|
||||
test3(str: "", a, a) // expected-error {{ambiguous use of 'test3'}}
|
||||
}
|
||||
}
|
||||
|
||||
// rdar://112095973 - single-element tuples are not unwrapped in member references
|
||||
do {
|
||||
struct V<Value> {
|
||||
let key: Int
|
||||
}
|
||||
|
||||
struct S<each T> {
|
||||
let data: (repeat V<each T>)
|
||||
}
|
||||
|
||||
func test<U>(_ value: S<U>) {
|
||||
_ = value.data.key // Ok
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user