-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Description
The following line leads to to a compiler crash:
def v = new ({ def a=0 })results in:
Welcome to Scala version 2.8.0.r22407-b20100628154216 (Java HotSpot(TM) Server VM, Java 1.5.0_22).
Type in expressions to have them evaluated.
Type :help for more information.
scala> def v = new ({ def a=0 })
<console>:5: error: class type required but AnyRef{def a: <?>} found
def v = new ({ def a=0 })
^
Exception in thread "main" scala.tools.nsc.symtab.Types$$TypeError: only declarations allowed here
at scala.tools.nsc.typechecker.Contexts$$Context.error(Contexts.scala:273)
at scala.tools.nsc.typechecker.Infer$$Inferencer.error(Infer.scala:213)
at scala.tools.nsc.typechecker.Infer$$Inferencer.errorTree(Infer.scala:217)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:2050)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$20.apply(Typers.scala:2135)
at scala.collection.immutable.List.loop$$1(List.scala:115)
at scala.collection.immutable.List.mapConserve(List.scala:132)
at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:2135)
at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$typedRefinement$$1.apply$$mcV$$sp(Typers.scala:2030)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$apply$$1.apply(Analyzer.scala:87)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$apply$$1.apply(Analyzer.scala:87)
at scala.collection.LinearSeqOptimized$$class.foreach(LinearSeqOptimized.scala:61)
at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.generic.TraversableForwarder$$class.foreach(TraversableForwarder.scala:44)
at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:42)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.apply(Analyzer.scala:87)
at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply$$mcV$$sp(Global.scala:278)
at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:278)
at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$applyPhase$$1.apply(Global.scala:278)
at scala.tools.nsc.reporters.Reporter.withSource(Reporter.scala:48)
at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:278)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$run$$1.apply(Analyzer.scala:80)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3$$$$anonfun$$run$$1.apply(Analyzer.scala:80)
at scala.collection.Iterator$$class.foreach(Iterator.scala:631)
at scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:304)
at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$3.run(Analyzer.scala:80)
at scala.tools.nsc.Global$$Run.compileSources(Global.scala:735)Metadata
Metadata
Assignees
Labels
No labels