Skip to content

Commit 72df1fc

Browse files
authored
Merge pull request #65873 from kavon/more-test-coverage-without-copyable
add even more test coverage for parsing `~Copyable`
2 parents 5b5b55f + 0f6a0ed commit 72df1fc

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

test/Parse/without_copyable.swift

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,19 @@ func takeNoncopyableGeneric<T: ~Copyable>(_ t: T) {} // expected-error {{expecte
4141
~Copyable // expected-note {{attribute already specified here}}
4242
{}
4343

44-
// basic test to ensure it's viewed as a noncopyable struct:
45-
struct HasADeinit: ~Copyable {
46-
deinit {}
44+
// basic tests to ensure it's viewed as a noncopyable struct, by using
45+
// capabilities only available to them
46+
struct HasADeinit: ~Copyable { deinit {} }
47+
48+
public struct MoveOnlyS1<T> : ~Copyable { deinit {} }
49+
public struct MoveOnlyS2<T: Equatable> : ~Copyable { deinit {} }
50+
51+
public enum MoveOnlyE1<T> : ~Copyable {
52+
case holding(s: MoveOnlyS1<T>)
53+
consuming func x() {}
54+
}
55+
56+
public enum MoveOnlyE2<T: Equatable> : ~Copyable {
57+
case holding(s: MoveOnlyS1<T>)
58+
consuming func x() {}
4759
}

0 commit comments

Comments
 (0)