Dlaczego ten kod rzuca wyjątek?Wyjątek w scali podczas definiowania własnej metody INN
val x = new { def toInt(n: Int) = n*2 }
x.toInt(2)
scala.tools.nsc.symtab.Types$TypeError: too many arguments for method toInteger: (x$1: java.lang.Object)java.lang.Integer
at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:298)
at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:207)
at scala.tools.nsc.typechecker.Infer$Inferencer.errorTree(Infer.scala:211)
at scala.tools.nsc.typechecker.Typers$Typer.tryNamesDefaults$1(Typers.scala:2350)
...
Używam Scala 2.9.1.final
Ponieważ jest to błąd kompilatora, polecam dokonywania Scala lepiej składając raport o błędzie w [problem tracker Scala] (https://issues.scala-lang.org/secure/Dashboard.jspa). – leedm777
Nie ulega awarii w 2,1 trunk. – soc