Skip to content

Commit 70878a6

Browse files
committed
NCGenerics: add more extension test coverage
1 parent 722282e commit 70878a6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// RUN: %target-typecheck-verify-swift \
2+
// RUN: -enable-experimental-feature NoncopyableGenerics \
3+
// RUN: -enable-experimental-feature NonescapableTypes
4+
5+
struct Turtle<T> {}
6+
extension Turtle where T: ~Copyable {} // expected-error {{'T' required to be 'Copyable' but is marked with '~Copyable'}}
7+
8+
struct Rabbit<T> where T: ~Copyable {}
9+
extension Rabbit where T: ~Escapable {} // expected-error {{'T' required to be 'Escapable' but is marked with '~Escapable'}}
10+
11+
protocol P {}
12+
extension P where Self: ~Escapable {} // expected-error {{'Self' required to be 'Escapable' but is marked with '~Escapable'}}
13+
14+
protocol HasAssoc {
15+
associatedtype A
16+
}
17+
extension HasAssoc where Self.A: ~Copyable {}
18+
// expected-error@-1 {{cannot add inverse constraint 'Self.A: ~Copyable' on generic parameter 'Self.A' defined in outer scope}}
19+
// expected-error@-2 {{'Self.A' required to be 'Copyable' but is marked with '~Copyable'}}
20+
21+
class Box<T: ~Copyable> {}
22+
extension Box where T: ~Copyable {}

0 commit comments

Comments
 (0)