[Sema] Temporary disable l-value stripping while erasing opened existentials

Reverts part of https://github.com/apple/swift/pull/69950 because
it causes failure in existing code.
This commit is contained in:
Pavel Yaskevich
2024-01-23 19:26:15 -08:00
parent e7475c89ed
commit 3d74a397df
3 changed files with 21 additions and 1 deletions

View File

@@ -2270,7 +2270,7 @@ static Type typeEraseExistentialSelfReferences(Type refTy, Type baseTy,
return parameterized->getBaseType();
}
}
/*
if (auto lvalue = dyn_cast<LValueType>(t)) {
auto objTy = lvalue->getObjectType();
auto erasedTy =
@@ -2284,6 +2284,7 @@ static Type typeEraseExistentialSelfReferences(Type refTy, Type baseTy,
return erasedTy;
}
*/
if (!predicateFn(t)) {
// Recurse.

View File

@@ -0,0 +1,16 @@
// RUN: %target-typecheck-verify-swift
protocol P<A>: AnyObject {
associatedtype A: P2
var x: A.A2 { get set }
}
protocol P2 {
associatedtype A2
var x: A2 { get }
}
func test<T: P2>(x: T.A2, y: any P<T>, z: any P2) {
y.x = x // Ok
y.x = z.x // expected-error {{cannot assign value of type 'Any' to type 'T.A2'}}
}

View File

@@ -1,5 +1,8 @@
// RUN: %target-typecheck-verify-swift
// rdar://121214563
// REQUIRES: rdar121214563
protocol Q {}
protocol P {