Aladdin - Scala Bugtracking
[#921] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Burak fixed 2007-01-29 12:20:34.0
subject Unapply very broken in traits
code
trait Symbols {
  object ExpressionMode {
    def unapply(that : ExpressionMode) = Some(that.qualifier);
  }
  abstract class Mode;
  class ExpressionMode(val qualifier : Option[Object]) extends Mode;
  trait Foo {
    def foo(mode : Mode) = mode match {
    case ExpressionMode(Some(s : String)) => s.length;
    }
  }
}
what happened
java.lang.AssertionError: assertion failed: Trying to access the this of another class: tree.symbol = trait\
 Symbols, ctx.clazz.symbol = object Symbols$Foo$class compilation unit:Test.scala
	at scala.Predef$.assert(Predef.scala:89)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad\
(GenICode.scala:788)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadQualifier(GenICode.scala:969)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad\
(GenICode.scala:767)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genLoadQualifier(GenICode.scala:969)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad\
(GenICode.scala:767)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad\
(GenICode.scala:412)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat\
(GenICode.scala:178)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$1.apply(GenICode.scala:138)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$1.apply(GenICode.scala:137)
	at scala.List.foreach(List.scala:702)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:137)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad\
(GenICode.scala:859)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genCond(GenICode.scala:1334)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad\
(GenICode.scala:702)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genStat\
(GenICode.scala:178)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$1.apply(GenICode.scala:138)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$1.apply(GenICode.scala:137)
	at scala.List.foreach(List.scala:702)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.genStat(GenICode.scala:137)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad\
(GenICode.scala:859)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:108)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$0.apply(GenICode.scala:67)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$0.apply(GenICode.scala:66)
	at scala.List.foreach(List.scala:702)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:66)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:128)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:85)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$0.apply(GenICode.scala:67)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase$$anonfun$0.apply(GenICode.scala:66)
	at scala.List.foreach(List.scala:702)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:66)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:78)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:62)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:58)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:230)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:219)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:219)
	at scala.Iterator$class.foreach(Iterator.scala:377)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:244)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:219)
	at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:52)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:484)
	at scala.tools.nsc.Global$Run.compile(Global.scala:555)
	at ch.epfl.lamp.sdt.build.ScalaCompilerManager$ScalaCompiler.compile(ScalaCompilerManager.java:263)
	at ch.epfl.lamp.sdt.build.ScalaProjectBuilder.build(ScalaProjectBuilder.java:153)
	at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:621)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:163)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:194)
	at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:243)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246)
	at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:299)
	at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:331)
	at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:156)
	at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:222)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
what expected
[back to overview]
Changes of this bug report
Burak  edited on  2007-02-05 19:30:41.0
fixed, was missing explicitouter for first field of UnApply node.