@@ -19,14 +19,13 @@ func more() {
19
19
20
20
struct S4 : ~ ( Copyable & Equatable ) { } // expected-error {{type 'Copyable & Equatable' is not invertible}}
21
21
22
- func blah< T> ( _ t: T ) where T: ~ Copyable,
23
- T: ~ Hashable { } // expected-error@:31 {{type 'Hashable' is not invertible}}
22
+ func blah< T> ( _ t: borrowing T ) where T: ~ Copyable,
23
+ T: ~ Hashable { } // expected-error@:41 {{type 'Hashable' is not invertible}}
24
24
25
25
func foo< T: ~ Copyable> ( x: borrowing T ) { }
26
26
27
27
struct Buurap < T: ~ Copyable> { }
28
28
29
- // expected-warning@+1 {{protocol 'Foo' should be declared to refine 'Copyable' due to a same-type constraint on 'Self'}}
30
29
protocol Foo : ~ Copyable // expected-note {{previous inverse constraint here}}
31
30
where Self: ~ Copyable { // expected-error {{duplicate inverse constraint}}
32
31
@@ -53,16 +52,21 @@ extension S: ~Copyable {}
53
52
struct S: ~ U, // expected-error {{type 'U' is not invertible}}
54
53
~ Copyable { }
55
54
56
- func greenBay< each T : ~ Copyable> ( _ r: repeat each T ) { }
55
+ func greenBay< each T : ~ Copyable> ( _ r: repeat each T ) { } // expected-error{{cannot apply inverse '~Copyable' to type 'each T' in conformance requirement}}
57
56
58
57
typealias Clone = Copyable
59
58
func dup< D: ~ Clone> ( _ d: D ) { }
60
- // expected-error@-1 {{noncopyable parameter must specify its ownership}}
59
+ // expected-error@-1 {{parameter of noncopyable type 'D' must specify ownership}}
61
60
// expected-note@-2 {{add 'borrowing'}}
62
61
// expected-note@-3 {{add 'inout'}}
63
62
// expected-note@-4 {{add 'consuming'}}
64
63
64
+ // expected-error@+2 {{parameter of noncopyable type 'some ~Copyable' must specify ownership}}
65
+ // expected-error@+1 {{parameter of noncopyable type 'some ~Clone' must specify ownership}}
65
66
func superb( _ thing: some ~ Copyable, thing2 : some ~ Clone) { }
67
+ // expected-note@-1 2{{add 'borrowing'}}
68
+ // expected-note@-2 2{{add 'inout'}}
69
+ // expected-note@-3 2{{add 'consuming'}}
66
70
67
71
func ownership1( _ t: borrowing any ~ Equatable) { } // expected-error {{type 'Equatable' is not invertible}}
68
72
0 commit comments