Skip to content

Commit eec6176

Browse files
authored
Merge pull request #64160 from kavon/test-deserialization-error-moveonly
[move-only] add addtl coverage for when the moveonly type is not used during import
2 parents 2c49700 + da3f2e2 commit eec6176

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

test/Serialization/Inputs/moveonly_deinit.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ public enum MoveOnlyEnum {
1717

1818
deinit { }
1919
}
20+
21+
public struct NormalStruct {
22+
private let desc: Int
23+
24+
public init(desc: Int) {
25+
self.desc = desc
26+
}
27+
}
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// RUN: %empty-directory(%t)
22
// TODO: re-enable the simplification passes once rdar://104875010 is fixed
33
// RUN: %target-swift-frontend -Xllvm -sil-disable-pass=simplification -emit-module -o %t/Library.swiftmodule -module-name Library %S/Inputs/moveonly_deinit.swift -enable-experimental-move-only
4-
// RUN: not %target-swift-frontend -I %t %s -emit-sil -o /dev/null 2>&1 | %FileCheck %s
4+
// RUN: not %target-swift-frontend -DUSE_MOVEONLY_TYPE -I %t %s -emit-sil -o /dev/null 2>&1 | %FileCheck %s
5+
// RUN: %target-swift-frontend -I %t %s -emit-sil -verify -o /dev/null
56

67
// This test makes sure that if we import a move only type and do not set the
78
// experimental move only flag, we get a nice error.
@@ -10,5 +11,8 @@ import Library
1011

1112
// CHECK: error: Can not import module 'Library' that uses move only features when experimental move only is disabled! Pass the frontend flag -enable-experimental-move-only to swift to enable the usage of this language feature
1213

13-
func f(_ k: MoveOnlyStruct) {
14-
}
14+
#if USE_MOVEONLY_TYPE
15+
func f(_ k: MoveOnlyStruct) {}
16+
#endif
17+
18+
func g(_ k: NormalStruct) {}

0 commit comments

Comments
 (0)