cuelang.org/go@v0.10.1/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/eval/stats -- 47 Leaks: 2 48 Freed: 30 49 Reused: 25 50 Allocs: 7 51 Retain: 80 52 53 Unifications: 32 54 Conjuncts: 156 55 Disjuncts: 29 56 -- out/eval -- 57 (struct){ 58 s: (string){ string } 59 e1: (_|_){ 60 // [incomplete] e1: non-concrete value string in operand to +: 61 // ./in.cue:3:6 62 // ./in.cue:1:4 63 } 64 e2: (string){ >"bar" } 65 e3: (_|_){ 66 // [incomplete] e3: non-concrete value s for bound >: 67 // ./in.cue:5:7 68 } 69 e3b: (_|_){ 70 // [incomplete] e3b: non-concrete value s for bound >: 71 // ./in.cue:6:7 72 } 73 e4: (_|_){ 74 // [incomplete] e1: non-concrete value string in operand to +: 75 // ./in.cue:3:6 76 // ./in.cue:1:4 77 } 78 e5: (_|_){ 79 // [cycle] cycle error 80 } 81 E: (struct){ 82 a: (_|_){ 83 // [cycle] cycle error: 84 // ./in.cue:12:5 85 } 86 b: (_|_){ 87 // [cycle] cycle error: 88 // ./in.cue:13:5 89 } 90 c: (_|_){ 91 // [cycle] cycle error: 92 // ./in.cue:12:5 93 // cycle error: 94 // ./in.cue:13:5 95 } 96 } 97 a: (int){ int } 98 okay: (_|_){ 99 // [incomplete] non-concrete value a for bound <: 100 // ./in.cue:18:15 101 } 102 issue1837: (struct){ 103 p1: (struct){ 104 context: (struct){ 105 } 106 x: (_|_){ 107 // [incomplete] issue1837.p1.x: undefined field: b: 108 // ./in.cue:25:14 109 } 110 message: (string){ "a" } 111 } 112 p2: (struct){ 113 message: (string){ "a" } 114 x: (_|_){ 115 // [incomplete] issue1837.p2.x: undefined field: b: 116 // ./in.cue:34:14 117 } 118 context: (struct){ 119 } 120 } 121 p3: (struct){ 122 message: (string){ "a" } 123 context: (struct){ 124 } 125 x: (_|_){ 126 // [incomplete] issue1837.p3.x: undefined field: b: 127 // ./in.cue:42:14 128 } 129 } 130 } 131 } 132 -- out/evalalpha -- 133 (struct){ 134 s: (string){ string } 135 e1: (_|_){ 136 // [incomplete] e1: non-concrete value string in operand to +: 137 // ./in.cue:3:6 138 // ./in.cue:1:4 139 } 140 e2: (string){ >"bar" } 141 e3: (_|_){ 142 // [incomplete] e3: non-concrete value s for bound >: 143 // ./in.cue:5:7 144 } 145 e3b: (_|_){ 146 // [incomplete] e3b: non-concrete value s for bound >: 147 // ./in.cue:6:7 148 } 149 e4: (_|_){ 150 // [incomplete] e1: non-concrete value string in operand to +: 151 // ./in.cue:3:6 152 // ./in.cue:1:4 153 } 154 e5: (_|_){ 155 // [incomplete] e5: non-concrete value e5 for bound <: 156 // ./in.cue:9:6 157 } 158 E: (struct){ 159 a: (_|_){ 160 // [incomplete] E.b: non-concrete value >=5 in operand to -: 161 // ./in.cue:13:5 162 // ./in.cue:14:11 163 // E.c: non-concrete value _ in operand to +: 164 // ./in.cue:14:5 165 } 166 b: (_|_){ 167 // [incomplete] E.b: non-concrete value >=5 in operand to -: 168 // ./in.cue:13:5 169 // ./in.cue:14:11 170 } 171 c: (_|_){ 172 // [incomplete] E.b: non-concrete value >=5 in operand to -: 173 // ./in.cue:13:5 174 // ./in.cue:14:11 175 // E.c: non-concrete value _ in operand to +: 176 // ./in.cue:14:5 177 } 178 } 179 a: (int){ int } 180 okay: (_|_){ 181 // [incomplete] non-concrete value a for bound <: 182 // ./in.cue:18:15 183 } 184 issue1837: (struct){ 185 p1: (struct){ 186 context: (struct){ 187 } 188 x: (_|_){ 189 // [incomplete] issue1837.p1.x: undefined field: b: 190 // ./in.cue:25:14 191 } 192 message: (string){ "a" } 193 } 194 p2: (struct){ 195 message: (string){ "a" } 196 x: (_|_){ 197 // [incomplete] issue1837.p2.x: undefined field: b: 198 // ./in.cue:34:14 199 } 200 context: (struct){ 201 } 202 } 203 p3: (struct){ 204 message: (string){ "a" } 205 context: (struct){ 206 } 207 x: (_|_){ 208 // [incomplete] issue1837.p3.x: undefined field: b: 209 // ./in.cue:42:14 210 } 211 } 212 } 213 } 214 -- diff/-out/evalalpha<==>+out/eval -- 215 diff old new 216 --- old 217 +++ new 218 @@ -20,22 +20,28 @@ 219 // ./in.cue:1:4 220 } 221 e5: (_|_){ 222 - // [cycle] cycle error 223 + // [incomplete] e5: non-concrete value e5 for bound <: 224 + // ./in.cue:9:6 225 } 226 E: (struct){ 227 a: (_|_){ 228 - // [cycle] cycle error: 229 - // ./in.cue:12:5 230 + // [incomplete] E.b: non-concrete value >=5 in operand to -: 231 + // ./in.cue:13:5 232 + // ./in.cue:14:11 233 + // E.c: non-concrete value _ in operand to +: 234 + // ./in.cue:14:5 235 } 236 b: (_|_){ 237 - // [cycle] cycle error: 238 - // ./in.cue:13:5 239 + // [incomplete] E.b: non-concrete value >=5 in operand to -: 240 + // ./in.cue:13:5 241 + // ./in.cue:14:11 242 } 243 c: (_|_){ 244 - // [cycle] cycle error: 245 - // ./in.cue:12:5 246 - // cycle error: 247 - // ./in.cue:13:5 248 + // [incomplete] E.b: non-concrete value >=5 in operand to -: 249 + // ./in.cue:13:5 250 + // ./in.cue:14:11 251 + // E.c: non-concrete value _ in operand to +: 252 + // ./in.cue:14:5 253 } 254 } 255 a: (int){ int } 256 -- diff/explanation -- 257 Improved error messages. 258 -- out/compile -- 259 --- in.cue 260 { 261 s: string 262 e1: (〈0;s〉 + 〈0;s〉) 263 e2: (>"bar" & 〈0;s〉) 264 e3: (>〈0;s〉 & "foo") 265 e3b: >〈0;s〉 266 e4: (>〈0;e1〉 & 〈0;s〉) 267 e5: (<〈0;e5〉 & 〈0;s〉) 268 E: { 269 a: (〈0;c〉 - 〈0;b〉) 270 b: (〈0;c〉 - 〈0;a〉) 271 c: ((〈0;a〉 + 〈0;b〉) & >=5) 272 } 273 a: int 274 okay: ((>10 & <〈0;a〉) + 3) 275 issue1837: { 276 p1: { 277 context: {} 278 x: 〈0;context〉.b 279 if (〈0;x〉 == _|_(explicit error (_|_ literal) in source)) { 280 message: "a" 281 } 282 } 283 p2: { 284 if (〈0;x〉 == _|_(explicit error (_|_ literal) in source)) { 285 message: "a" 286 } 287 x: 〈0;context〉.b 288 context: {} 289 } 290 p3: { 291 if (〈0;x〉 == _|_(explicit error (_|_ literal) in source)) { 292 message: "a" 293 } 294 context: {} 295 x: 〈0;context〉.b 296 } 297 } 298 }