Skip to content

Commit bc86b8d

Browse files
authored
Merge pull request #71104 from xedin/rdar-121214563
[Sema] Temporary disable l-value stripping while erasing opened exist…
2 parents 0c4efe4 + 3d74a39 commit bc86b8d

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2269,7 +2269,7 @@ static Type typeEraseExistentialSelfReferences(Type refTy, Type baseTy,
22692269
return parameterized->getBaseType();
22702270
}
22712271
}
2272-
2272+
/*
22732273
if (auto lvalue = dyn_cast<LValueType>(t)) {
22742274
auto objTy = lvalue->getObjectType();
22752275
auto erasedTy =
@@ -2283,6 +2283,7 @@ static Type typeEraseExistentialSelfReferences(Type refTy, Type baseTy,
22832283
22842284
return erasedTy;
22852285
}
2286+
*/
22862287

22872288
if (!predicateFn(t)) {
22882289
// Recurse.

test/Constraints/rdar121214563.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %target-typecheck-verify-swift
2+
3+
protocol P<A>: AnyObject {
4+
associatedtype A: P2
5+
var x: A.A2 { get set }
6+
}
7+
8+
protocol P2 {
9+
associatedtype A2
10+
var x: A2 { get }
11+
}
12+
13+
func test<T: P2>(x: T.A2, y: any P<T>, z: any P2) {
14+
y.x = x // Ok
15+
y.x = z.x // expected-error {{cannot assign value of type 'Any' to type 'T.A2'}}
16+
}

test/Sema/open_existential_lvalue.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// RUN: %target-typecheck-verify-swift
22

3+
// rdar://121214563
4+
// REQUIRES: rdar121214563
5+
36
protocol Q {}
47

58
protocol P {

0 commit comments

Comments
 (0)