The macro in the example generates:
enum StaticMemberSwitchable {
case foo
case bar
case baz
}
var switchable: StaticMemberSwitchable {
switch id {
case Self.foo.id: return .foo
case Self.bar.id: return .bar
case Self.baz.id: return .baz
default: fatalError()
}
}
I haven't looked whether we can allow the caller to customize the names of enum StaticMemberSwitchable or var switchable, but if possible, it would be nice to help callers avoid naming collisions.