mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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.
|
||||
|
||||
16
test/Constraints/rdar121214563.swift
Normal file
16
test/Constraints/rdar121214563.swift
Normal 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'}}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
// RUN: %target-typecheck-verify-swift
|
||||
|
||||
// rdar://121214563
|
||||
// REQUIRES: rdar121214563
|
||||
|
||||
protocol Q {}
|
||||
|
||||
protocol P {
|
||||
|
||||
Reference in New Issue
Block a user