Aladdin - Scala Bugtracking
[#1075] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2007-05-01 12:43:35.0
subject [contrib #447] Assertion in scalac
code
class Directory(var dir_ : String)
{
  if (!dir_.startsWith("/")) {
    throw new RuntimeException("Invalid directory")
  }
  dir_ = dir_.replaceAll("/{2,}", "/")

  def this(serialized : Array[byte]) = {
    this(new String(serialized, "UTF-8"))
  }

  def dir = dir_
}
what happened
Get this stack trace:

$ scalac -version
Scala compiler version 2.4.0-final -- (c) 2002-2007 LAMP/EPFL
$ scalac test.scala
Exception in thread "main" java.lang.AssertionError: assertion failed: dir__$eq not in List(value dir_)
        at scala.Predef$.assert(Predef.scala:89)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer.parameterNamed$0(Constructors.scala:57)\

        at scala.tools.nsc.transform.Constructors$ConstructorTransformer.parameter$0(Constructors.scala:50)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer$$anon$0.transform(Constructors.scala:74\
)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1194)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer$$anon$0.transform(Constructors.scala:85\
)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer.intoConstructor$0(Constructors.scala:90\
)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer$$anonfun$4.apply(Constructors.scala:148\
)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer$$anonfun$4.apply(Constructors.scala:124\
)
        at scala.List.foreach(List.scala:702)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer.transformClassTemplate(Constructors.sca\
la:124)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer.transform(Constructors.scala:188)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1242)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$30.apply(Trees.scala:1240)
        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:1240)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1115)
        at scala.tools.nsc.ast.Trees$Transformer$$anonfun$16.apply(Trees.scala:1115)
        at scala.tools.nsc.ast.Trees$Transformer.atOwner(Trees.scala:1248)
        at scala.tools.nsc.ast.Trees$Transformer.transform(Trees.scala:1114)
        at scala.tools.nsc.transform.Constructors$ConstructorTransformer.transform(Constructors.scala:190)
        at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1243)        at scala.tools.nsc.trans\
form.Transform$Phase.apply(Transform.scala:30)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:231)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$2.apply(Global.scala:220)        at scala.tools.nsc.Globa\
l$GlobalPhase$$anonfun$2.apply(Global.scala:220)        at scala.Iterator$class.foreach(Iterator.scala:380)
        at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:245)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:220)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:488)
        at scala.tools.nsc.Global$Run.compile(Global.scala:562)
        at scala.tools.nsc.Main$.process(Main.scala:57)
        at scala.tools.nsc.Main$.main(Main.scala:79)
        at scala.tools.nsc.Main.main(Main.scala)
what expected
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-05-01 12:44:05.0
contribution #447
Martin  edited on  2007-05-29 19:15:42.0