cuelang.org/go@v0.13.0/cue/testdata/cycle/issue3118.txtar (about) 1 -- in.cue -- 2 #TimeSpan: { 3 start: float 4 duration: float 5 end: float 6 7 start: end - duration 8 duration: end - start 9 end: start + duration 10 11 start: <=end 12 } 13 14 examples: [string]: #TimeSpan 15 16 examples: eg1: { 17 start: 10.0 18 duration: 2.1 19 } 20 21 examples: eg2: { 22 start: 10.0 23 } 24 25 examples: eg3: { 26 end: 10.0 27 } 28 -- out/evalalpha/stats -- 29 Leaks: 19 30 Freed: 0 31 Reused: 0 32 Allocs: 19 33 Retain: 0 34 35 Unifications: 19 36 Conjuncts: 48 37 Disjuncts: 0 38 39 CloseIDElems: 12 40 NumCloseIDs: 3 41 -- diff/-out/evalalpha/stats<==>+out/eval/stats -- 42 diff old new 43 --- old 44 +++ new 45 @@ -1,9 +1,12 @@ 46 -Leaks: 0 47 -Freed: 18 48 -Reused: 12 49 -Allocs: 6 50 -Retain: 269 51 - 52 -Unifications: 18 53 -Conjuncts: 354 54 -Disjuncts: 19 55 +Leaks: 19 56 +Freed: 0 57 +Reused: 0 58 +Allocs: 19 59 +Retain: 0 60 + 61 +Unifications: 19 62 +Conjuncts: 48 63 +Disjuncts: 0 64 + 65 +CloseIDElems: 12 66 +NumCloseIDs: 3 67 -- out/eval/stats -- 68 Leaks: 0 69 Freed: 18 70 Reused: 12 71 Allocs: 6 72 Retain: 269 73 74 Unifications: 18 75 Conjuncts: 354 76 Disjuncts: 19 77 -- out/evalalpha -- 78 (struct){ 79 #TimeSpan: (#struct){ 80 start: (_|_){ 81 // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 82 // ./in.cue:10:11 83 // #TimeSpan.start: non-concrete value float in operand to -: 84 // ./in.cue:6:12 85 // ./in.cue:4:12 86 // ./in.cue:8:12 87 // #TimeSpan.duration: non-concrete value float in operand to -: 88 // ./in.cue:7:12 89 // ./in.cue:4:12 90 // ./in.cue:8:12 91 } 92 duration: (_|_){ 93 // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 94 // ./in.cue:10:11 95 // #TimeSpan.duration: non-concrete value float in operand to -: 96 // ./in.cue:7:12 97 // ./in.cue:4:12 98 // ./in.cue:8:12 99 } 100 end: (_|_){ 101 // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 102 // ./in.cue:10:11 103 // #TimeSpan.duration: non-concrete value float in operand to -: 104 // ./in.cue:7:12 105 // ./in.cue:4:12 106 // ./in.cue:8:12 107 } 108 } 109 examples: (struct){ 110 eg1: (#struct){ 111 start: (float){ 10.0 } 112 duration: (float){ 2.1 } 113 end: (float){ 12.1 } 114 } 115 eg2: (#struct){ 116 start: (_|_){ 117 // [incomplete] examples.eg2.start: non-concrete value end for bound <=: 118 // ./in.cue:10:11 119 // examples.eg2.start: non-concrete value float in operand to -: 120 // ./in.cue:6:12 121 // ./in.cue:4:12 122 // ./in.cue:8:12 123 // examples.eg2.duration: non-concrete value float in operand to -: 124 // ./in.cue:7:12 125 // ./in.cue:4:12 126 // ./in.cue:8:12 127 } 128 duration: (_|_){ 129 // [incomplete] examples.eg2.duration: non-concrete value float in operand to -: 130 // ./in.cue:7:12 131 // ./in.cue:4:12 132 // ./in.cue:8:12 133 } 134 end: (_|_){ 135 // [incomplete] examples.eg2.duration: non-concrete value float in operand to -: 136 // ./in.cue:7:12 137 // ./in.cue:4:12 138 // ./in.cue:8:12 139 } 140 } 141 eg3: (#struct){ 142 end: (_|_){ 143 // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 144 // ./in.cue:7:12 145 // ./in.cue:2:12 146 // ./in.cue:6:12 147 // ./in.cue:10:9 148 // examples.eg3.end: non-concrete value <=10.0 & float in operand to +: 149 // ./in.cue:8:12 150 // ./in.cue:2:12 151 // ./in.cue:6:12 152 // ./in.cue:10:9 153 } 154 start: (_|_){ 155 // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 156 // ./in.cue:7:12 157 // ./in.cue:2:12 158 // ./in.cue:6:12 159 // ./in.cue:10:9 160 } 161 duration: (_|_){ 162 // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 163 // ./in.cue:7:12 164 // ./in.cue:2:12 165 // ./in.cue:6:12 166 // ./in.cue:10:9 167 } 168 } 169 } 170 } 171 -- diff/explanation -- 172 the new evaluator includes positions with the cycle error and the old evaluator does not. 173 -- diff/-out/evalalpha<==>+out/eval -- 174 diff old new 175 --- old 176 +++ new 177 @@ -1,16 +1,31 @@ 178 (struct){ 179 #TimeSpan: (#struct){ 180 start: (_|_){ 181 - // [cycle] cycle error 182 - // cycle error: 183 - // ./in.cue:10:9 184 + // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 185 + // ./in.cue:10:11 186 + // #TimeSpan.start: non-concrete value float in operand to -: 187 + // ./in.cue:6:12 188 + // ./in.cue:4:12 189 + // ./in.cue:8:12 190 + // #TimeSpan.duration: non-concrete value float in operand to -: 191 + // ./in.cue:7:12 192 + // ./in.cue:4:12 193 + // ./in.cue:8:12 194 } 195 duration: (_|_){ 196 - // [cycle] cycle error: 197 - // ./in.cue:7:12 198 + // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 199 + // ./in.cue:10:11 200 + // #TimeSpan.duration: non-concrete value float in operand to -: 201 + // ./in.cue:7:12 202 + // ./in.cue:4:12 203 + // ./in.cue:8:12 204 } 205 end: (_|_){ 206 - // [cycle] cycle error: 207 + // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 208 + // ./in.cue:10:11 209 + // #TimeSpan.duration: non-concrete value float in operand to -: 210 + // ./in.cue:7:12 211 + // ./in.cue:4:12 212 // ./in.cue:8:12 213 } 214 } 215 @@ -22,32 +37,56 @@ 216 } 217 eg2: (#struct){ 218 start: (_|_){ 219 - // [cycle] cycle error 220 - // cycle error: 221 - // ./in.cue:10:9 222 - } 223 - duration: (_|_){ 224 - // [cycle] cycle error: 225 - // ./in.cue:7:12 226 - } 227 - end: (_|_){ 228 - // [cycle] cycle error 229 - // cycle error: 230 - // ./in.cue:7:12 231 - // cycle error: 232 - // ./in.cue:10:9 233 + // [incomplete] examples.eg2.start: non-concrete value end for bound <=: 234 + // ./in.cue:10:11 235 + // examples.eg2.start: non-concrete value float in operand to -: 236 + // ./in.cue:6:12 237 + // ./in.cue:4:12 238 + // ./in.cue:8:12 239 + // examples.eg2.duration: non-concrete value float in operand to -: 240 + // ./in.cue:7:12 241 + // ./in.cue:4:12 242 + // ./in.cue:8:12 243 + } 244 + duration: (_|_){ 245 + // [incomplete] examples.eg2.duration: non-concrete value float in operand to -: 246 + // ./in.cue:7:12 247 + // ./in.cue:4:12 248 + // ./in.cue:8:12 249 + } 250 + end: (_|_){ 251 + // [incomplete] examples.eg2.duration: non-concrete value float in operand to -: 252 + // ./in.cue:7:12 253 + // ./in.cue:4:12 254 + // ./in.cue:8:12 255 } 256 } 257 eg3: (#struct){ 258 end: (_|_){ 259 - // [cycle] cycle error: 260 - // ./in.cue:8:12 261 - } 262 - start: (_|_){ 263 - // [cycle] cycle error 264 - } 265 - duration: (_|_){ 266 - // [cycle] cycle error 267 + // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 268 + // ./in.cue:7:12 269 + // ./in.cue:2:12 270 + // ./in.cue:6:12 271 + // ./in.cue:10:9 272 + // examples.eg3.end: non-concrete value <=10.0 & float in operand to +: 273 + // ./in.cue:8:12 274 + // ./in.cue:2:12 275 + // ./in.cue:6:12 276 + // ./in.cue:10:9 277 + } 278 + start: (_|_){ 279 + // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 280 + // ./in.cue:7:12 281 + // ./in.cue:2:12 282 + // ./in.cue:6:12 283 + // ./in.cue:10:9 284 + } 285 + duration: (_|_){ 286 + // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 287 + // ./in.cue:7:12 288 + // ./in.cue:2:12 289 + // ./in.cue:6:12 290 + // ./in.cue:10:9 291 } 292 } 293 } 294 -- out/eval -- 295 (struct){ 296 #TimeSpan: (#struct){ 297 start: (_|_){ 298 // [cycle] cycle error 299 // cycle error: 300 // ./in.cue:10:9 301 } 302 duration: (_|_){ 303 // [cycle] cycle error: 304 // ./in.cue:7:12 305 } 306 end: (_|_){ 307 // [cycle] cycle error: 308 // ./in.cue:8:12 309 } 310 } 311 examples: (struct){ 312 eg1: (#struct){ 313 start: (float){ 10.0 } 314 duration: (float){ 2.1 } 315 end: (float){ 12.1 } 316 } 317 eg2: (#struct){ 318 start: (_|_){ 319 // [cycle] cycle error 320 // cycle error: 321 // ./in.cue:10:9 322 } 323 duration: (_|_){ 324 // [cycle] cycle error: 325 // ./in.cue:7:12 326 } 327 end: (_|_){ 328 // [cycle] cycle error 329 // cycle error: 330 // ./in.cue:7:12 331 // cycle error: 332 // ./in.cue:10:9 333 } 334 } 335 eg3: (#struct){ 336 end: (_|_){ 337 // [cycle] cycle error: 338 // ./in.cue:8:12 339 } 340 start: (_|_){ 341 // [cycle] cycle error 342 } 343 duration: (_|_){ 344 // [cycle] cycle error 345 } 346 } 347 } 348 } 349 -- out/compile -- 350 --- in.cue 351 { 352 #TimeSpan: { 353 start: float 354 duration: float 355 end: float 356 start: (〈0;end〉 - 〈0;duration〉) 357 duration: (〈0;end〉 - 〈0;start〉) 358 end: (〈0;start〉 + 〈0;duration〉) 359 start: <=〈0;end〉 360 } 361 examples: { 362 [string]: 〈1;#TimeSpan〉 363 } 364 examples: { 365 eg1: { 366 start: 10.0 367 duration: 2.1 368 } 369 } 370 examples: { 371 eg2: { 372 start: 10.0 373 } 374 } 375 examples: { 376 eg3: { 377 end: 10.0 378 } 379 } 380 }