[#135] | project: compiler | priority: high | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Erik | Martin | fixed | 2003-09-11 18:28:36.0 | |
subject | java.lang.ClassFormatError | |||
code |
import scala.collection.immutable.TreeMap; import scala.collection.immutable.Order; object Test with Executable { test1(); Console.println("OK"); val intOrder = new Order((x:int,y:int) => x < y, (x:int,y:int) => x == y); def test1() = { val myMap:TreeMap[int,String] = new TreeMap(intOrder); val map1 = myMap + 42 -> "The answer"; } } |
|||
what happened | When running this as a test (note the test file is not checked in):[lamppc35]tmp 770 >./scala/test/bin/scala-test --show-diff --run ~/scala/test/ files/run/map_test.scala Test configuration socos executable: /home/stenman/tmp/scala/bin/scalac surus executable: /home/stenman/tmp/scala/bin/scalarun scala runtime : /home/stenman/tmp/scala/classes Testing interpreter testing: /home/stenman/scala/test/files/run/map_test.scala [FAILED] 1,11c1 < Exception in thread "main" java.lang.AssertionError: scala.collection.immutabl e.TreeMap$class->scala.collection.immutable.Map.$plus < at scalai.ScalaTemplate.invoke(ScalaTemplate.java:81) < at scalai.ScalaObject.invoke(ScalaObject.java:38) < at scalai.Evaluator.invoke(Evaluator.java:228) < at scalai.Evaluator.evaluate(Evaluator.java:177) < at scalai.Evaluator.evaluate(Evaluator.java:172) < at scalai.Evaluator.evaluate(Evaluator.java:168) < at scalai.Evaluator.evaluate(Evaluator.java:141) < at Test.test1(map_test.scala:13) < at Test. |
|||
what expected | That the program would run without an error and print OK. Now there might very well be a bug in my TreeMap or Tree implementation, but in that case it looks like a problem the compiler should notice. | |||
[back to overview] |
Erik edited on 2003-09-11 18:40:30.0 |
This actualy seems to be two different bugs,
one for the jvm and one for the interpreter.
The interpreter error seems to also occur with Matthias ListMap:
import scala.collection.immutable.TreeMap; import scala.collection.immutable.ListMap; import scala.collection.immutable.Order; object Test with Executable { test2(); Console.println("OK"); val intOrder = new Order((x:int,y:int) => x < y, (x:int,y:int) => x == y); def test1() = { val myMap:TreeMap[int,String] = new TreeMap(intOrder); val map1 = myMap + 42 -> "The answer"; } def test2() = { val myMap:ListMap[int,String] = new ListMap; val map1 = myMap + 42 -> "The answer"; } } [lamppc35]tmp 772 >./scala/test/bin/scala-test --show-diff --run ~/scala/test/ files/run/map_test.scala Test configuration socos executable: /home/stenman/tmp/scala/bin/scalac surus executable: /home/stenman/tmp/scala/bin/scalarun scala runtime : /home/stenman/tmp/scala/classes Testing interpreter testing: /home/stenman/scala/test/files/run/map_test.scala [FAILED] 1,11c1 < Exception in thread "main" java.lang.AssertionError: scala.collection.immutabl e.ListMap$class->scala.collection.immutable.Map.$plus < at scalai.ScalaTemplate.invoke(ScalaTemplate.java:81) < at scalai.ScalaObject.invoke(ScalaObject.java:38) < at scalai.Evaluator.invoke(Evaluator.java:228) < at scalai.Evaluator.evaluate(Evaluator.java:177) < at scalai.Evaluator.evaluate(Evaluator.java:172) < at scalai.Evaluator.evaluate(Evaluator.java:168) < at scalai.Evaluator.evaluate(Evaluator.java:141) < at Test.test2(map_test.scala:19) < at Test. |
Matthias edited on 2003-09-12 12:51:23.0 |
Burak edited on 2003-09-23 18:24:52.0 |
change priority to high |
Philippe edited on 2003-09-30 13:12:50.0 |
Changed Type.erasure to replace all prefixes by localThisTypes. This solves a problem that affected the interpreter which could not find the implementation of some methods because their signature was wrong (prefixes were of the wrong thistypes). This problem showed up in the following test case:
class Foo {
class Bar;
def foo = new Bar;
}
object Test {
def main(args: Array[String]): Unit = {
(new Foo).foo;
()
}
}
|
Philippe edited on 2003-09-30 18:19:26.0 |
This bug needs at least the correction of bug #167, so I reassigned it to Martin. |
Philippe edited on 2003-09-30 19:02:14.0 |
Fixed bug 167. This also fixed this bug. |
Philippe edited on 2003-09-30 19:02:58.0 |
Changed bug status. |