Aladdin - Scala Bugtracking
[#853] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Iulian fixed 2006-11-30 12:13:23.0
subject Another crash around protected, packages, and traits
code
// Two files
// nsc/HasNSC.scala
package nsc;
class Global {
  abstract class Tree;
}
trait HasNSC {
  trait GlobalExt extends Global;
  val nsc : GlobalExt;
  import nsc._;
  protected def doTyped(tree : Tree): Tree = tree;
  def mkTree : Tree;
  doTyped(mkTree);
}
// scalax/ScalaTyperXXX.scala
package scalax;
trait ScalaTyperXXX extends nsc.HasNSC {
  val nsc : GlobalExt;
  import nsc._;
  trait XXX {
    def foo(tree : Tree) = doTyped(tree);
  }
}
what happened
sean-mcdirmid:~/workspace/test39/src mcdirmid$ ../../scala/build/quick/bin/scalac -sourcepath . -d ../bin/ \
scalax/ScalaTyperXXX.scala 
Exception in thread "main" scala.tools.nsc.symtab.Types$TypeError: type mismatch;
found   : ScalaTyperXXX.this.nsc.Tree
required: x$1.nsc.Tree
	at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:252)
	at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:245)
	at scala.tools.nsc.typechecker.Infer$Inferencer.typeError(Infer.scala:254)
	at scala.tools.nsc.typechecker.Infer$Inferencer.typeErrorTree(Infer.scala:263)
	at scala.tools.nsc.typechecker.Typers$Typer.adapt(Typers.scala:653)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2227)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:1291)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$52.apply(Typers.scala:1308)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$52.apply(Typers.scala:1308)
	at scala.List$.map2(List.scala:277)
	at scala.tools.nsc.typechecker.Typers$Typer.typedArgs(Typers.scala:1308)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply(Typers.scala:1343)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2080)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2225)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2268)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:2307)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:1059)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1857)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2225)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2257)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.makeAccessor(SuperAccessors.scala:204)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:91)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:145)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1095)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1094)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1202)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.atOwner(SuperAccessors.scala:156)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1093)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:151)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1180)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1180)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala:1180)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$6.apply(SuperAccessors.scala:73)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$6.apply(SuperAccessors.scala:73)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1202)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.atOwner(SuperAccessors.scala:156)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:73)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1182)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$17.apply(Trees.scala:1082)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$17.apply(Trees.scala:1081)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1202)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.atOwner(SuperAccessors.scala:156)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1080)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:63)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1180)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1180)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala:1180)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$6.apply(SuperAccessors.scala:73)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$6.apply(SuperAccessors.scala:73)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1202)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.atOwner(SuperAccessors.scala:156)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:73)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1182)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$17.apply(Trees.scala:1082)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$17.apply(Trees.scala:1081)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1202)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.atOwner(SuperAccessors.scala:156)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1080)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:63)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1194)
	at scala.List$.loop$0(List.scala:244)
	at scala.List$.mapConserve(List.scala:261)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1194)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1077)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1077)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1202)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:33)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:27)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.atOwner(SuperAccessors.scala:156)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1076)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:151)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1197)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	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:475)
	at scala.tools.nsc.Global$Run.compile(Global.scala:547)
	at scala.tools.nsc.Main$.process(Main.scala:74)
	at scala.tools.nsc.Main$.main(Main.scala:96)
	at scala.tools.nsc.Main.main(Main.scala)
what expected I have to train myself to stop using protected :)
[back to overview]
Changes of this bug report
Martin  edited on  2006-12-01 18:42:40.0
reassigned to Iulian since it involved protected accessors.
Iulian  edited on  2006-12-12 12:06:36.0