If I omit the semicolon, this code doesn't compile.
def checkRadioButton(xml: DslBuilder): String => XmlTree = {
val inputs = top(xml).\\*(hasLocalNameX("input"));
{ (buttonValue: String) =>
// code omitted
}
}
My guess is that, without the semicolon, scalac thinks that the partial function is another argument to the \\* method, instead of the return value. (It isn't actually a partial function, by the way, it's a total function.)
Can I do without the semicolon here? I've never had to use a semicolon at the end of a line before in Scala.
I’d write it like this instead:
def checkRadioButton(xml: DslBuilder): String => XmlTree = {
val inputs = top(xml).\\*(hasLocalNameX("input"));
(buttonValue: String) => { // <-- changed position of {
// code omitted
}
}
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