X10
  1. X10
  2. XTENLANG-741

X10 should catch ambiguous methods better

    Details

    • Number of attachments :
      1

      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

          Activity

          Hide
          David Grove added a comment -

          bulk defer to 2.3.2

          Show
          David Grove added a comment - bulk defer to 2.3.2
          Hide
          David Grove added a comment -

          bulk defer to 2.4.1.

          Show
          David Grove added a comment - bulk defer to 2.4.1.
          Hide
          David Grove added a comment -

          bulk defer to 2.4.2

          Show
          David Grove added a comment - bulk defer to 2.4.2
          Hide
          David Grove added a comment -

          bulk defer to 2.4.3

          Show
          David Grove added a comment - bulk defer to 2.4.3
          Hide
          David Grove added a comment -

          bulk defer to 2.4.4

          Show
          David Grove added a comment - bulk defer to 2.4.4

            People

            • Assignee:
              Unassigned
              Reporter:
              Bard Bloom
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Time Tracking

                Estimated:
                Original Estimate - 4 days
                4d
                Remaining:
                Remaining Estimate - 4 days
                4d
                Logged:
                Time Spent - Not Specified
                Not Specified