Skip to content

Commit 3c76bd8

Browse files
committed
Merge Two Tests
1 parent 1ec678e commit 3c76bd8

File tree

2 files changed

+30
-31
lines changed

2 files changed

+30
-31
lines changed

test/Constraints/existential_metatypes.swift

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,33 @@ func testP3(_ p: P3, something: Something) {
9090
func testIUOToAny(_ t: AnyObject.Type!) {
9191
let _: Any = t
9292
}
93+
94+
protocol P4<T> {
95+
associatedtype T
96+
}
97+
98+
protocol Q4<T> {
99+
associatedtype T
100+
}
101+
102+
protocol PP4<U>: P4<Self.U.T> {
103+
associatedtype U: P4<U>
104+
}
105+
106+
func parameterizedExistentials() {
107+
var qp: (any Q4<Int>).Type
108+
var pp: (any P4<Int>).Type = qp // expected-error{{cannot convert value of type '(any Q4<Int>).Type' to specified type '(any P4<Int>).Type'}}
109+
110+
var qt: any Q4<Int>.Type
111+
qt = qp // expected-error{{cannot assign value of type '(any Q4<Int>).Type' to type 'any Q4<Int>.Type'}}
112+
qp = qt // expected-error{{cannot assign value of type 'any Q4<Int>.Type' to type '(any Q4<Int>).Type'}}
113+
var pt: any P4<Int>.Type = qt // expected-error{{cannot convert value of type 'any Q4<Int>.Type' to specified type 'any P4<Int>.Type'}}
114+
pt = pp // expected-error{{cannot assign value of type '(any P4<Int>).Type' to type 'any P4<Int>.Type'}}
115+
pp = pt // expected-error{{cannot assign value of type 'any P4<Int>.Type' to type '(any P4<Int>).Type'}}
116+
117+
var ppp: (any PP4<Int>).Type
118+
pp = ppp // expected-error{{cannot assign value of type '(any PP4<Int>).Type' to type '(any P4<Int>).Type'}}
119+
120+
var ppt: any PP4<Int>.Type
121+
pt = ppt
122+
}

test/Constraints/parameterized_existential_metatypes.swift

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)