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
@som-snytt said:
s/wrong number of args/too many args/
You get an error if there are not enough args, since the varargs don't align. That is true in general.
The Elem object serves as an extractor for Nodes, which have no notion of minimizeEmpty.
(That extractor tripped someone else up recently, so maybe that's a design issue.)
It might make a nice Abide rule to warn about this sort of thing.
Or maybe a compiler lint option to warn about "splitting" a varargs. Is that a general issue? Maybe only when mixing args and varargs.
scala>valr="(a*)(b*)(c*)".r
r: scala.util.matching.Regex= (a*)(b*)(c*)
scala>"abc"match { case r(as, rest @_*) => as } // dangerous?
res5:String= a
scala>"abc"match { case r(as, _, _) => as }
res6:String= a
There is no compilation error with wrong number of arguments for
xml.Elem
:Method
unapplySeq
returnsOption[(String, String, scala.xml.MetaData, scala.xml.NamespaceBinding, Seq[scala.xml.Node])]
.It should be called
unapply
to produce a compilation error:See this SO question for error case. http://stackoverflow.com/q/17357359/406435
The text was updated successfully, but these errors were encountered: