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/Generics/inverse_scoping.swift
+10-10Lines changed: 10 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -5,16 +5,16 @@
5
5
protocolNoCopyReq:~Copyable {}
6
6
7
7
protocolP{
8
-
func f()where Self:~Copyable // expected-error {{cannot add inverse constraint 'Self: ~Copyable' on generic parameter 'Self' defined in outer scope}}
8
+
func f()where Self:~Copyable // expected-error {{cannot suppress '~Copyable' on generic parameter 'Self' defined in outer scope}}
9
9
10
-
func g<T>(_:T)where Self:~Copyable // expected-error {{cannot add inverse constraint 'Self: ~Copyable' on generic parameter 'Self' defined in outer scope}}
10
+
func g<T>(_:T)where Self:~Copyable // expected-error {{cannot suppress '~Copyable' on generic parameter 'Self' defined in outer scope}}
11
11
12
12
associatedtypeATwhere Self:~Copyable // expected-error {{constraint with subject type of 'Self' is not supported; consider adding requirement to protocol inheritance clause instead}}
13
13
14
-
// expected-error@+1 {{cannot add inverse constraint 'Self.Alice: ~Copyable' on generic parameter 'Self.Alice' defined in outer scope}}
14
+
// expected-error@+1 {{cannot suppress '~Copyable' on generic parameter 'Self.Alice' defined in outer scope}}
15
15
associatedtypeBobwhere Alice:NoCopyReq&~Copyable
16
16
associatedtypeAlicewhere Bob:~Copyable
17
-
// expected-error@-1 {{cannot add inverse constraint 'Self.Bob: ~Copyable' on generic parameter 'Self.Bob' defined in outer scope}}
17
+
// expected-error@-1 {{cannot suppress '~Copyable' on generic parameter 'Self.Bob' defined in outer scope}}
18
18
}
19
19
20
20
protocolU{}
@@ -23,13 +23,13 @@ extension U where Self: ~Copyable {}
23
23
// expected-error@-1 {{'Self' required to be 'Copyable' but is marked with '~Copyable'}}
24
24
25
25
extensionPwhere Self:~Copyable {
26
-
func g()where Self:~Copyable, // expected-error {{cannot add inverse constraint 'Self: ~Copyable' on generic parameter 'Self' defined in outer scope}}
26
+
func g()where Self:~Copyable, // expected-error {{cannot suppress '~Copyable' on generic parameter 'Self' defined in outer scope}}
27
27
// FIXME: why no similar 2nd error as Escapable here on Self?
28
28
29
-
Self:~Escapable {} // expected-error {{cannot add inverse constraint 'Self: ~Escapable' on generic parameter 'Self' defined in outer scope}}
29
+
Self:~Escapable {} // expected-error {{cannot suppress '~Escapable' on generic parameter 'Self' defined in outer scope}}
30
30
// expected-error@-1 {{'Self' required to be 'Escapable' but is marked with '~Escapable'}}
31
31
32
-
typealiasMe=Self where Self:~Copyable // expected-error {{cannot add inverse constraint 'Self: ~Copyable' on generic parameter 'Self' defined in outer scope}}
32
+
typealiasMe=Self where Self:~Copyable // expected-error {{cannot suppress '~Copyable' on generic parameter 'Self' defined in outer scope}}
33
33
34
34
typealiasMeAndU=Self where Self: U
35
35
}
@@ -39,15 +39,15 @@ struct S<T> {
39
39
// expected-note@+2 3{{add}}
40
40
// expected-error@+1 {{parameter of noncopyable type 'U' must specify ownership}}
41
41
func fn<U>(_ u:U)
42
-
where T:~Copyable, // expected-error {{cannot add inverse constraint 'T: ~Copyable' on generic parameter 'T' defined in outer scope}}
42
+
where T:~Copyable, // expected-error {{cannot suppress '~Copyable' on generic parameter 'T' defined in outer scope}}
43
43
// expected-error@-1 {{'T' required to be 'Copyable' but is marked with '~Copyable'}}
44
44
U:~Copyable
45
45
{}
46
46
47
47
func onlyCopyable()where T:Copyable{}
48
48
49
49
func fn<U>(_ u:U)
50
-
where T:~Escapable, // expected-error {{cannot add inverse constraint 'T: ~Escapable' on generic parameter 'T' defined in outer scope}}
50
+
where T:~Escapable, // expected-error {{cannot suppress '~Escapable' on generic parameter 'T' defined in outer scope}}
51
51
// expected-error@-1 {{'T' required to be 'Escapable' but is marked with '~Escapable'}}
52
52
U:~Escapable
53
53
{}
@@ -57,5 +57,5 @@ extension S where T: NoCopyReq & ~Copyable {}
57
57
// expected-error@-1 {{'T' required to be 'Copyable' but is marked with '~Copyable'}}
58
58
59
59
structExtraInverse<T:~Copyable>{
60
-
func check()where T:~Copyable {} // expected-error {{cannot add inverse constraint 'T: ~Copyable' on generic parameter 'T' defined in outer scope}}
60
+
func check()where T:~Copyable {} // expected-error {{cannot suppress '~Copyable' on generic parameter 'T' defined in outer scope}}
0 commit comments