Aladdin - Scala Bugtracking
[#1237] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2007-07-23 10:51:02.0
subject [contrib #713] object extending trait dies at runtime
code
class HelloWorld {  
def main(args: Array[String]) { 

object TypeBool;

trait Fct
  {
   def g(x : int) = TypeBool // breaks.

//    def g(x : int) = 3 // fine.
  };

case object True extends Fct;

True;

}
}

what happened
Exception in thread "main" scala.tools.nsc.symtab.Types$TypeError: value  is not a member of Fct$class$0
        at scala.tools.nsc.typechecker.Contexts$Context.error(Contexts.scala:283)
        at scala.tools.nsc.typechecker.Infer$Inferencer.error(Infer.scala:218)
        at scala.tools.nsc.typechecker.Typers$Typer.typedSelect$0(Typers.scala:2321)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2730)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2812)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$100.apply(Typers.scala:2157)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$100.apply(Typers.scala:2157)
        at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:550)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$0(Typers.scala:2157)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:2708)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2812)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:2845)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.outerSelect(ExplicitOuter.scala:173)
        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.outerValue(ExplicitOuter.scala:167)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.memberRef(LambdaLift.scala:296)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.postTransform(LambdaLift.scala:379)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1277)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1222)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1221)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1333)
        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.ast.Trees$Transformer.transform(Trees.scala:1220)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply(Trees.scala:1327)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply(Trees.scala:1325)
        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.ast.Trees$Transformer.transformStats(Trees.scala:1325)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:411)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1237)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransf\
ormers$TypingTransformer$$super$transform(TypingTransformers.scala:44)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$0.apply(TypingTransformers.sc\
ala:44)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$0.apply(TypingTransformers.sc\
ala:44)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1333)
        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.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1311)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1209)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1209)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1333)
        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.ast.Trees$Transformer.transform(Trees.scala:1208)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply(Trees.scala:1327)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply(Trees.scala:1325)
        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.List$.loop$0(List.scala:248)
        at scala.List$.mapConserve(List.scala:261)
        at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1325)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:411)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1239)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1222)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$24.apply(Trees.scala:1221)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1333)
        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.ast.Trees$Transformer.transform(Trees.scala:1220)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply(Trees.scala:1327)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply(Trees.scala:1325)
        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:1325)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:411)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1237)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.scala$tools$nsc$transform$TypingTransf\
ormers$TypingTransformer$$super$transform(TypingTransformers.scala:44)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$0.apply(TypingTransformers.sc\
ala:44)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer$$anonfun$0.apply(TypingTransformers.sc\
ala:44)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1333)
        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.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1311)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1209)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1209)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1333)
        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.ast.Trees$Transformer.transform(Trees.scala:1208)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply(Trees.scala:1327)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$33.apply(Trees.scala:1325)
        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:1325)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformStats(LambdaLift.scala:411)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1205)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$20.apply(Trees.scala:1205)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1333)
        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.ast.Trees$Transformer.transform(Trees.scala:1204)
        at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)\

        at scala.tools.nsc.transform.ExplicitOuter$OuterPathTransformer.transform(ExplicitOuter.scala:205)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transform(LambdaLift.scala:397)
        at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1328)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.scala$tools$nsc$transform$LambdaLift$LambdaLifter$$\
super$transformUnit(LambdaLift.scala:416)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter$$anonfun$15.apply(LambdaLift.scala:416)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter$$anonfun$15.apply(LambdaLift.scala:416)
        at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:85)
        at scala.tools.nsc.transform.LambdaLift$LambdaLifter.transformUnit(LambdaLift.scala:416)
        at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:258)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:247)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:247)
        at scala.Iterator$class.foreach(Iterator.scala:375)
        at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:255)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:247)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:542)
        at scala.tools.nsc.Global$Run.compile(Global.scala:623)
        at scala.tools.nsc.Main$.process(Main.scala:86)
        at scala.tools.nsc.Main$.main(Main.scala:107)
        at scala.tools.nsc.Main.main(Main.scala)
what expected no output, successful run
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-07-23 10:51:14.0
Iulian  edited on  2007-07-23 17:13:47.0
It seems 'object True' gets the TypeBool object twice: once from the outer class and once mixed in through trait Fct. I changed the top level object to be a class; now the compiler crashes early, during lambda lifting (I updated the stack trace).
Martin  edited on  2007-07-25 17:28:23.0