Skip to content

Commit da3f2e2

Browse files
committed
add addtl coverage for when the moveonly type is not used
We want to ensure that the deserialization error added for this test doesn't trigger when the moveonly type is not used by the importing module. part of rdar://106262652
1 parent 6a9e9d6 commit da3f2e2

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)