Aladdin - Scala Bugtracking
[#1266] project: compiler priority: low category: bug
submitter assigned to status date submitted
Iulian Iulian open 2007-08-08 11:06:46.0
subject [contrib #714] compiler crash with protected members
code
// Test1.scala
package c

class MyOuter
{
    protected[c] val v = 0
    
    protected[c] def f() = ()

    protected[c] class MyInner {}
}

// Test2.scala
package c.d
// if we use package c then no error occurs

class MyClient
{
    val myInstance = new MyOuter

    myInstance.v
    myInstance.f()
    new myInstance.MyInner()
}

/*
$ scalac -version
Scala compiler version 2.5.1-final -- (c) 2002-2007 LAMP/EPFL

$ scalac Test1.scala Test2.scala


Exception in thread "main" java.util.NoSuchElementException: head of empty list
	at scala.Nil$.head(List.scala:1159)
	at scala.Nil$.head(List.scala:1156)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.accDefBuf(SuperAccessors.scala:43)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.makeAccessor(SuperAccessors.scala:208)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:129)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$29.apply(Trees.scala:1302)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$29.apply(Trees.scala:1302)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala:1302)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$6.apply(SuperAccessors.scala:74)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$6.apply(SuperAccessors.scala:74)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1326)
	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:157)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:74)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1304)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$22.apply(Trees.scala:1200)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$22.apply(Trees.scala:1200)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1326)
	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:157)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1199)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:64)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$35.apply(Trees.scala:1320)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$35.apply(Trees.scala:1318)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1318)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1326)
	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:157)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1195)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:152)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$35.apply(Trees.scala:1320)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$35.apply(Trees.scala:1318)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1318)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1326)
	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:157)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1195)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:152)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1321)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:245)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:234)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:234)
	at scala.Iterator$class.foreach(Iterator.scala:364)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:245)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:234)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:502)
	at scala.tools.nsc.Global$Run.compile(Global.scala:580)
	at scala.tools.nsc.Main$.process(Main.scala:61)
	at scala.tools.nsc.Main$.main(Main.scala:81)
	at scala.tools.nsc.Main.main(Main.scala)




If we comment out
    myInstance.v
    myInstance.f()
and retain
    new myInstance.MyInner()
a different error occurs:

Exception in thread "main" java.lang.AssertionError: assertion failed
	at scala.Predef$.assert(Predef.scala:85)
	at scala.tools.nsc.ast.Trees$DefDef.<init>(Trees.scala:332)
	at scala.tools.nsc.ast.Trees$class.DefDef(Trees.scala:338)
	at scala.tools.nsc.Global.DefDef(Global.scala:34)
	at scala.tools.nsc.ast.Trees$class.DefDef(Trees.scala:351)
	at scala.tools.nsc.Global.DefDef(Global.scala:34)
	at scala.tools.nsc.ast.Trees$class.DefDef(Trees.scala:355)
	at scala.tools.nsc.Global.DefDef(Global.scala:34)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.makeAccessor(SuperAccessors.scala:198)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:129)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1266)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:152)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1280)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:131)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:146)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$29.apply(Trees.scala:1302)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$29.apply(Trees.scala:1302)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.ast.Trees$Transformer.transformTrees(Trees.scala:1302)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$6.apply(SuperAccessors.scala:74)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer$$anonfun$6.apply(SuperAccessors.scala:74)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1326)
	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:157)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:74)
	at scala.tools.nsc.ast.Trees$Transformer.transformTemplate(Trees.scala:1304)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$22.apply(Trees.scala:1200)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$22.apply(Trees.scala:1200)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1326)
	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:157)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1199)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:64)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$35.apply(Trees.scala:1320)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$35.apply(Trees.scala:1318)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1318)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1326)
	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:157)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1195)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:152)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$35.apply(Trees.scala:1320)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$35.apply(Trees.scala:1318)
	at scala.List$.loop$0(List.scala:243)
	at scala.List$.mapConserve(List.scala:260)
	at scala.tools.nsc.ast.Trees$Transformer.transformStats(Trees.scala:1318)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer$$anonfun$21.apply(Trees.scala:1196)
	at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1326)
	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:157)
	at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1195)
	at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:46)
	at scala.tools.nsc.typechecker.SuperAccessors$SuperAccTransformer.transform(SuperAccessors.scala:152)
	at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1321)
	at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:245)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:234)
	at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:234)
	at scala.Iterator$class.foreach(Iterator.scala:364)
	at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:245)
	at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:234)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:502)
	at scala.tools.nsc.Global$Run.compile(Global.scala:580)
	at scala.tools.nsc.Main$.process(Main.scala:61)
	at scala.tools.nsc.Main$.main(Main.scala:81)
	at scala.tools.nsc.Main.main(Main.scala)

*/
what happened
stack trace during compilation
what expected successful compilation, as occurs if all code is in the one package
[back to overview]
Changes of this bug report
Iulian  edited on  2007-08-08 11:07:03.0