Skip to content

Commit 67cd809

Browse files
committed
Revert "Revert "add more tests""
This reverts commit 4250d7f.
1 parent 1da9215 commit 67cd809

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/Sema/option-set-empty.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,24 @@ struct SomeOptions: OptionSet {
77
static let some = MyOptions(rawValue: 4)
88
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=([])}}
99
static var otherVal = SomeOptions(rawValue: 0)
10+
let option = MyOptions(float: Float.infinity)
1011
}
1112

1213
struct MyOptions: OptionSet {
1314
let rawValue: Int
1415

16+
init(rawValue: Int) {
17+
self.rawValue = rawValue
18+
}
19+
20+
init(float: Float) {
21+
self.rawValue = float.exponent
22+
}
23+
1524
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=([])}}
1625
static var nothing = MyOptions(rawValue: 0)
1726
static let nope = MyOptions()
1827
static let other = SomeOptions(rawValue: 8)
28+
static let piVal = MyOptions(float: Float.pi)
29+
static let zero = MyOptions(float: 0.0)
1930
}

0 commit comments

Comments
 (0)