You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/type/opaque_parameterized_existential.swift
+21-7Lines changed: 21 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -12,20 +12,34 @@ protocol P<T> {
12
12
extensionNever:P{typealiasT=Never}
13
13
14
14
// I do not like them written clear
15
-
func test()->anyP<someP>{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}} expected-error {{generic parameter}}
15
+
func test()->anyP<someP>{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}}
16
+
// expected-error@-1{{cannot infer concrete type for opaque result 'any P<some P>' from return expression}}
17
+
16
18
// I do not like them nested here
17
-
func test()->anyP<[someP]>{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}} expected-error {{generic parameter}}
19
+
func test()->anyP<[someP]>{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}}
20
+
// expected-error@-1{{cannot infer concrete type for opaque result 'any P<[some P]>' from return expression}}
21
+
18
22
// I do not like them under questions
19
-
func test()->anyP<(someP)??>{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}} expected-error {{generic parameter}}
23
+
func test()->anyP<(someP)??>{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}}
24
+
// expected-error@-1{{cannot infer concrete type for opaque result 'any P<(some P)??>' from return expression}}
25
+
20
26
// I do not like meta-type intentions
21
-
func test()->(anyP<someP>).Type {fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}} expected-error {{generic parameter}}
27
+
func test()->(anyP<someP>).Type {fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}}
28
+
// expected-error@-1{{cannot infer concrete type for opaque result '(any P<some P>).Type' from return expression}}
29
+
22
30
// I do not like them (meta)static-ly
23
-
func test()->anyP<someP>.Type{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}} expected-error {{generic parameter}}
31
+
func test()->anyP<someP>.Type{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}}
32
+
// expected-error@-1{{cannot infer concrete type for opaque result 'any P<some P>.Type' from return expression}}
33
+
24
34
// I do not like them tupled-three
25
-
func test()->(Int,anyP<someP>,Int){fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}} expected-error {{generic parameter}}
35
+
func test()->(Int,anyP<someP>,Int){fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}}
36
+
// expected-error@-1{{cannot infer concrete type for opaque result '(Int, any P<some P>, Int)' from return expression}}
37
+
26
38
// I do not like them in generics
27
39
structWrapper<T>{}
28
-
func test()->anyP<Wrapper<someP>>{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}} expected-error {{generic parameter}}
40
+
func test()->anyP<Wrapper<someP>>{fatalError()} // expected-error {{'some' types cannot be used in constraints on existential types}}
41
+
// expected-error@-1{{cannot infer concrete type for opaque result 'any P<Wrapper<some P>>' from return expression}}
42
+
29
43
// Your attempts to nest them put me in hysterics.
30
44
func test(_ x:anyP<someP>){} // expected-error {{'some' types cannot be used in constraints on existential types}}
0 commit comments