Aladdin - Scala Bugtracking
[#845] project: compiler priority: low category: bug
submitter assigned to status date submitted
Sean Martin fixed 2006-11-29 12:12:19.0
subject Compiler exhausts heap on bugged code
code
package test;

object Test extends Application {
  type Bar;
  trait FooImpl;

  trait Bob {
    def bar : Bar with FooImpl;
  }
  def ifn[A,B](a : A)(f : A => B) =
    if (a != null) f(a) else null;

  val bob : Bob = null;
  val bar = ifn(bob)(.bar);
  assert(bar == null);
}
what happened
sean-mcdirmid:~/workspace/test38/src mcdirmid$ ../../scala/build/quick/bin/scalac -sourcepath . -d ../bin t\
est/Test.scala
test/Test.scala:5 error: only classes can have declared but undefined members
  type Bar;
       ^
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
sean-mcdirmid:~/workspace/test38/src mcdirmid$
If Test is a trait, the crash doesn't occur.
what expected
[back to overview]
Changes of this bug report
Martin  edited on  2006-12-01 18:35:01.0