Merge pull request #67326 from xedin/rdar-110721928

[CSSimplify] Deplay member lookup until single-element tuple with pac…
This commit is contained in:
Pavel Yaskevich
2023-07-24 09:59:59 -07:00
committed by GitHub
2 changed files with 26 additions and 0 deletions

View File

@@ -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;

View File

@@ -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
}
}