For example, unlike in the past, this compiles:
switch Bool() {
case true, false: break
}
But that's not based on ExpressibleByBooleanLiteral. You still need a default for other ones.
struct π§΅: Equatable, ExpressibleByBooleanLiteral {
init(booleanLiteral _: Bool) { }
}
switch true as π§΅ {
case true, false: break
default: break
}
Is it just Bool that gets the special treatment? ![]()
(Thanks to @allevato for noting that ExpressibleByBooleanLiteral doesn't actually denote that a type only has two possible values. I was just trying to express that ExpressibleByBooleanLiteral is the only protocol that Bool adopts which looked at all to me like something that might be a possibility for supporting the behavior. Nope!)