Aladdin - Scala Bugtracking
[#663] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin fixed 2006-07-17 13:26:16.0
subject compiler crash after type error reported
code
package test;
trait Test {
  type Matchable <: Node with MatchableImpl;
  trait MatchableImpl extends NodeImpl {
    def asMatch(node : Matchable) : Any;
  }
  type Node <: NodeImpl;
  trait NodeImpl;
  trait CoreIfImpl extends MatchableImpl {
    // NO_CRASH: def asMatch(m : Matchable) = {
    def asMatch(m : Node) : Any = {
      if (m.isInstanceOf[MatchableImpl]) {
        null;
      } else null;
      // NO_CRASH: null;
    }
  }
}
what happened
test/Test.scala:11 error: name clash between defined and inherited member:
method asMatch:(Test.this.Node)scala.Any and
method asMatch:(Test.this.Matchable)scala.Any in trait MatchableImpl
have same type after erasure: (test.Test#NodeImpl)java.lang.Object
    def asMatch(m : Node) : Any = {
    ^
Exception in thread "main" java.lang.AssertionError: assertion failed: class Test
        at scala.Predef$.assert(Predef.scala:182)
        at scala.tools.nsc.Global$Run.scala$tools$nsc$Global$Run$$resetPackageClass(Global.scala:537)
        at scala.tools.nsc.Global$Run$$anonfun$5.apply(Global.scala:494)
        at scala.tools.nsc.Global$Run$$anonfun$5.apply(Global.scala:494)
        at scala.Iterator$class.foreach(Iterator.scala:304)
        at scala.collection.mutable.DefaultMapModel$$anon$0.foreach(DefaultMapModel.scala:41)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:494)
        at scala.tools.nsc.Global$Run.compile(Global.scala:531)
        at scala.tools.nsc.Main$.process(Main.scala:76)
        at scala.tools.nsc.Main$.main(Main.scala:98)
        at scala.tools.nsc.Main.main(Main.scala)
what expected No crash even though error occurs. Note that in the IDE, errors are never reported if there is a crash....
[back to overview]
Changes of this bug report
Martin  edited on  2006-07-18 23:06:48.0