cuelang.org/go@v0.13.0/cue/testdata/eval/incomplete.txtar (about)

     1  -- in.cue --
     2  s: string
     3  
     4  e1:  s + s
     5  e2:  >"bar" & s // okay
     6  e3:  >s & "foo" // not okay
     7  e3b: >s
     8  
     9  e4: >e1 & s
    10  e5: <e5 & s
    11  
    12  E: {
    13  	a: c - b
    14  	b: c - a
    15  	c: a+b & >=5
    16  }
    17  
    18  a:    int
    19  okay: (>10 & <a) + 3
    20  
    21  issue1837: {
    22  	// x is properly recognized as erroneous and the "message" field is added
    23  	// with the value "a", instead of as a cycle error.
    24  	p1: {
    25  		context: {}
    26  		x: context.b // incomplete error
    27  		if x == _|_ {
    28  			message: "a"
    29  		}
    30  	}
    31  	p2: {
    32  		if x == _|_ {
    33  			message: "a"
    34  		}
    35  		x: context.b // incomplete error
    36  		context: {}
    37  	}
    38  	p3: {
    39  		if x == _|_ {
    40  			message: "a"
    41  		}
    42  		context: {}
    43  		x: context.b // incomplete error
    44  	}
    45  }
    46  -- out/evalalpha/stats --
    47  Leaks:  28
    48  Freed:  0
    49  Reused: 0
    50  Allocs: 28
    51  Retain: 0
    52  
    53  Unifications: 28
    54  Conjuncts:    40
    55  Disjuncts:    0
    56  
    57  CloseIDElems: 0
    58  NumCloseIDs: 6
    59  -- diff/-out/evalalpha/stats<==>+out/eval/stats --
    60  diff old new
    61  --- old
    62  +++ new
    63  @@ -1,9 +1,12 @@
    64  -Leaks:  2
    65  -Freed:  30
    66  -Reused: 25
    67  -Allocs: 7
    68  -Retain: 80
    69  -
    70  -Unifications: 32
    71  -Conjuncts:    156
    72  -Disjuncts:    29
    73  +Leaks:  28
    74  +Freed:  0
    75  +Reused: 0
    76  +Allocs: 28
    77  +Retain: 0
    78  +
    79  +Unifications: 28
    80  +Conjuncts:    40
    81  +Disjuncts:    0
    82  +
    83  +CloseIDElems: 0
    84  +NumCloseIDs: 6
    85  -- out/eval/stats --
    86  Leaks:  2
    87  Freed:  30
    88  Reused: 25
    89  Allocs: 7
    90  Retain: 80
    91  
    92  Unifications: 32
    93  Conjuncts:    156
    94  Disjuncts:    29
    95  -- out/eval --
    96  (struct){
    97    s: (string){ string }
    98    e1: (_|_){
    99      // [incomplete] e1: non-concrete value string in operand to +:
   100      //     ./in.cue:3:6
   101      //     ./in.cue:1:4
   102    }
   103    e2: (string){ >"bar" }
   104    e3: (_|_){
   105      // [incomplete] e3: non-concrete value s for bound >:
   106      //     ./in.cue:5:7
   107    }
   108    e3b: (_|_){
   109      // [incomplete] e3b: non-concrete value s for bound >:
   110      //     ./in.cue:6:7
   111    }
   112    e4: (_|_){
   113      // [incomplete] e1: non-concrete value string in operand to +:
   114      //     ./in.cue:3:6
   115      //     ./in.cue:1:4
   116    }
   117    e5: (_|_){
   118      // [cycle] cycle error
   119    }
   120    E: (struct){
   121      a: (_|_){
   122        // [cycle] cycle error:
   123        //     ./in.cue:12:5
   124      }
   125      b: (_|_){
   126        // [cycle] cycle error:
   127        //     ./in.cue:13:5
   128      }
   129      c: (_|_){
   130        // [cycle] cycle error:
   131        //     ./in.cue:12:5
   132        // cycle error:
   133        //     ./in.cue:13:5
   134      }
   135    }
   136    a: (int){ int }
   137    okay: (_|_){
   138      // [incomplete] non-concrete value a for bound <:
   139      //     ./in.cue:18:15
   140    }
   141    issue1837: (struct){
   142      p1: (struct){
   143        context: (struct){
   144        }
   145        x: (_|_){
   146          // [incomplete] issue1837.p1.x: undefined field: b:
   147          //     ./in.cue:25:14
   148        }
   149        message: (string){ "a" }
   150      }
   151      p2: (struct){
   152        message: (string){ "a" }
   153        x: (_|_){
   154          // [incomplete] issue1837.p2.x: undefined field: b:
   155          //     ./in.cue:34:14
   156        }
   157        context: (struct){
   158        }
   159      }
   160      p3: (struct){
   161        message: (string){ "a" }
   162        context: (struct){
   163        }
   164        x: (_|_){
   165          // [incomplete] issue1837.p3.x: undefined field: b:
   166          //     ./in.cue:42:14
   167        }
   168      }
   169    }
   170  }
   171  -- out/evalalpha --
   172  (struct){
   173    s: (string){ string }
   174    e1: (_|_){
   175      // [incomplete] e1: non-concrete value string in operand to +:
   176      //     ./in.cue:3:6
   177      //     ./in.cue:1:4
   178    }
   179    e2: (string){ >"bar" }
   180    e3: (_|_){
   181      // [incomplete] e3: non-concrete value s for bound >:
   182      //     ./in.cue:5:7
   183    }
   184    e3b: (_|_){
   185      // [incomplete] e3b: non-concrete value s for bound >:
   186      //     ./in.cue:6:7
   187    }
   188    e4: (_|_){
   189      // [incomplete] e1: non-concrete value string in operand to +:
   190      //     ./in.cue:3:6
   191      //     ./in.cue:1:4
   192    }
   193    e5: (_|_){
   194      // [incomplete] e5: non-concrete value e5 for bound <:
   195      //     ./in.cue:9:6
   196    }
   197    E: (struct){
   198      a: (_|_){
   199        // [incomplete] E.a: non-concrete value >=5 in operand to -:
   200        //     ./in.cue:12:5
   201        //     ./in.cue:14:5
   202        //     ./in.cue:14:11
   203        // E.b: non-concrete value >=5 in operand to -:
   204        //     ./in.cue:13:5
   205        //     ./in.cue:14:5
   206        //     ./in.cue:14:11
   207      }
   208      b: (_|_){
   209        // [incomplete] E.b: non-concrete value >=5 in operand to -:
   210        //     ./in.cue:13:5
   211        //     ./in.cue:14:5
   212        //     ./in.cue:14:11
   213      }
   214      c: (_|_){
   215        // [incomplete] E.b: non-concrete value >=5 in operand to -:
   216        //     ./in.cue:13:5
   217        //     ./in.cue:14:5
   218        //     ./in.cue:14:11
   219      }
   220    }
   221    a: (int){ int }
   222    okay: (_|_){
   223      // [incomplete] non-concrete value a for bound <:
   224      //     ./in.cue:18:15
   225    }
   226    issue1837: (struct){
   227      p1: (struct){
   228        context: (struct){
   229        }
   230        x: (_|_){
   231          // [incomplete] issue1837.p1.x: undefined field: b:
   232          //     ./in.cue:25:14
   233        }
   234        message: (string){ "a" }
   235      }
   236      p2: (struct){
   237        message: (string){ "a" }
   238        x: (_|_){
   239          // [incomplete] issue1837.p2.x: undefined field: b:
   240          //     ./in.cue:34:14
   241        }
   242        context: (struct){
   243        }
   244      }
   245      p3: (struct){
   246        message: (string){ "a" }
   247        context: (struct){
   248        }
   249        x: (_|_){
   250          // [incomplete] issue1837.p3.x: undefined field: b:
   251          //     ./in.cue:42:14
   252        }
   253      }
   254    }
   255  }
   256  -- diff/-out/evalalpha<==>+out/eval --
   257  diff old new
   258  --- old
   259  +++ new
   260  @@ -20,22 +20,31 @@
   261       //     ./in.cue:1:4
   262     }
   263     e5: (_|_){
   264  -    // [cycle] cycle error
   265  +    // [incomplete] e5: non-concrete value e5 for bound <:
   266  +    //     ./in.cue:9:6
   267     }
   268     E: (struct){
   269       a: (_|_){
   270  -      // [cycle] cycle error:
   271  -      //     ./in.cue:12:5
   272  +      // [incomplete] E.a: non-concrete value >=5 in operand to -:
   273  +      //     ./in.cue:12:5
   274  +      //     ./in.cue:14:5
   275  +      //     ./in.cue:14:11
   276  +      // E.b: non-concrete value >=5 in operand to -:
   277  +      //     ./in.cue:13:5
   278  +      //     ./in.cue:14:5
   279  +      //     ./in.cue:14:11
   280       }
   281       b: (_|_){
   282  -      // [cycle] cycle error:
   283  -      //     ./in.cue:13:5
   284  +      // [incomplete] E.b: non-concrete value >=5 in operand to -:
   285  +      //     ./in.cue:13:5
   286  +      //     ./in.cue:14:5
   287  +      //     ./in.cue:14:11
   288       }
   289       c: (_|_){
   290  -      // [cycle] cycle error:
   291  -      //     ./in.cue:12:5
   292  -      // cycle error:
   293  -      //     ./in.cue:13:5
   294  +      // [incomplete] E.b: non-concrete value >=5 in operand to -:
   295  +      //     ./in.cue:13:5
   296  +      //     ./in.cue:14:5
   297  +      //     ./in.cue:14:11
   298       }
   299     }
   300     a: (int){ int }
   301  -- out/compile --
   302  --- in.cue
   303  {
   304    s: string
   305    e1: (〈0;s〉 + 〈0;s〉)
   306    e2: (>"bar" & 〈0;s〉)
   307    e3: (>〈0;s〉 & "foo")
   308    e3b: >〈0;s〉
   309    e4: (>〈0;e1〉 & 〈0;s〉)
   310    e5: (<〈0;e5〉 & 〈0;s〉)
   311    E: {
   312      a: (〈0;c〉 - 〈0;b〉)
   313      b: (〈0;c〉 - 〈0;a〉)
   314      c: ((〈0;a〉 + 〈0;b〉) & >=5)
   315    }
   316    a: int
   317    okay: ((>10 & <〈0;a〉) + 3)
   318    issue1837: {
   319      p1: {
   320        context: {}
   321        x: 〈0;context〉.b
   322        if (〈0;x〉 == _|_(explicit error (_|_ literal) in source)) {
   323          message: "a"
   324        }
   325      }
   326      p2: {
   327        if (〈0;x〉 == _|_(explicit error (_|_ literal) in source)) {
   328          message: "a"
   329        }
   330        x: 〈0;context〉.b
   331        context: {}
   332      }
   333      p3: {
   334        if (〈0;x〉 == _|_(explicit error (_|_ literal) in source)) {
   335          message: "a"
   336        }
   337        context: {}
   338        x: 〈0;context〉.b
   339      }
   340    }
   341  }