X10
  1. X10
  2. XTENLANG-2759

"No valid constructor" message occurs when it's not evident that X10 is even looking for a constructor

    Details

    • Number of attachments :
      0

      Description

      import x10.compiler.*;
      class Dood {
        static class IDed {
          protected static val counts = [0 as Int,0];
          val id: Float;
          public def this(kind:Int) {
             this.id = this.count(kind);
          }
          @NoThisAccess def count(kind:Int) : Float = ++counts(kind % 2);
          public def toString() = "#" + id;
        }
        static class SubIDed extends IDed {
          protected static val subcounts = [0 as Int, 0, 0];
          @NoThisAccess
          def count(kind:Int) : Float {
             val subcount <: Int = ++subcounts(kind % 3);
             // No super-access, so we end up replicating code (or something)
             val supercount <: Float = ++counts(kind % 2);
             return  supercount + 1.0f / subcount;
          }
        }
        static def main(Array[String]){
          for(k in 1..10) {
             val id <: IDed = new IDed(k);
             Console.OUT.println("k=" + k + "; id=" + id);
          }
        }
      }
      
      

      The error message here is:

      /Users/bard/x10/tmp/Dood.x10:12: No valid constructor found for Dood.IDed().
      1 error.
      

      A better error message might point out that some auto-generated code
      (the SubIDed ctor) is trying to call some other auto-generated code
      which isn't there. This is an admittedly tricky situation to explain in a
      pithy one-line error message, but we might do better with:

      /Users/bard/x10/tmp/Dood.x10:12: Automatically generated constructor Dood.SubIDed()
      calls super(), but the superclass Dood.IDed does not have a constructor that 
      matches this call.
      

        Activity

        Hide
        David Grove added a comment -

        bulk defer of open issues to 2.2.2.

        Show
        David Grove added a comment - bulk defer of open issues to 2.2.2.
        Hide
        David Grove added a comment -

        bulk defer of issues to 2.2.3.

        Show
        David Grove added a comment - bulk defer of issues to 2.2.3.
        Hide
        David Grove added a comment -

        bulk defer of 2.3.0 open issues to 2.3.1.

        Show
        David Grove added a comment - bulk defer of 2.3.0 open issues to 2.3.1.
        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 -

        defer to 2.4.2

        Show
        David Grove added a comment - 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
        Hide
        David Grove added a comment -

        bulk defer to 2.5.2

        Show
        David Grove added a comment - bulk defer to 2.5.2

          People

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

            Dates

            • Created:
              Updated: