X10
  1. X10
  2. XTENLANG-2734

'query residue' should be rephrased

    Details

    • Number of attachments :
      0

      Description

      When I compile:

      public class gorb {
        public static def main(argv:Array[String](1)) {
        val b : Array[Int] = [3 as Int, 3];
        b(2) = 1;
        }
      }
      

      I get the error message:

      x10c -STATIC_CHECKS gorb.x10 
      /Users/bard/x10/tmp/gorb.x10:4: Cannot assign expression to array element of given type.    
           	 Expression: 1    
           	 Type: x10.lang.Int{self==1}    
           	 Array element: b(2)    
           	 Type: x10.lang.Int    
           	 Cause: Call invalid; calling environment does not entail the method guard.    
           	 arg types:[x10.lang.Int{self==2}, x10.lang.Int{self==1}]    
           	 query residue: {b.rank==1}
      1 error.
      ~/x10/tmp: 
      

      Which confused me greatly. The message talks about an 'expression' and an
      'array element', so I looked at the things labelled 'expression' and 'array
      element', which made me think that I couldn't assign an Int{self==1} to
      an array of Int somehow.

      Actually, the problem somewhat explained by the 'Cause', and more by the
      'query residue', which, translated to English, say that b is not known to
      be a one-dimensional array so we can't necessarily make the call b(1).
      ('query residue' is a fine technical term, but not a very good explanation for
      most users.)

      This error message, while it does have all the information, is sufficiently
      perplexing so that I couldn't figure it out at first or even at third reading.

      Here's a way to rephrase it which might be more helpful. It's pretty much the
      same information (except that I want to show the whole guard as well as the
      residue, and maybe the method signature too), but the cause and important info
      comes first, the 'query residue' has been renamed, and the important stuff has
      been separated from other helpful details.

      Oh, and giving the calling environment would probably be good too, but I don't
      know exactly what that is (and if it's too big, it wouldn't be helpful).

      x10c -STATIC_CHECKS gorb.x10 
      /Users/bard/x10/tmp/gorb.x10:4: Ill-typed array assignment operation
          Cause: Call invalid; calling environment does not entail the method guard.    
               Method Guard: {b.rank==1}
               What is missing: {b.rank==1}
               Method: Array[T] { operator this(i0:int){rank==1}:T }
          Other Facts About The Operation: 
           	 Expression: 1    
           	 Type: x10.lang.Int{self==1}    
           	 Array element: b(2)    
           	 Type: x10.lang.Int    
           	 arg types:[x10.lang.Int{self==2}, x10.lang.Int{self==1}]    
      
      1 error.
      ~/x10/tmp: 
      

        Activity

        Hide
        Bard Bloom added a comment -

        BTW, now that I know better what's going on, having the query residue there is very helpful. It will help a lot to make sense out of some errors that had been painful and complicated.

        Show
        Bard Bloom added a comment - BTW, now that I know better what's going on, having the query residue there is very helpful. It will help a lot to make sense out of some errors that had been painful and complicated.
        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 -

        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: