Skip to content

Commit 4a119a4

Browse files
Merge pull request #79660 from AnthonyLatsis/thalassarche-melanophris
[NFC] test: Add regression test for #65533
2 parents 74222a6 + f56b53c commit 4a119a4

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

test/decl/protocol/existential_member_access/concrete.swift

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
/// var types = SwiftTypePair(typeOf: expr, type2: SwiftType<Int>.self)
66
/// types.assertTypesAreEqual()
77
/// ```
8-
struct SwiftType<T> {}
8+
struct SwiftType<T> {
9+
init(_: T) {}
10+
}
911
struct SwiftTypePair<T1, T2> {
1012
init(typeOf: T1, type2: SwiftType<T2>.Type) {}
1113

@@ -166,3 +168,28 @@ do {
166168
let exist: any CompositionBrokenClassConformance_b & BadConformanceClass
167169
exist.method(false) // expected-error {{type of expression is ambiguous without a type annotation}}
168170
}
171+
172+
// https://github.com/swiftlang/swift/issues/65533
173+
do {
174+
protocol P<A> {
175+
associatedtype A
176+
177+
func item() -> A
178+
}
179+
180+
class Class {}
181+
182+
func test<GP, ClassGP: Class>(
183+
existGP: any P<GP>,
184+
existClassGP: any P<ClassGP>
185+
) {
186+
do {
187+
let result = SwiftType(existGP.item())
188+
let _: SwiftType<GP> = result
189+
}
190+
do {
191+
let result = SwiftType(existClassGP.item())
192+
let _: SwiftType<ClassGP> = result
193+
}
194+
}
195+
}

0 commit comments

Comments
 (0)