यह कोड अपवाद क्यों फेंकता है?स्केल में अपवाद जब मेरी खुद की विधि को परिभाषित करता है
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)
...
मैं स्केला 2.9.1.final उपयोग कर रहा हूँ
चूंकि यह एक कंपाइलर बग है, इसलिए मैं [स्केल के मुद्दे ट्रैकर] (https://issues.scala-lang.org/secure/Dashboard.jspa) में एक बग रिपोर्ट दर्ज करके स्कैला को बेहतर बनाने की सलाह देता हूं। – leedm777
2.10 ट्रंक पर क्रैश नहीं होता है। – soc