I have this pattern match that matches only on Byte values but when I add the @switch
it says:
could not emit switch to @switch annotated match
What am I missing here?
Just FYI, what I have tried already and did not work:
public static final byte
fields (I have also tried making them int
instead of byte
)final val
at the Scala Message
companion object@inline
at the companion objectI'm definitely lost here.
The answer as provided at the scala-user forum was making the vals final and removing the Byte
annotation:
object Message {
final val Authentication = 'R'
final val BackendKeyData = 'K'
final val Bind = 'B'
final val BindComplete = '2'
}
Now the @switch
correctly generates a lookupswitch
(it doesn't generate a tableswitch
but it's good enough).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With