Aladdin - Scala Bugtracking
[#563] project: compiler priority: low category: bug
submitter assigned to status date submitted
Iulian Martin fixed 2006-04-03 10:57:51.0
subject [contrib #118] fails with StackOverflowError
code
object Test {
    def map[A,R](a : List[A], f : A => R) : List[R] = a.map(f);
    
    def split(sn : Iterable[List[Cell[int]]]) : unit =
        for (val n <- sn)
            map(n,ptr => new Cell(ptr.elem));
}
what happened
Compiler sits there for a *long* time, then spits out a stack trace, beginning with
Exception in thread "main" java.lang.StackOverflowError
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser.traverse(Trees.scala:1126)
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser.traverse(Trees.scala:1128)
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser.traverse(Trees.scala:1108)
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser.traverse(Trees.scala:1134)
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser.traverse(Trees.scala:1128)
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser.traverse(Trees.scala:1094)
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser$$anonfun$35.apply(Trees.scala:1152)
        at scala.tools.nsc.ast.Trees$Traverser$$anonfun$35.apply(Trees.scala:1152)
        at scala.List.foreach(List.scala:681)

and followed by N (for some large N) copies of
        at scala.tools.nsc.ast.Trees$Traverser.traverseTrees(Trees.scala:1152)
        at scala.tools.nsc.ast.Trees$Traverser.traverse(Trees.scala:1128)
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser.traverse(Trees.scala:1094)
        at scala.tools.nsc.ast.Trees$posAssigner$.traverse(Trees.scala:1226)
        at scala.tools.nsc.ast.Trees$Traverser$$anonfun$35.apply(Trees.scala:1152)
        at scala.tools.nsc.ast.Trees$Traverser$$anonfun$35.apply(Trees.scala:1152)
        at scala.List.foreach(List.scala:681)
what expected Either successful compilation, or an error message.
[back to overview]
Changes of this bug report
Iulian  edited on  2006-04-03 15:13:57.0
Taken from the contributions.
Martin  edited on  2006-04-04 14:17:34.0
Martin  edited on  2006-04-05 15:48:16.0