File tree Expand file tree Collapse file tree 3 files changed +35
-16
lines changed Expand file tree Collapse file tree 3 files changed +35
-16
lines changed Original file line number Diff line number Diff line change
1
+ public enum SwiftCoin : ~ Copyable {
2
+ case penny
3
+ case nickel
1
4
2
- public class Message { var s : String = " hello " }
3
-
4
- public struct FileDescriptor : ~ Copyable {
5
- public var x : Int = 0
6
- public var msg : Message = Message ( )
5
+ init ( ) { self = . penny }
7
6
}
8
7
9
- public class FileHandle {
10
- var file : FileDescriptor = FileDescriptor ( )
8
+ // ensures old attribute still works.
9
+ @_moveOnly public enum ObjCCoin {
10
+ case penny
11
+ case nickel
12
+
13
+ init ( ) { self = . penny }
11
14
}
12
15
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // RUN: %empty-directory(%t)
2
+ // RUN: %target-swift-frontend -enable-library-evolution -module-name Hello -emit-module -o %t/Hello.swiftmodule -emit-module-interface-path %t/Hello.swiftinterface %S/Inputs/moveonly_simple.swift -swift-version 5
3
+ // RUN: %FileCheck %s < %t/Hello.swiftinterface
4
+ // RUN: %target-swift-frontend -emit-sil -verify -I %t %s -swift-version 5
5
+
6
+ import Hello
7
+
8
+ // CHECK: #if compiler(>=5.3) && $MoveOnly
9
+ // CHECK-NEXT: public enum SwiftCoin : ~Swift.Copyable {
10
+
11
+ // CHECK: #if compiler(>=5.3) && $MoveOnly
12
+ // CHECK-NEXT: @_moveOnly public enum ObjCCoin {
13
+
14
+ func eat( _ c: consuming SwiftCoin ) { }
15
+ func eat( _ c: consuming ObjCCoin ) { }
16
+
17
+ public func ensureItIsNonCopyable( _ c: consuming SwiftCoin ) { // expected-error {{'c' consumed more than once}}
18
+ eat ( c) // expected-note {{consuming use here}}
19
+ eat ( c) // expected-note {{consuming use here}}
20
+ }
21
+
22
+ public func ensureItIsNonCopyable( _ c: consuming ObjCCoin ) { // expected-error {{'c' consumed more than once}}
23
+ eat ( c) // expected-note {{consuming use here}}
24
+ eat ( c) // expected-note {{consuming use here}}
25
+ }
You can’t perform that action at this time.
0 commit comments