Aladdin - Scala Bugtracking
[#876] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2007-01-08 22:58:54.0
subject [contrib #278] typechecker AssertionError
code
import scala.collection.mutable.HashMap

object AssertionError extends AnyRef with Application
{
    abstract class A {}

    object A1 extends A {}

    object A2 extends A {}

    class Manager
    {
        final class B {}
    
        val map = new HashMap[A, B]
    }
    
        
    def test[T](f: => T) { f }

    test {
        val manager = new Manager

        // This line is illegal and causes a compiler crash with Scala 2.3.1
        assert(manager.map(A2) == List(manager.map(A2, A1)))
    }

}
what happened
Exception in thread "main" java.lang.AssertionError: assertion failed
	at scala.Predef$.assert(Predef.scala:76)
	at scala.tools.nsc.typechecker.Typers$Typer.stabilizeFun(Typers.scala:457)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2059)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2214)
	at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:2267)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2127)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2214)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2058)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2214)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:1291)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$49.apply(Typers.scala:1295)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$49.apply(Typers.scala:1295)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:1295)
	at scala.tools.nsc.typechecker.Typers$Typer.tryTypedArgs$0(Typers.scala:1553)
	at scala.tools.nsc.typechecker.Typers$Typer.tryTypedApply$0(Typers.scala:1586)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2067)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2214)
	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:1129)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1870)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2214)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:1291)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArgToPoly$0(Typers.scala:1371)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1380)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$58.apply(Typers.scala:1380)
	at scala.List$.map2(List.scala:277)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply(Typers.scala:1380)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2069)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2214)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2247)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1264)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$48.apply(Typers.scala:1285)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$48.apply(Typers.scala:1285)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.List$.loop$0(List.scala:248)
	at scala.List$.mapConserve(List.scala:261)
	at scala.List$.loop$0(List.scala:248)
	at scala.List$.mapConserve(List.scala:261)
	at scala.List$.loop$0(List.scala:248)
	at scala.List$.mapConserve(List.scala:261)
	at scala.List$.loop$0(List.scala:248)
	at scala.List$.mapConserve(List.scala:261)
	at scala.List$.loop$0(List.scala:248)
	at scala.List$.mapConserve(List.scala:261)
	at scala.List$.loop$0(List.scala:248)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1285)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:911)
	at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:832)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1840)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2214)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2247)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStat$0(Typers.scala:1264)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$48.apply(Typers.scala:1285)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$48.apply(Typers.scala:1285)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.List$.loop$0(List.scala:248)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1285)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1833)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2214)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2247)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$1.apply(Analyzer.scala:38)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:220)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:209)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:209)
	at scala.Iterator$class.foreach(Iterator.scala:341)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:244)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:209)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:474)
	at scala.tools.nsc.Global$Run.compile(Global.scala:545)
	at scala.tools.nsc.Main$.process(Main.scala:58)
	at scala.tools.nsc.Main$.main(Main.scala:80)
	at scala.tools.nsc.Main.main(Main.scala)
what expected Compiler error report instead of crash. With a small change to the source (removing the word assert, or replacing class Manager with object manager and removing the val manager line) I receive:- error: wrong number of arguments for method apply: assert(manager.map(A2) == List(manager.map(A2, A1))) ^ one error found
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-01-08 22:59:23.0
contribution #278
Martin  edited on  2007-01-09 16:45:09.0