Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: X10 2.0.0
-
Fix Version/s: X10 2.3.2
-
Labels:None
-
Number of attachments :
Description
Look at the class Boom[X,Y]. It's got two methods with the same name, distinguised by argument type: one for X, one for Y.
Look at the main program, where X == Y == Int.
X10 ought to detect this. It doesn't. Java does.
public class Crasher { public static def main(argv:Rail[String]) { val b:Boom[Int,Int]! = new Boom[Int,Int](); x10.io.Console.OUT.println("b.boom(1) = " + b.boom(1)); } } class Boom[X,Y] { def boom(x:X) = 1; def boom(y:Y) = 2; }
Compiler output:
x10c: ----------
1. ERROR in /Users/bard/x10/exper/Crasher.java (at line 80)
java.lang.String.valueOf((b).boom(1)));
^^^^
The method boom(int) is undefined for the type Boom<Integer,Integer>
----------
2. ERROR in /Users/bard/x10/exper/Crasher.java (at line 125)
boom(
final X x){
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Method boom(X) has the same erasure boom(Object) as another method in type Boom<X,Y>
----------
3. ERROR in /Users/bard/x10/exper/Crasher.java (at line 135)
boom(
final Y y){
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Method boom(Y) has the same erasure boom(Object) as another method in type Boom<X,Y>
----------
3 problems (3 errors)
Issue Links
- depends upon
-
XTENLANG-978
Inheriting two instantiations of the same method?
-
- is related to
-
XTENLANG-978
Inheriting two instantiations of the same method?
-
- relates to
-
XTENLANG-547
Front-end fails to reject method overloading on constrained types (place types)
-
This should be caught when one tries to instantiate Boom[Int,Int], not when Boom is defined.