sjavora
(Šimon Javora)
1
The documentation for OptionSet states that
The rawValue property must be of a type that conforms to the FixedWidthInteger protocol, such as Int or UInt8.
But this is seemingly not enforced:
public protocol OptionSet : SetAlgebra, RawRepresentable {
Is this an oversight, or is there some deeper implementation reason that I don't understand? As far as I can tell, the type could be declared as
public protocol OptionSet : SetAlgebra, RawRepresentable where RawValue: FixedWidthInteger {
2 Likes
nnnnnnnn
(Nate Cook)
2
That's an oversight, thanks!
4 Likes
I think there was a different hidden constraint before the where clause feature landed, no? That‘s why there is still a extension like extension OptionSet where RawValue : FixedWidthInteger. So the missing constraint is just a historical oversight.