Skip to content

Commit c5ff89a

Browse files
authored
Merge pull request swiftlang#63476 from gottesmm/pr-fe1b2b5410a552e82f4eb980a03b1a28d58dfb5b
Add the test that I forgot to add in 3c976e9
2 parents 38c89bf + aaf497e commit c5ff89a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// RUN: %target-typecheck-verify-swift -enable-experimental-move-only
2+
3+
// This test validates that we do not allow for non-final classes to contain
4+
// move only fields. This is just a temporary measure.
5+
6+
@_moveOnly
7+
struct S {
8+
var i: Int = 5
9+
}
10+
11+
class C {
12+
var s = S() // expected-error {{non-final classes containing move only fields is not yet supported}}
13+
let s1 = S() // expected-error {{non-final classes containing move only fields is not yet supported}}
14+
var s2: S // expected-error {{non-final classes containing move only fields is not yet supported}}
15+
let s3: S // expected-error {{non-final classes containing move only fields is not yet supported}}
16+
17+
init() {
18+
s2 = S()
19+
s3 = S()
20+
}
21+
}
22+
23+
final class C2 {
24+
var s = S()
25+
let s1 = S()
26+
var s2: S
27+
let s3: S
28+
29+
init() {
30+
s2 = S()
31+
s3 = S()
32+
}
33+
}

0 commit comments

Comments
 (0)