Aladdin - Scala Bugtracking
[#359] project: compiler priority: high category: bug
submitter assigned to status date submitted
Martin Philippe fixed 2004-08-24 19:27:49.0
subject assertion violation in explciit outer
code
object Test {
  class C;
  def f(xs: List[C]): C = {
    g {
      xs =>
        if (false)
          f(xs)
        else {
          val a: C = null;
          val b: C = null;
          if (xs.isEmpty) a else b
        }
    }
  }
  private def g(op: List[C] => C): C =
    null;
}

what happened
Exception in thread "main" java.lang.AssertionError:
tree    : {
  val a: C[outer$0$Test$Test] = null;
  val b: C[outer$0$Test$Test] = null;
  if (xs.isEmpty())
    a
  else
     b
}
type    : C[outer$0$Test$Test]
expected: C[outer$0$Test$Test]
        at scalac.ast.TreeGen.assertTreeSubTypeOf(TreeGen.java:1154)
        at scalac.ast.TreeGen.If(TreeGen.java:751)
        at scalac.ast.TreeGen.If(TreeGen.java:771)
        at scalac.ast.GenTransformer.transform(Transformer.java:519)
        at scalac.transformer.ExplicitOuterClassesPhase$12.transform(ExplicitOu
terClassesPhase.java:497)
        at scalac.transformer.ExplicitOuterClassesPhase$12.transform(ExplicitOu
terClassesPhase.java:417)
        at scalac.ast.GenTransformer.transform(Transformer.java:595)
        at scalac.transformer.ExplicitOuterClassesPhase$12.transform(ExplicitOu
terClassesPhase.java:397)
        at scalac.ast.GenTransformer.transform(Transformer.java:600)
        at scalac.transformer.ExplicitOuterClassesPhase$12.transform(ExplicitOu
terClassesPhase.java:397)
        at scalac.ast.GenTransformer.transform(Transformer.java:595)
        at scalac.ast.GenTransformer.apply(Transformer.java:409)
        at scalac.ast.GenTransformer.apply(Transformer.java:403)
        at scalac.transformer.ExplicitOuterClassesPhase.apply(ExplicitOuterClas
sesPhase.java:73)
        at scalac.Global.compile(Global.java:386)
        at scalac.Global.compile(Global.java:356)
        at scala.tools.scalac.Main$.main1(Main.scala:42)
        at scala.tools.scalac.Main$.main(Main.scala:28)
        at scala.tools.scalac.Main.main(Main.scala:28)
what expected succesful compilation
[back to overview]
Changes of this bug report
Philippe  edited on  2004-08-25 17:06:52.0
Fixed Type.isSubType (added missing call to isSameAs in first case ThisType/SingleType).