Skip to content

Commit d2f9dd6

Browse files
committed
update more tests
1 parent fe2cb00 commit d2f9dd6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test/Parse/inverses.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ func more() {
1919

2020
struct S4: ~(Copyable & Equatable) {} // expected-error {{type 'Copyable & Equatable' is not invertible}}
2121

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}}
2424

2525
func foo<T: ~Copyable>(x: borrowing T) {}
2626

2727
struct Buurap<T: ~Copyable> {}
2828

29-
// expected-warning@+1 {{protocol 'Foo' should be declared to refine 'Copyable' due to a same-type constraint on 'Self'}}
3029
protocol Foo: ~Copyable // expected-note {{previous inverse constraint here}}
3130
where Self: ~Copyable { // expected-error {{duplicate inverse constraint}}
3231

@@ -53,16 +52,21 @@ extension S: ~Copyable {}
5352
struct S: ~U, // expected-error {{type 'U' is not invertible}}
5453
~Copyable {}
5554

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}}
5756

5857
typealias Clone = Copyable
5958
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}}
6160
// expected-note@-2 {{add 'borrowing'}}
6261
// expected-note@-3 {{add 'inout'}}
6362
// expected-note@-4 {{add 'consuming'}}
6463

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}}
6566
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'}}
6670

6771
func ownership1(_ t: borrowing any ~Equatable) {} // expected-error {{type 'Equatable' is not invertible}}
6872

0 commit comments

Comments
 (0)