File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
test/Interop/SwiftToCxx/stdlib/optional Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ This status table describes which of the following Swift language features have
163
163
| Copy and destroy semantics | Yes |
164
164
| Creation | Yes |
165
165
| Enums with associated values | Partially: only support structs and enums |
166
- | Enums with raw values | No |
166
+ | Enums with raw values | Yes |
167
167
| Indirect enums | No |
168
168
169
169
** Class types**
Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ public struct SmallStruct {
19
19
public let x: Int16
20
20
}
21
21
22
+ @_expose(Cxx)
23
+ public enum RawEnum: Int16 {
24
+ case first = 1
25
+ case second = 3
26
+ }
27
+
22
28
@_expose(Cxx)
23
29
public class Klass {
24
30
public let x: Int16
@@ -114,5 +120,14 @@ int main() {
114
120
// CHECK-NEXT: Optional(UseOptional.Klass)
115
121
// CHECK-NEXT: nil
116
122
// CHECK-NEXT: deinit-Klass
123
+
124
+ {
125
+ auto val = RawEnum::init (1 );
126
+ assert (val.isSome ());
127
+ assert (val.getUnsafelyUnwrapped () == RawEnum::first);
128
+ assert (val.getUnsafelyUnwrapped ().getRawValue () == 1 );
129
+ auto val2 = RawEnum::init (2 );
130
+ assert (val2.isNone ());
131
+ }
117
132
return 0 ;
118
133
}
You can’t perform that action at this time.
0 commit comments