File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,24 @@ struct SomeOptions: OptionSet {
7
7
static let some = MyOptions ( rawValue: 4 )
8
8
static let empty = SomeOptions ( rawValue: 0 ) // expected-warning {{static property 'empty' produces an empty option set}} expected-note {{use [] to silence this warning}}{{35-48=([])}}
9
9
static var otherVal = SomeOptions ( rawValue: 0 )
10
+ let option = MyOptions ( float: Float . infinity)
10
11
}
11
12
12
13
struct MyOptions : OptionSet {
13
14
let rawValue : Int
14
15
16
+ init ( rawValue: Int ) {
17
+ self . rawValue = rawValue
18
+ }
19
+
20
+ init ( float: Float ) {
21
+ self . rawValue = float. exponent
22
+ }
23
+
15
24
static let none = MyOptions ( rawValue: 0 ) // expected-warning {{static property 'none' produces an empty option set}} expected-note {{use [] to silence this warning}}{{32-45=([])}}
16
25
static var nothing = MyOptions ( rawValue: 0 )
17
26
static let nope = MyOptions ( )
18
27
static let other = SomeOptions ( rawValue: 8 )
28
+ static let piVal = MyOptions ( float: Float . pi)
29
+ static let zero = MyOptions ( float: 0.0 )
19
30
}
You can’t perform that action at this time.
0 commit comments