You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Protobuf enum gets generated to a class that extends ProtobufEnum, to ensure they provide name and value. But now with enhanced enums, they can be actual enums and have better switch support, namely "switch expressions", which doesn't allow exhaustiveness with the current implementation.
Currently, the ProtobufEnum class has two final fields that need to be passed to a constructor. Enhanced enums can't extend classes, but they can implement them. So enums can be generated as:
Which will then enable proper exhaustiveness checking in switch expressions, like the following:
StringgetName(MyEnum e) =>switch (e) {
MyEnum.a =>"a",
// Error: The type 'MyEnum' is not exhaustively matched by the switch cases since it doesn't match 'MyEnum.b'.
}
Currently, the only warning is just
The type 'MyEnum' is not exhaustively matched by the switch cases since it doesn't match 'MyEnum()'.
The text was updated successfully, but these errors were encountered:
A Protobuf enum gets generated to a class that extends
ProtobufEnum
, to ensure they providename
andvalue
. But now with enhanced enums, they can be actualenums
and have better switch support, namely "switch expressions", which doesn't allow exhaustiveness with the current implementation.Currently, the
ProtobufEnum
class has two final fields that need to be passed to a constructor. Enhanced enums can't extend classes, but they can implement them. So enums can be generated as:Which will then enable proper exhaustiveness checking in switch expressions, like the following:
Currently, the only warning is just
The text was updated successfully, but these errors were encountered: