Aladdin - Scala Bugtracking
[#1072] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin fixed 2007-04-29 05:37:41.0
subject weird unit inference/forgot semi-colon crash
code
package test;
object Test {
  trait ScannerConfiguration {
    private var tokenName = new Array[String](128)
    {
      def enterKeyword(n: String, tokenId: int) {
        (tokenId >= tokenName.length)
      }
      {}
    }
  }
}
what happened
sean-mcdirmid:~/workspace/test13/src mcdirmid$ ../../scala/build/quick/bin/scalac -d ../bin test/Test.scala\
 
test/Test.scala:4: error: illegal inheritance from final class
    private var tokenName = new Array[String](128)
                                ^
test/Test.scala:7: error: recursive method tokenName needs type
        (tokenId >= tokenName.length)
                    ^
test/Test.scala:4: error: not found: type $anon
    private var tokenName = new Array[String](128)
                            ^
Exception in thread "main" scala.MatchError: 
	at scala.tools.nsc.typechecker.Infer$Inferencer.inferMethodAlternative(Infer.scala:1169)
	at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:1491)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$90.apply(Typers.scala:1961)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$90.apply(Typers.scala:1961)
	at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:515)
	at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$0(Typers.scala:1961)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply$0(Typers.scala:2011)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2543)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2626)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2670)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:2717)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:1172)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2400)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2626)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2659)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1394)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1424)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1054)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:951)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2391)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2626)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2659)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1394)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1424)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1252)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2421)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2626)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2670)
	at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:2710)
	at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:643)
	at scala.tools.nsc.typechecker.Namers$Namer$$anon$0.complete(Namers.scala:356)
	at scala.tools.nsc.symtab.Symbols$Symbol.info(Symbols.scala:410)
	at scala.tools.nsc.symtab.Symbols$Symbol.initialize(Symbols.scala:518)
	at scala.tools.nsc.typechecker.Typers$Typer.addGetterSetter(Typers.scala:987)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$30.apply(Typers.scala:1052)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$30.apply(Typers.scala:1052)
	at scala.List.flatMap(List.scala:966)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1052)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:951)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2391)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2626)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2659)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1394)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1424)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1054)
	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:967)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2394)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2626)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2659)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1394)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1424)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1424)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2387)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2626)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2659)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$1.apply(Analyzer.scala:38)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:235)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:224)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:224)
	at scala.Iterator$class.foreach(Iterator.scala:382)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:245)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:224)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:492)
	at scala.tools.nsc.Global$Run.compile(Global.scala:566)
	at scala.tools.nsc.Main$.process(Main.scala:57)
	at scala.tools.nsc.Main$.main(Main.scala:77)
	at scala.tools.nsc.Main.main(Main.scala)
what expected
[back to overview]
Changes of this bug report
Martin  edited on  2007-04-29 15:27:21.0