Aladdin - Scala Bugtracking
[#271] project: compiler priority: low category: bug
submitter assigned to status date submitted
Erik Philippe fixed 2004-01-09 18:06:33.0
subject Repetitive method name/signature
code
object TestAny with Executable {
  Console.println(P.p((x:List[Any])=>true));
}
object P {
  def p(f:Tuple2[Boolean,Boolean] => Boolean) = 1;
  def p(f:List[Any] => Boolean) = 2;
}
what happened
scala -classpath ./classes TestAny

Exception in thread "main" java.lang.ClassFormatError: P$ (Repetitive method name/signature)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at TestAny$.(TestAny.scala:2)
        at TestAny$.(TestAny.scala)
        at TestAny.main(TestAny.scala)
what expected A nice printout of the digit 2.
[back to overview]
Changes of this bug report
Erik  edited on  2004-01-09 18:10:33.0
This bug came up when I was trying to track down a strange behaviour that led me to belive that the code above would print 1 instead of 2. (Using QuickCheck (not yet checked in) with a List[Any] I got a Tuple2[Boolean,Boolean] instead.)
Michel  edited on  2004-02-03 07:45:48.0
Another one refiled to Philippe, as this is the well-known problem of Erasure not detecting that the type of both p functions erase to the same thing.
Philippe  edited on  2004-03-24 12:45:12.0
Added a missing nextPhas/prevPhase in erasure. The compiler now signals an error because two method have the same erasure.