this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

cue/testdata: convert txtar tests to inline @test format

Convert ~35 txtar test files to use inline
@test(eq/leq/err) annotations instead of
golden-file sections. Remove out/eval and
out/evalalpha sections where @test directives now
cover the output; keep out/eval/stats and
out/errors.txt.

Also extend inline_coverage.go to include fixture
file fields in coverage checks, add
coverage_fixture_orphan.txtar test, and fix minor
inline runner issues.

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I2df9d426085c03aeb223f414d1439824c32a3094
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1235990
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+1312 -6375
+148 -1714
cue/testdata/cycle/builtins.txtar
··· 1 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 1 + # Tests that evaluating a value through a builtin (regexp.FindNamedSubmatch) 2 + # and then back into a value does not cause incorrect cycle detection. 2 3 -- in.cue -- 3 4 import "regexp" 4 5 ··· 8 9 // typically not an issue, but if a referred field is within a struct generated 9 10 // by a builtin, effectively the entire struct needs to be evaluated and special 10 11 // care should be taking to not evaluate too early. 11 - builtinCyclePerm0: { 12 + builtinCyclePerm: { 13 + @test(permute, count=6) 12 14 X: "mod.test" 13 15 14 16 Y: { ··· 17 19 } 18 20 19 21 X: Y.host 20 - } 21 - 22 - builtinCyclePerm1: { 23 - X: Y.host 24 - 25 - Y: { 26 - #components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X) 27 - host: #components.host 28 - } 29 22 30 - X: "mod.test" 31 - } 32 - 33 - builtinCyclePerm2: { 34 - Y: { 35 - #components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X) 36 - host: #components.host 37 - } 38 - 39 - X: Y.host 40 - X: "mod.test" 41 - } 42 - 43 - builtinCyclePerm3: { 44 - Y: { 45 - #components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X) 46 - host: #components.host 47 - } 48 - 49 - X: "mod.test" 50 - X: Y.host 51 - } 52 - 53 - builtinCyclePerm4: { 54 - X: "mod.test" 55 - X: Y.host 56 - 57 - Y: { 58 - #components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X) 59 - host: #components.host 60 - } 61 - } 62 - 63 - builtinCyclePerm5: { 64 - X: Y.host 65 - X: "mod.test" 66 - 67 - Y: { 68 - #components: regexp.FindNamedSubmatch(#"^(?P<host>[[:alnum:].]+)$"#, X) 69 - host: #components.host 70 - } 23 + @test(eq, { 24 + X: "mod.test" 25 + Y: { 26 + #components: {host: "mod.test"} 27 + host: "mod.test" 28 + } 29 + }) 71 30 } 72 31 -- matchn.cue -- 73 32 // This should not be a structural cycle, as the list type is "optional". ··· 76 35 _s: { 77 36 #x: matchN(1, [_s, [..._s]]) 78 37 } 38 + // Cannot use @test(eq) with private field reference _s in expected value. 39 + @test(leq, {#x: _}) 79 40 } 80 41 issue3420: { 81 42 matches1: { 82 43 #S: matchN(1, [_, _|_]) 83 44 s: 2 84 45 } 46 + @test(eq, { 47 + matches1: {#S: matchN(1, [_, _|_]), s: 2} 48 + }) 85 49 } 86 50 issue3443: { 87 51 matchIf: { ··· 126 90 // cycle1.cycle. 127 91 fail: #S: matchN(1, [{n: #S}]) & {n: n: n: _} 128 92 } 93 + @test(err, pos=[2:7]) 129 94 } 130 95 issue3633: final: { 131 96 // With nested matchNs as below, the schema will become an incomplete error 132 97 // as a value of the root vertex. Make sure this edge case is properly 133 98 // handled. 134 - data: {} & #s 99 + data: {} & #s @test(err, code=incomplete, pos=[1:6, 0:8, 1:13]) 135 100 #s: matchN(1, [matchN(1, [{a!: _}])]) 136 101 } 137 102 issue3842: reduced: { ··· 140 105 }, #recursive, _) & { 141 106 source?: string 142 107 }] 108 + @test(eq, {#recursive: []}) 143 109 } 144 110 -- cycle.cue -- 145 111 import "strconv" ··· 150 116 #x: matchN(1, [_s]) 151 117 #x: {} // insert concrete value to trigger application of validator. 152 118 } 119 + @test(err, pos=[3:7, 3:14, 4:13]) 153 120 } 154 121 issue3649: noCycle: t1: { 155 122 data: #c ··· 159 126 b?: string 160 127 a?: matchN(1, [#c]) 161 128 } 129 + // Cannot use @test(eq) with self-referential #c in expected value. 130 + @test(leq, {data: {a: {b: "foo"}}}) 162 131 } 163 132 // Same as above, but with longer paths. 164 133 issue3649: noCycle: t2: { ··· 168 137 b?: string 169 138 y: a?: matchN(1, [{d: c}]) 170 139 } 140 + // Cannot use @test(eq) with self-referential c in expected value. 141 + @test(leq, {x: {y: {a: {d: {b: "foo"}}}}}) 171 142 } 172 143 issue3649: cycle: t1: { 173 144 data: #c ··· 176 147 b: string 177 148 a: matchN(1, [#c]) 178 149 } 150 + @test(err, pos=[5:6, 2:11, 5:13]) 179 151 } 180 152 181 153 // This used to cause a stack overflow. 182 154 issue4037: cycle: { 183 155 _intlike: x=matchN(1, [strconv.Atoi(x)]) 184 156 f: "1233" & _intlike 157 + @test(err, pos=[1:14, 1:21, 2:5]) 185 158 } 186 159 -- yamlcycle.cue -- 187 160 import "encoding/yaml" ··· 195 168 } 196 169 data: #c 197 170 data: a: #"{a: "b: foo"}"# 171 + @test(eq, { 172 + #c: { 173 + b?: string 174 + a?: yaml.Validate({ 175 + b?: string 176 + a?: _ 177 + }) 178 + } 179 + data: {a: "{a: \"b: foo\"}", b?: string} 180 + }) 198 181 } 199 182 selfCycle: t1: { 200 183 c: matchN(1, [{d: c}]) 201 184 c: d: {} 185 + @test(err, pos=[1:5, 1:12, 2:5]) 202 186 } 203 187 selfCycle: t2: { 204 188 // Even though only part of the path is unified with concrete data, this 205 189 // should still result in a cycle error. 206 190 c: matchN(1, [{d: c}]) 207 191 c: {} 192 + @test(eq, {c: {}}) 208 193 } 209 194 selfCycle: yamlVal: t1: { 210 195 x: y: yaml.Validate(x) 211 196 x: y: "{}" 197 + @test(err, pos=[1:8, 2:8]) 212 198 } 213 199 selfCycle: yamlVal: t2: { 214 200 // Duplicating validators can cause some tricky code paths, like finalizing ··· 217 203 x: y: "{}" 218 204 x: y: yaml.Validate(x) 219 205 x: y: "{}" 206 + @test(err, pos=[3:8, 4:8, 5:8, 6:8]) 220 207 } 221 208 selfCycle: yamlFun: t1:{ 222 209 x: y?: yaml.Validate("{}", x) 210 + @test(eq, {x: {y?: true}}) 223 211 } 224 212 selfCycle: yamlFun: t2: { 225 213 z: x & __no_sharing 226 214 z: y: "{}" 227 215 x: y: yaml.Validate("{}", x) 216 + @test(err, pos=[3:8]) 228 217 } 229 218 selfCycle: yamlValidatePartial: { 230 219 x: y: yaml.ValidatePartial(x) 231 220 x: y: "{}" 221 + @test(err, pos=[1:8, 2:8]) 232 222 } 233 223 -- jsoncycle.cue -- 234 224 import "encoding/json" ··· 236 226 jsonCycle: t1: { 237 227 x: y: json.Validate(x) 238 228 x: y: "{}" 229 + @test(err, pos=[1:8, 2:8]) 239 230 } 240 231 -- listmatchncycle.cue -- 241 232 import "list" ··· 243 234 listMatchN: structCycle: { 244 235 x: y: list.MatchN(1, x) 245 236 x: y: [{}] 237 + @test(err, pos=[1:8, 1:5, 1:20, 2:5, 2:8]) 246 238 } 247 239 listMatchN: ok: { 248 240 x: y?: list.MatchN(1, x) 249 241 z: x 250 242 z: y: [{}] 243 + // x.y? is non-concrete (list.MatchN validator); only check z.y which is concrete. 244 + @test(leq, {z: {y: [{}]}}) 251 245 } 252 246 -- issue3634.cue -- 253 247 // evalv3 structural cycle regression: using `len(...)` with a `#Schema` ··· 261 255 required?: [...string] 262 256 properties?: [string]: null | #Schema 263 257 } 264 - 258 + 265 259 out: len([...#Schema] & list.Repeat([{ 266 260 #Schema // removing this fixes the bug! 267 261 properties: foo: required: ["bar", "baz"] 268 262 }], 3)) 263 + 264 + @test(eq, { 265 + #Schema: {required?: [], properties?: {}} 266 + out: 3 267 + }) 269 268 } 270 269 issue3634: reduced: { 271 270 #D: { ··· 273 272 a?: #D 274 273 } 275 274 out: len(#D & list.Repeat([#D & { a: b: 1 }], 1)[0]) 275 + 276 + @test(eq, { 277 + #D: { 278 + b?: int 279 + a?: _|_ @test(err, code=structural_cycle, contains="issue3634.reduced.#D.a: structural cycle", pos=[]) 280 + } 281 + out: 1 282 + }) 276 283 } 277 284 -- issue3743.cue -- 278 285 // Passing a cyclic value to `yaml.MarshalStream` caused a stack overflow ··· 291 298 292 299 docs: [ (#transform & {in: "x"}).out ] 293 300 out: yaml.MarshalStream(docs) 301 + 302 + @test(eq, { 303 + #transform: {in: _, out: [_]} 304 + docs: [["x"]] 305 + out: "- x\n" 306 + }) 294 307 } 295 - -- out/eval/stats -- 296 - Leaks: 48 297 - Freed: 464 298 - Reused: 433 299 - Allocs: 79 300 - Retain: 0 301 - 302 - Unifications: 430 303 - Conjuncts: 759 304 - Disjuncts: 30 305 - Notifications: 2 306 - 307 - NumCloseIDs: 191 308 - -- out/evalalpha -- 309 - Errors: 310 - 0: cannot use [_|_(0: cannot use value at path '_' (type list) as string in argument 1 to strconv.Atoi)] (type list) as string in argument 1 to strconv.Atoi: 311 - ./cycle.cue:39:24 312 - noCycle.t1.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 308 + -- out/errors.txt -- 309 + [eval] noCycle.t1._s.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 313 310 ./cycle.cue:6:7 314 311 ./cycle.cue:6:14 315 312 ./cycle.cue:7:13 316 - noCycle.t1.#x.#x: structural cycle: 317 - ./cycle.cue:6:7 318 - noCycle.t1._s.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 313 + [eval] noCycle.t1.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 319 314 ./cycle.cue:6:7 320 315 ./cycle.cue:6:14 321 316 ./cycle.cue:7:13 322 - issue3649.cycle.t1.data.a: invalid value {b:"foo"} (does not satisfy matchN): 0 matched, expected 1: 323 - ./cycle.cue:33:6 324 - ./cycle.cue:30:11 325 - ./cycle.cue:33:13 317 + noCycle.t1.#x.#x: structural cycle: 318 + ./cycle.cue:6:7 319 + [eval] issue3649.cycle.t1.data.a: invalid value {b:"foo"} (does not satisfy matchN): 0 matched, expected 1: 320 + ./cycle.cue:38:6 321 + ./cycle.cue:35:11 322 + ./cycle.cue:38:13 326 323 issue3649.cycle.t1.data.a.a: structural cycle: 327 - ./cycle.cue:33:6 324 + ./cycle.cue:38:6 325 + [eval] 0: cannot use [_|_(0: cannot use value at path '_' (type list) as string in argument 1 to strconv.Atoi)] (type list) as string in argument 1 to strconv.Atoi: 326 + ./cycle.cue:45:24 328 327 issue4037.cycle.f: invalid value "1233" (does not satisfy matchN): 0 matched, expected 1: 329 - ./cycle.cue:39:14 330 - ./cycle.cue:39:21 331 - ./cycle.cue:40:5 332 - jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 328 + ./cycle.cue:45:14 329 + ./cycle.cue:45:21 330 + ./cycle.cue:46:5 331 + [structural_cycle] issue3634.reduced.#D.a: structural cycle 332 + [structural_cycle] jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 333 333 ./jsoncycle.cue:4:8 334 334 ./jsoncycle.cue:5:8 335 - listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): {y:_|_(listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): value at path 'listMatchN.structCycle.x' matches 0 list items, want 1)} matches 0 list items, want 1: 335 + [eval] listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): {y:_|_(listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): value at path 'listMatchN.structCycle.x' matches 0 list items, want 1)} matches 0 list items, want 1: 336 336 ./listmatchncycle.cue:4:8 337 337 ./listmatchncycle.cue:4:5 338 338 ./listmatchncycle.cue:4:20 339 339 ./listmatchncycle.cue:5:5 340 340 ./listmatchncycle.cue:5:8 341 - issue3443.matchIf.#S: cannot call non-function matchIf (type struct): 342 - ./matchn.cue:16:7 343 - issue3443.cycle1.cycle.s: invalid value {n:{n:_}} (does not satisfy matchN): 0 matched, expected 1: 344 - ./matchn.cue:35:7 345 - ./matchn.cue:35:14 346 - ./matchn.cue:47:7 347 - ./matchn.cue:48:7 341 + [eval] issue3443.matchIf.#S: cannot call non-function matchIf (type struct): 342 + ./matchn.cue:21:7 343 + [eval] issue3443.cycle1.cycle.s: invalid value {n:{n:_}} (does not satisfy matchN): 0 matched, expected 1: 344 + ./matchn.cue:40:7 345 + ./matchn.cue:40:14 346 + ./matchn.cue:52:7 347 + ./matchn.cue:53:7 348 348 issue3443.cycle1.cycle.s.n: invalid value {n:_} (does not satisfy matchN): 0 matched, expected 1: 349 - ./matchn.cue:35:7 350 - ./matchn.cue:35:14 351 - ./matchn.cue:35:22 352 - ./matchn.cue:48:10 349 + ./matchn.cue:40:7 350 + ./matchn.cue:40:14 351 + ./matchn.cue:40:22 352 + ./matchn.cue:53:10 353 353 issue3443.cycle1.cycle.s.n.n: structural cycle: 354 - ./matchn.cue:35:7 355 - issue3443.cycle2.fail.#S: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 356 - ./matchn.cue:55:13 357 - ./matchn.cue:55:20 354 + ./matchn.cue:40:7 355 + [eval] issue3443.cycle2.fail.#S: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 356 + ./matchn.cue:60:13 357 + ./matchn.cue:60:20 358 358 issue3443.cycle2.fail.#S.n: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 359 - ./matchn.cue:55:13 360 - ./matchn.cue:55:20 361 - ./matchn.cue:55:28 362 - ./matchn.cue:55:40 359 + ./matchn.cue:60:13 360 + ./matchn.cue:60:20 361 + ./matchn.cue:60:28 362 + ./matchn.cue:60:40 363 363 issue3443.cycle2.fail.#S.n.n: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 364 - ./matchn.cue:55:13 365 - ./matchn.cue:55:20 366 - ./matchn.cue:55:28 367 - ./matchn.cue:55:40 368 - ./matchn.cue:55:43 364 + ./matchn.cue:60:13 365 + ./matchn.cue:60:20 366 + ./matchn.cue:60:28 367 + ./matchn.cue:60:40 368 + ./matchn.cue:60:43 369 369 issue3443.cycle2.fail.#S.n.n.n: structural cycle: 370 - ./matchn.cue:55:13 371 - selfCycle.t1.c: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 372 - ./yamlcycle.cue:14:5 373 - ./yamlcycle.cue:14:12 374 - ./yamlcycle.cue:15:5 370 + ./matchn.cue:60:13 371 + [incomplete] issue3633.final.data: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 372 + ./matchn.cue:69:6 373 + ./matchn.cue:68:8 374 + ./matchn.cue:69:13 375 + issue3633.final.data: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 376 + ./matchn.cue:69:17 377 + ./matchn.cue:68:8 378 + ./matchn.cue:69:24 379 + issue3633.final.data.a: field is required but not present: 380 + ./matchn.cue:69:17 381 + ./matchn.cue:69:29 382 + [eval] selfCycle.t1.c: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 383 + ./yamlcycle.cue:24:5 384 + ./yamlcycle.cue:24:12 385 + ./yamlcycle.cue:25:5 375 386 selfCycle.t1.c.d: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 376 - ./yamlcycle.cue:14:5 377 - ./yamlcycle.cue:14:12 378 - ./yamlcycle.cue:14:20 379 - ./yamlcycle.cue:15:8 387 + ./yamlcycle.cue:24:5 388 + ./yamlcycle.cue:24:12 389 + ./yamlcycle.cue:24:20 390 + ./yamlcycle.cue:25:8 380 391 selfCycle.t1.c.d.d: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 381 - ./yamlcycle.cue:14:5 382 - ./yamlcycle.cue:14:12 383 - ./yamlcycle.cue:14:20 384 - ./yamlcycle.cue:15:8 392 + ./yamlcycle.cue:24:5 393 + ./yamlcycle.cue:24:12 394 + ./yamlcycle.cue:24:20 395 + ./yamlcycle.cue:25:8 385 396 selfCycle.t1.c.d.d.d: structural cycle: 386 - ./yamlcycle.cue:14:5 387 - selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 388 - ./yamlcycle.cue:24:8 389 - ./yamlcycle.cue:25:8 390 - selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 391 - ./yamlcycle.cue:30:8 392 - ./yamlcycle.cue:31:8 393 - ./yamlcycle.cue:32:8 394 - ./yamlcycle.cue:33:8 395 - selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 396 - ./yamlcycle.cue:41:8 397 - selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 398 - ./yamlcycle.cue:41:8 399 - selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 397 + ./yamlcycle.cue:24:5 398 + [structural_cycle] selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 399 + ./yamlcycle.cue:36:8 400 + ./yamlcycle.cue:37:8 401 + [structural_cycle] selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 402 + ./yamlcycle.cue:43:8 400 403 ./yamlcycle.cue:44:8 401 404 ./yamlcycle.cue:45:8 402 - 403 - Result: 404 - (_|_){ 405 - // [eval] 406 - noCycle: (_|_){ 407 - // [eval] 408 - t1: (_|_){ 409 - // [eval] 410 - _s: (_|_){ 411 - // [eval] 412 - #x: (_|_){ 413 - // [eval] noCycle.t1._s.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 414 - // ./cycle.cue:6:7 415 - // ./cycle.cue:6:14 416 - // ./cycle.cue:7:13 417 - } 418 - } 419 - #x: (_|_){ 420 - // [eval] noCycle.t1.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 421 - // ./cycle.cue:6:7 422 - // ./cycle.cue:6:14 423 - // ./cycle.cue:7:13 424 - // noCycle.t1.#x.#x: structural cycle: 425 - // ./cycle.cue:6:7 426 - } 427 - } 428 - } 429 - issue3649: (_|_){ 430 - // [eval] 431 - noCycle: (struct){ 432 - t1: (struct){ 433 - data: (#struct){ 434 - a: (#struct){ 435 - b: (string){ "foo" } 436 - } 437 - b?: (string){ string } 438 - } 439 - #c: (#struct){ 440 - b?: (string){ string } 441 - a?: (_){ matchN(1, (#list){ 442 - 0: (_|_){// 〈2;#c〉 443 - } 444 - }) } 445 - } 446 - } 447 - t2: (struct){ 448 - x: (struct){ 449 - y: (struct){ 450 - a: (struct){ 451 - d: (struct){ 452 - b: (string){ "foo" } 453 - } 454 - } 455 - } 456 - b?: (string){ string } 457 - } 458 - c: (struct){ 459 - b?: (string){ string } 460 - y: (struct){ 461 - a?: (_){ matchN(1, (#list){ 462 - 0: (_|_){// { 463 - // d: 〈4;c〉 464 - // } 465 - } 466 - }) } 467 - } 468 - } 469 - } 470 - } 471 - cycle: (_|_){ 472 - // [eval] 473 - t1: (_|_){ 474 - // [eval] 475 - data: (_|_){ 476 - // [eval] 477 - a: (_|_){ 478 - // [eval] issue3649.cycle.t1.data.a: invalid value {b:"foo"} (does not satisfy matchN): 0 matched, expected 1: 479 - // ./cycle.cue:33:6 480 - // ./cycle.cue:30:11 481 - // ./cycle.cue:33:13 482 - // issue3649.cycle.t1.data.a.a: structural cycle: 483 - // ./cycle.cue:33:6 484 - b: (string){ "foo" } 485 - } 486 - b: (string){ string } 487 - } 488 - #c: (#struct){ 489 - b: (string){ string } 490 - a: (_){ matchN(1, (#list){ 491 - 0: (_|_){// 〈2;#c〉 492 - } 493 - }) } 494 - } 495 - } 496 - } 497 - } 498 - issue4037: (_|_){ 499 - // [eval] 500 - cycle: (_|_){ 501 - // [eval] 502 - _intlike: (_){ matchN(1, (#list){ 503 - 0: (_|_){// 〈import;strconv〉.Atoi(〈1〉) 504 - } 505 - }) } 506 - f: (_|_){ 507 - // [eval] 0: cannot use [_|_(0: cannot use value at path '_' (type list) as string in argument 1 to strconv.Atoi)] (type list) as string in argument 1 to strconv.Atoi: 508 - // ./cycle.cue:39:24 509 - // issue4037.cycle.f: invalid value "1233" (does not satisfy matchN): 0 matched, expected 1: 510 - // ./cycle.cue:39:14 511 - // ./cycle.cue:39:21 512 - // ./cycle.cue:40:5 513 - } 514 - } 515 - } 516 - builtinCyclePerm0: (struct){ 517 - X: (string){ "mod.test" } 518 - Y: (struct){ 519 - #components: (#struct){ 520 - host: (string){ "mod.test" } 521 - } 522 - host: (string){ "mod.test" } 523 - } 524 - } 525 - builtinCyclePerm1: (struct){ 526 - X: (string){ "mod.test" } 527 - Y: (struct){ 528 - #components: (#struct){ 529 - host: (string){ "mod.test" } 530 - } 531 - host: (string){ "mod.test" } 532 - } 533 - } 534 - builtinCyclePerm2: (struct){ 535 - Y: (struct){ 536 - #components: (#struct){ 537 - host: (string){ "mod.test" } 538 - } 539 - host: (string){ "mod.test" } 540 - } 541 - X: (string){ "mod.test" } 542 - } 543 - builtinCyclePerm3: (struct){ 544 - Y: (struct){ 545 - #components: (#struct){ 546 - host: (string){ "mod.test" } 547 - } 548 - host: (string){ "mod.test" } 549 - } 550 - X: (string){ "mod.test" } 551 - } 552 - builtinCyclePerm4: (struct){ 553 - X: (string){ "mod.test" } 554 - Y: (struct){ 555 - #components: (#struct){ 556 - host: (string){ "mod.test" } 557 - } 558 - host: (string){ "mod.test" } 559 - } 560 - } 561 - builtinCyclePerm5: (struct){ 562 - X: (string){ "mod.test" } 563 - Y: (struct){ 564 - #components: (#struct){ 565 - host: (string){ "mod.test" } 566 - } 567 - host: (string){ "mod.test" } 568 - } 569 - } 570 - issue3634: (struct){ 571 - full: (struct){ 572 - #Schema: (#struct){ 573 - required?: (list){ 574 - } 575 - properties?: (#struct){ 576 - } 577 - } 578 - out: (int){ 3 } 579 - } 580 - reduced: (struct){ 581 - #D: (#struct){ 582 - b?: (int){ int } 583 - a?: (_|_){ 584 - // [structural_cycle] issue3634.reduced.#D.a: structural cycle 585 - } 586 - } 587 - out: (int){ 1 } 588 - } 589 - } 590 - issue3743: (struct){ 591 - #transform: (#struct){ 592 - in: (_){ _ } 593 - out: (#list){ 594 - 0: (_){ _ } 595 - } 596 - } 597 - docs: (#list){ 598 - 0: (#list){ 599 - 0: (string){ "x" } 600 - } 601 - } 602 - out: (string){ "- x\n" } 603 - } 604 - jsonCycle: (_|_){ 605 - // [structural_cycle] 606 - t1: (_|_){ 607 - // [structural_cycle] 608 - x: (_|_){ 609 - // [structural_cycle] 610 - y: (_|_){ 611 - // [structural_cycle] jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 612 - // ./jsoncycle.cue:4:8 613 - // ./jsoncycle.cue:5:8 614 - } 615 - } 616 - } 617 - } 618 - listMatchN: (_|_){ 619 - // [eval] 620 - structCycle: (_|_){ 621 - // [eval] 622 - x: (_|_){ 623 - // [eval] 624 - y: (_|_){ 625 - // [eval] listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): {y:_|_(listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): value at path 'listMatchN.structCycle.x' matches 0 list items, want 1)} matches 0 list items, want 1: 626 - // ./listmatchncycle.cue:4:8 627 - // ./listmatchncycle.cue:4:5 628 - // ./listmatchncycle.cue:4:20 629 - // ./listmatchncycle.cue:5:5 630 - // ./listmatchncycle.cue:5:8 631 - 0: (struct){ 632 - } 633 - } 634 - } 635 - } 636 - ok: (struct){ 637 - x: (struct){ 638 - y?: (list){ list.MatchN(1, listMatchN.ok.x) } 639 - } 640 - z: (struct){ 641 - y: (#list){ 642 - 0: (struct){ 643 - } 644 - } 645 - } 646 - } 647 - } 648 - issue3410: (struct){ 649 - _s: (struct){ 650 - #x: (_){ matchN(1, (#list){ 651 - 0: (_|_){// 〈2;_s〉 652 - } 653 - 1: (_|_){// [ 654 - // ...〈3;_s〉, 655 - // ] 656 - } 657 - }) } 658 - } 659 - #x: (_){ matchN(1, (#list){ 660 - 0: (_|_){// 〈2;_s〉 661 - } 662 - 1: (_|_){// [ 663 - // ...〈3;_s〉, 664 - // ] 665 - } 666 - }) } 667 - } 668 - issue3420: (struct){ 669 - matches1: (struct){ 670 - #S: (_){ matchN(1, (#list){ 671 - 0: (_|_){// _ 672 - } 673 - 1: (_|_){// _|_(explicit error (_|_ literal) in source) 674 - } 675 - }) } 676 - s: (int){ 2 } 677 - } 678 - } 679 - issue3443: (_|_){ 680 - // [eval] 681 - matchIf: (_|_){ 682 - // [eval] 683 - #S: (_|_){ 684 - // [eval] issue3443.matchIf.#S: cannot call non-function matchIf (type struct): 685 - // ./matchn.cue:16:7 686 - } 687 - } 688 - noCycle: (struct){ 689 - #S: (_){ matchN(1, (#list){ 690 - 0: (_|_){// { 691 - // n?: (〈2;#S〉 & (int|{})) 692 - // } 693 - } 694 - }) } 695 - noHang: (struct){ 696 - s: (#struct){ 697 - n: (struct){ 698 - n: (_){ _ } 699 - } 700 - } 701 - } 702 - } 703 - noCycle2: (struct){ 704 - #S: (_){ matchN(1, (#list){ 705 - 0: (_|_){// { 706 - // n?: (int|〈2;#S〉) 707 - // } 708 - } 709 - }) } 710 - } 711 - cycle1: (_|_){ 712 - // [eval] 713 - #S: (_){ matchN(1, (#list){ 714 - 0: (_|_){// { 715 - // n: 〈2;#S〉 716 - // } 717 - } 718 - }) } 719 - ok: (struct){ 720 - s: (_){ matchN(1, (#list){ 721 - 0: (_|_){// { 722 - // n: 〈2;#S〉 723 - // } 724 - } 725 - }) } 726 - } 727 - cycle: (_|_){ 728 - // [eval] 729 - s: (_|_){ 730 - // [eval] issue3443.cycle1.cycle.s: invalid value {n:{n:_}} (does not satisfy matchN): 0 matched, expected 1: 731 - // ./matchn.cue:35:7 732 - // ./matchn.cue:35:14 733 - // ./matchn.cue:47:7 734 - // ./matchn.cue:48:7 735 - // issue3443.cycle1.cycle.s.n: invalid value {n:_} (does not satisfy matchN): 0 matched, expected 1: 736 - // ./matchn.cue:35:7 737 - // ./matchn.cue:35:14 738 - // ./matchn.cue:35:22 739 - // ./matchn.cue:48:10 740 - // issue3443.cycle1.cycle.s.n.n: structural cycle: 741 - // ./matchn.cue:35:7 742 - n: (struct){ 743 - n: (_){ _ } 744 - } 745 - } 746 - } 747 - } 748 - cycle2: (_|_){ 749 - // [eval] 750 - fail: (_|_){ 751 - // [eval] 752 - #S: (_|_){ 753 - // [eval] issue3443.cycle2.fail.#S: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 754 - // ./matchn.cue:55:13 755 - // ./matchn.cue:55:20 756 - // issue3443.cycle2.fail.#S.n: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 757 - // ./matchn.cue:55:13 758 - // ./matchn.cue:55:20 759 - // ./matchn.cue:55:28 760 - // ./matchn.cue:55:40 761 - // issue3443.cycle2.fail.#S.n.n: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 762 - // ./matchn.cue:55:13 763 - // ./matchn.cue:55:20 764 - // ./matchn.cue:55:28 765 - // ./matchn.cue:55:40 766 - // ./matchn.cue:55:43 767 - // issue3443.cycle2.fail.#S.n.n.n: structural cycle: 768 - // ./matchn.cue:55:13 769 - n: (#struct){ 770 - n: (#struct){ 771 - n: (_){ _ } 772 - } 773 - } 774 - } 775 - } 776 - } 777 - } 778 - issue3633: (struct){ 779 - final: (struct){ 780 - data: (_|_){ 781 - // [incomplete] issue3633.final.data: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 782 - // ./matchn.cue:63:6 783 - // ./matchn.cue:62:8 784 - // ./matchn.cue:63:13 785 - // issue3633.final.data: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 786 - // ./matchn.cue:63:17 787 - // ./matchn.cue:62:8 788 - // ./matchn.cue:63:24 789 - // issue3633.final.data.a: field is required but not present: 790 - // ./matchn.cue:63:17 791 - // ./matchn.cue:63:29 792 - } 793 - #s: (_){ matchN(1, (#list){ 794 - 0: (_|_){// matchN(1, [ 795 - // { 796 - // a!: _ 797 - // }, 798 - // ]) 799 - } 800 - }) } 801 - } 802 - } 803 - issue3842: (struct){ 804 - reduced: (struct){ 805 - #recursive: (list){ 806 - } 807 - } 808 - } 809 - yamlNoCycle: (struct){ 810 - #c: (#struct){ 811 - b?: (string){ string } 812 - a?: ((string|bytes)){ "encoding/yaml".Validate(yamlNoCycle.#c) } 813 - } 814 - data: (#struct){ 815 - a: (string){ "{a: \"b: foo\"}" } 816 - b?: (string){ string } 817 - } 818 - } 819 - selfCycle: (_|_){ 820 - // [eval] 821 - t1: (_|_){ 822 - // [eval] 823 - c: (_|_){ 824 - // [eval] selfCycle.t1.c: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 825 - // ./yamlcycle.cue:14:5 826 - // ./yamlcycle.cue:14:12 827 - // ./yamlcycle.cue:15:5 828 - // selfCycle.t1.c.d: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 829 - // ./yamlcycle.cue:14:5 830 - // ./yamlcycle.cue:14:12 831 - // ./yamlcycle.cue:14:20 832 - // ./yamlcycle.cue:15:8 833 - // selfCycle.t1.c.d.d: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 834 - // ./yamlcycle.cue:14:5 835 - // ./yamlcycle.cue:14:12 836 - // ./yamlcycle.cue:14:20 837 - // ./yamlcycle.cue:15:8 838 - // selfCycle.t1.c.d.d.d: structural cycle: 839 - // ./yamlcycle.cue:14:5 840 - d: (struct){ 841 - } 842 - } 843 - } 844 - t2: (struct){ 845 - c: (struct){ 846 - } 847 - } 848 - yamlVal: (_|_){ 849 - // [structural_cycle] 850 - t1: (_|_){ 851 - // [structural_cycle] 852 - x: (_|_){ 853 - // [structural_cycle] 854 - y: (_|_){ 855 - // [structural_cycle] selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 856 - // ./yamlcycle.cue:24:8 857 - // ./yamlcycle.cue:25:8 858 - } 859 - } 860 - } 861 - t2: (_|_){ 862 - // [structural_cycle] 863 - x: (_|_){ 864 - // [structural_cycle] 865 - y: (_|_){ 866 - // [structural_cycle] selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 867 - // ./yamlcycle.cue:30:8 868 - // ./yamlcycle.cue:31:8 869 - // ./yamlcycle.cue:32:8 870 - // ./yamlcycle.cue:33:8 871 - } 872 - } 873 - } 874 - } 875 - yamlFun: (_|_){ 876 - // [structural_cycle] 877 - t1: (struct){ 878 - x: (struct){ 879 - y?: (bool){ true } 880 - } 881 - } 882 - t2: (_|_){ 883 - // [structural_cycle] 884 - z: (_|_){ 885 - // [structural_cycle] 886 - y: (_|_){ 887 - // [structural_cycle] selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 888 - // ./yamlcycle.cue:41:8 889 - } 890 - } 891 - x: (_|_){ 892 - // [structural_cycle] 893 - y: (_|_){ 894 - // [structural_cycle] selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 895 - // ./yamlcycle.cue:41:8 896 - } 897 - } 898 - } 899 - } 900 - yamlValidatePartial: (_|_){ 901 - // [structural_cycle] 902 - x: (_|_){ 903 - // [structural_cycle] 904 - y: (_|_){ 905 - // [structural_cycle] selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 906 - // ./yamlcycle.cue:44:8 907 - // ./yamlcycle.cue:45:8 908 - } 909 - } 910 - } 911 - } 912 - } 913 - -- diff/-out/evalalpha<==>+out/eval -- 914 - diff old new 915 - --- old 916 - +++ new 917 - @@ -1,26 +1,49 @@ 918 - Errors: 919 - +0: cannot use [_|_(0: cannot use value at path '_' (type list) as string in argument 1 to strconv.Atoi)] (type list) as string in argument 1 to strconv.Atoi: 920 - + ./cycle.cue:39:24 921 - noCycle.t1.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 922 - - ./cycle.cue:4:7 923 - - ./cycle.cue:4:14 924 - - ./cycle.cue:5:13 925 - -noCycle.t1.#x.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 926 - - ./cycle.cue:4:7 927 - - ./cycle.cue:4:14 928 - - ./cycle.cue:5:13 929 - + ./cycle.cue:6:7 930 - + ./cycle.cue:6:14 931 - + ./cycle.cue:7:13 932 - +noCycle.t1.#x.#x: structural cycle: 933 - + ./cycle.cue:6:7 934 - noCycle.t1._s.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 935 - - ./cycle.cue:4:7 936 - - ./cycle.cue:4:14 937 - - ./cycle.cue:5:13 938 - -noCycle.t1._s.#x.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 939 - - ./cycle.cue:4:7 940 - - ./cycle.cue:4:14 941 - - ./cycle.cue:5:13 942 - -jsonCycle.t1.x.y.y: structural cycle: 943 - - ./jsoncycle.cue:4:22 944 - -listMatchN.structCycle.x.y.y: structural cycle: 945 - - ./listmatchncycle.cue:4:23 946 - + ./cycle.cue:6:7 947 - + ./cycle.cue:6:14 948 - + ./cycle.cue:7:13 949 - +issue3649.cycle.t1.data.a: invalid value {b:"foo"} (does not satisfy matchN): 0 matched, expected 1: 950 - + ./cycle.cue:33:6 951 - + ./cycle.cue:30:11 952 - + ./cycle.cue:33:13 953 - +issue3649.cycle.t1.data.a.a: structural cycle: 954 - + ./cycle.cue:33:6 955 - +issue4037.cycle.f: invalid value "1233" (does not satisfy matchN): 0 matched, expected 1: 956 - + ./cycle.cue:39:14 957 - + ./cycle.cue:39:21 958 - + ./cycle.cue:40:5 959 - +jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 960 - + ./jsoncycle.cue:4:8 961 - + ./jsoncycle.cue:5:8 962 - +listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): {y:_|_(listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): value at path 'listMatchN.structCycle.x' matches 0 list items, want 1)} matches 0 list items, want 1: 963 - + ./listmatchncycle.cue:4:8 964 - + ./listmatchncycle.cue:4:5 965 - + ./listmatchncycle.cue:4:20 966 - + ./listmatchncycle.cue:5:5 967 - + ./listmatchncycle.cue:5:8 968 - issue3443.matchIf.#S: cannot call non-function matchIf (type struct): 969 - ./matchn.cue:16:7 970 - +issue3443.cycle1.cycle.s: invalid value {n:{n:_}} (does not satisfy matchN): 0 matched, expected 1: 971 - + ./matchn.cue:35:7 972 - + ./matchn.cue:35:14 973 - + ./matchn.cue:47:7 974 - + ./matchn.cue:48:7 975 - +issue3443.cycle1.cycle.s.n: invalid value {n:_} (does not satisfy matchN): 0 matched, expected 1: 976 - + ./matchn.cue:35:7 977 - + ./matchn.cue:35:14 978 - + ./matchn.cue:35:22 979 - + ./matchn.cue:48:10 980 - +issue3443.cycle1.cycle.s.n.n: structural cycle: 981 - + ./matchn.cue:35:7 982 - issue3443.cycle2.fail.#S: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 983 - ./matchn.cue:55:13 984 - ./matchn.cue:55:20 985 - @@ -53,26 +76,21 @@ 986 - ./yamlcycle.cue:15:8 987 - selfCycle.t1.c.d.d.d: structural cycle: 988 - ./yamlcycle.cue:14:5 989 - -selfCycle.t2.c: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 990 - - ./yamlcycle.cue:20:5 991 - - ./yamlcycle.cue:20:12 992 - - ./yamlcycle.cue:21:5 993 - -selfCycle.t2.c.d: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 994 - - ./yamlcycle.cue:20:5 995 - - ./yamlcycle.cue:20:12 996 - - ./yamlcycle.cue:20:20 997 - -selfCycle.t2.c.d.d: structural cycle: 998 - - ./yamlcycle.cue:20:5 999 - -selfCycle.yamlVal.t1.x.y.y: structural cycle: 1000 - - ./yamlcycle.cue:24:22 1001 - -selfCycle.yamlVal.t2.x.y.y: structural cycle: 1002 - - ./yamlcycle.cue:32:22 1003 - -selfCycle.yamlFun.t1.x.y.y: structural cycle: 1004 - - ./yamlcycle.cue:36:29 1005 - -selfCycle.yamlFun.t2.x.y.y: structural cycle: 1006 - - ./yamlcycle.cue:41:28 1007 - -selfCycle.yamlValidatePartial.x.y.y: structural cycle: 1008 - - ./yamlcycle.cue:44:29 1009 - +selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 1010 - + ./yamlcycle.cue:24:8 1011 - + ./yamlcycle.cue:25:8 1012 - +selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 1013 - + ./yamlcycle.cue:30:8 1014 - + ./yamlcycle.cue:31:8 1015 - + ./yamlcycle.cue:32:8 1016 - + ./yamlcycle.cue:33:8 1017 - +selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 1018 - + ./yamlcycle.cue:41:8 1019 - +selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 1020 - + ./yamlcycle.cue:41:8 1021 - +selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 1022 - + ./yamlcycle.cue:44:8 1023 - + ./yamlcycle.cue:45:8 1024 - 1025 - Result: 1026 - (_|_){ 1027 - @@ -85,35 +103,30 @@ 1028 - // [eval] 1029 - #x: (_|_){ 1030 - // [eval] noCycle.t1._s.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1031 - - // ./cycle.cue:4:7 1032 - - // ./cycle.cue:4:14 1033 - - // ./cycle.cue:5:13 1034 - - // noCycle.t1._s.#x.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1035 - - // ./cycle.cue:4:7 1036 - - // ./cycle.cue:4:14 1037 - - // ./cycle.cue:5:13 1038 - + // ./cycle.cue:6:7 1039 - + // ./cycle.cue:6:14 1040 - + // ./cycle.cue:7:13 1041 - } 1042 - } 1043 - #x: (_|_){ 1044 - // [eval] noCycle.t1.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1045 - - // ./cycle.cue:4:7 1046 - - // ./cycle.cue:4:14 1047 - - // ./cycle.cue:5:13 1048 - - // noCycle.t1.#x.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1049 - - // ./cycle.cue:4:7 1050 - - // ./cycle.cue:4:14 1051 - - // ./cycle.cue:5:13 1052 - - } 1053 - - } 1054 - - } 1055 - - issue3649: (struct){ 1056 - - noCycle: (struct){ 1057 - - t1: (struct){ 1058 - - data: (#struct){ 1059 - - b?: (string){ string } 1060 - - a: (struct){ 1061 - - b: (string){ "foo" } 1062 - - } 1063 - + // ./cycle.cue:6:7 1064 - + // ./cycle.cue:6:14 1065 - + // ./cycle.cue:7:13 1066 - + // noCycle.t1.#x.#x: structural cycle: 1067 - + // ./cycle.cue:6:7 1068 - + } 1069 - + } 1070 - + } 1071 - + issue3649: (_|_){ 1072 - + // [eval] 1073 - + noCycle: (struct){ 1074 - + t1: (struct){ 1075 - + data: (#struct){ 1076 - + a: (#struct){ 1077 - + b: (string){ "foo" } 1078 - + } 1079 - + b?: (string){ string } 1080 - } 1081 - #c: (#struct){ 1082 - b?: (string){ string } 1083 - @@ -125,7 +138,6 @@ 1084 - } 1085 - t2: (struct){ 1086 - x: (struct){ 1087 - - b?: (string){ string } 1088 - y: (struct){ 1089 - a: (struct){ 1090 - d: (struct){ 1091 - @@ -133,6 +145,7 @@ 1092 - } 1093 - } 1094 - } 1095 - + b?: (string){ string } 1096 - } 1097 - c: (struct){ 1098 - b?: (string){ string } 1099 - @@ -147,13 +160,22 @@ 1100 - } 1101 - } 1102 - } 1103 - - cycle: (struct){ 1104 - - t1: (struct){ 1105 - - data: (#struct){ 1106 - - b: (string){ string } 1107 - - a: (struct){ 1108 - - b: (string){ "foo" } 1109 - - } 1110 - + cycle: (_|_){ 1111 - + // [eval] 1112 - + t1: (_|_){ 1113 - + // [eval] 1114 - + data: (_|_){ 1115 - + // [eval] 1116 - + a: (_|_){ 1117 - + // [eval] issue3649.cycle.t1.data.a: invalid value {b:"foo"} (does not satisfy matchN): 0 matched, expected 1: 1118 - + // ./cycle.cue:33:6 1119 - + // ./cycle.cue:30:11 1120 - + // ./cycle.cue:33:13 1121 - + // issue3649.cycle.t1.data.a.a: structural cycle: 1122 - + // ./cycle.cue:33:6 1123 - + b: (string){ "foo" } 1124 - + } 1125 - + b: (string){ string } 1126 - } 1127 - #c: (#struct){ 1128 - b: (string){ string } 1129 - @@ -165,6 +187,24 @@ 1130 - } 1131 - } 1132 - } 1133 - + issue4037: (_|_){ 1134 - + // [eval] 1135 - + cycle: (_|_){ 1136 - + // [eval] 1137 - + _intlike: (_){ matchN(1, (#list){ 1138 - + 0: (_|_){// 〈import;strconv〉.Atoi(〈1〉) 1139 - + } 1140 - + }) } 1141 - + f: (_|_){ 1142 - + // [eval] 0: cannot use [_|_(0: cannot use value at path '_' (type list) as string in argument 1 to strconv.Atoi)] (type list) as string in argument 1 to strconv.Atoi: 1143 - + // ./cycle.cue:39:24 1144 - + // issue4037.cycle.f: invalid value "1233" (does not satisfy matchN): 0 matched, expected 1: 1145 - + // ./cycle.cue:39:14 1146 - + // ./cycle.cue:39:21 1147 - + // ./cycle.cue:40:5 1148 - + } 1149 - + } 1150 - + } 1151 - builtinCyclePerm0: (struct){ 1152 - X: (string){ "mod.test" } 1153 - Y: (struct){ 1154 - @@ -233,19 +273,37 @@ 1155 - #D: (#struct){ 1156 - b?: (int){ int } 1157 - a?: (_|_){ 1158 - - // [structural cycle] issue3634.reduced.#D.a: structural cycle 1159 - + // [structural_cycle] issue3634.reduced.#D.a: structural cycle 1160 - } 1161 - } 1162 - out: (int){ 1 } 1163 - } 1164 - } 1165 - + issue3743: (struct){ 1166 - + #transform: (#struct){ 1167 - + in: (_){ _ } 1168 - + out: (#list){ 1169 - + 0: (_){ _ } 1170 - + } 1171 - + } 1172 - + docs: (#list){ 1173 - + 0: (#list){ 1174 - + 0: (string){ "x" } 1175 - + } 1176 - + } 1177 - + out: (string){ "- x\n" } 1178 - + } 1179 - jsonCycle: (_|_){ 1180 - - // [structural cycle] 1181 - - t1: (_|_){ 1182 - - // [structural cycle] 1183 - - x: (_|_){ 1184 - - // [structural cycle] jsonCycle.t1.x.y.y: structural cycle: 1185 - - // ./jsoncycle.cue:4:22 1186 - + // [structural_cycle] 1187 - + t1: (_|_){ 1188 - + // [structural_cycle] 1189 - + x: (_|_){ 1190 - + // [structural_cycle] 1191 - + y: (_|_){ 1192 - + // [structural_cycle] jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 1193 - + // ./jsoncycle.cue:4:8 1194 - + // ./jsoncycle.cue:5:8 1195 - + } 1196 - } 1197 - } 1198 - } 1199 - @@ -254,8 +312,17 @@ 1200 - structCycle: (_|_){ 1201 - // [eval] 1202 - x: (_|_){ 1203 - - // [eval] listMatchN.structCycle.x.y.y: structural cycle: 1204 - - // ./listmatchncycle.cue:4:23 1205 - + // [eval] 1206 - + y: (_|_){ 1207 - + // [eval] listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): {y:_|_(listMatchN.structCycle.x.y: invalid value [{}] (does not satisfy list.MatchN): value at path 'listMatchN.structCycle.x' matches 0 list items, want 1)} matches 0 list items, want 1: 1208 - + // ./listmatchncycle.cue:4:8 1209 - + // ./listmatchncycle.cue:4:5 1210 - + // ./listmatchncycle.cue:4:20 1211 - + // ./listmatchncycle.cue:5:5 1212 - + // ./listmatchncycle.cue:5:8 1213 - + 0: (struct){ 1214 - + } 1215 - + } 1216 - } 1217 - } 1218 - ok: (struct){ 1219 - @@ -318,7 +385,7 @@ 1220 - } 1221 - }) } 1222 - noHang: (struct){ 1223 - - s: (struct){ 1224 - + s: (#struct){ 1225 - n: (struct){ 1226 - n: (_){ _ } 1227 - } 1228 - @@ -333,7 +400,8 @@ 1229 - } 1230 - }) } 1231 - } 1232 - - cycle1: (struct){ 1233 - + cycle1: (_|_){ 1234 - + // [eval] 1235 - #S: (_){ matchN(1, (#list){ 1236 - 0: (_|_){// { 1237 - // n: 〈2;#S〉 1238 - @@ -348,8 +416,21 @@ 1239 - } 1240 - }) } 1241 - } 1242 - - cycle: (struct){ 1243 - - s: (struct){ 1244 - + cycle: (_|_){ 1245 - + // [eval] 1246 - + s: (_|_){ 1247 - + // [eval] issue3443.cycle1.cycle.s: invalid value {n:{n:_}} (does not satisfy matchN): 0 matched, expected 1: 1248 - + // ./matchn.cue:35:7 1249 - + // ./matchn.cue:35:14 1250 - + // ./matchn.cue:47:7 1251 - + // ./matchn.cue:48:7 1252 - + // issue3443.cycle1.cycle.s.n: invalid value {n:_} (does not satisfy matchN): 0 matched, expected 1: 1253 - + // ./matchn.cue:35:7 1254 - + // ./matchn.cue:35:14 1255 - + // ./matchn.cue:35:22 1256 - + // ./matchn.cue:48:10 1257 - + // issue3443.cycle1.cycle.s.n.n: structural cycle: 1258 - + // ./matchn.cue:35:7 1259 - n: (struct){ 1260 - n: (_){ _ } 1261 - } 1262 - @@ -393,13 +474,13 @@ 1263 - // ./matchn.cue:63:6 1264 - // ./matchn.cue:62:8 1265 - // ./matchn.cue:63:13 1266 - - // issue3633.final.a: field is required but not present: 1267 - - // ./matchn.cue:63:17 1268 - - // ./matchn.cue:63:29 1269 - // issue3633.final.data: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1270 - // ./matchn.cue:63:17 1271 - // ./matchn.cue:62:8 1272 - // ./matchn.cue:63:24 1273 - + // issue3633.final.data.a: field is required but not present: 1274 - + // ./matchn.cue:63:17 1275 - + // ./matchn.cue:63:29 1276 - } 1277 - #s: (_){ matchN(1, (#list){ 1278 - 0: (_|_){// matchN(1, [ 1279 - @@ -411,6 +492,12 @@ 1280 - }) } 1281 - } 1282 - } 1283 - + issue3842: (struct){ 1284 - + reduced: (struct){ 1285 - + #recursive: (list){ 1286 - + } 1287 - + } 1288 - + } 1289 - yamlNoCycle: (struct){ 1290 - #c: (#struct){ 1291 - b?: (string){ string } 1292 - @@ -417,8 +504,8 @@ 1293 - a?: ((string|bytes)){ "encoding/yaml".Validate(yamlNoCycle.#c) } 1294 - } 1295 - data: (#struct){ 1296 - - b?: (string){ string } 1297 - a: (string){ "{a: \"b: foo\"}" } 1298 - + b?: (string){ string } 1299 - } 1300 - } 1301 - selfCycle: (_|_){ 1302 - @@ -446,67 +533,71 @@ 1303 - } 1304 - } 1305 - } 1306 - - t2: (_|_){ 1307 - - // [eval] 1308 - - c: (_|_){ 1309 - - // [eval] selfCycle.t2.c: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1310 - - // ./yamlcycle.cue:20:5 1311 - - // ./yamlcycle.cue:20:12 1312 - - // ./yamlcycle.cue:21:5 1313 - - // selfCycle.t2.c.d: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1314 - - // ./yamlcycle.cue:20:5 1315 - - // ./yamlcycle.cue:20:12 1316 - - // ./yamlcycle.cue:20:20 1317 - - // selfCycle.t2.c.d.d: structural cycle: 1318 - - // ./yamlcycle.cue:20:5 1319 - + t2: (struct){ 1320 - + c: (struct){ 1321 - } 1322 - } 1323 - yamlVal: (_|_){ 1324 - - // [structural cycle] 1325 - - t1: (_|_){ 1326 - - // [structural cycle] 1327 - - x: (_|_){ 1328 - - // [structural cycle] selfCycle.yamlVal.t1.x.y.y: structural cycle: 1329 - - // ./yamlcycle.cue:24:22 1330 - - } 1331 - - } 1332 - - t2: (_|_){ 1333 - - // [structural cycle] 1334 - - x: (_|_){ 1335 - - // [structural cycle] selfCycle.yamlVal.t2.x.y.y: structural cycle: 1336 - - // ./yamlcycle.cue:32:22 1337 - + // [structural_cycle] 1338 - + t1: (_|_){ 1339 - + // [structural_cycle] 1340 - + x: (_|_){ 1341 - + // [structural_cycle] 1342 - + y: (_|_){ 1343 - + // [structural_cycle] selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 1344 - + // ./yamlcycle.cue:24:8 1345 - + // ./yamlcycle.cue:25:8 1346 - + } 1347 - + } 1348 - + } 1349 - + t2: (_|_){ 1350 - + // [structural_cycle] 1351 - + x: (_|_){ 1352 - + // [structural_cycle] 1353 - + y: (_|_){ 1354 - + // [structural_cycle] selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 1355 - + // ./yamlcycle.cue:30:8 1356 - + // ./yamlcycle.cue:31:8 1357 - + // ./yamlcycle.cue:32:8 1358 - + // ./yamlcycle.cue:33:8 1359 - + } 1360 - } 1361 - } 1362 - } 1363 - yamlFun: (_|_){ 1364 - - // [structural cycle] 1365 - - t1: (_|_){ 1366 - - // [structural cycle] 1367 - - x: (_|_){ 1368 - - // [structural cycle] selfCycle.yamlFun.t1.x.y.y: structural cycle: 1369 - - // ./yamlcycle.cue:36:29 1370 - - } 1371 - - } 1372 - - t2: (_|_){ 1373 - - // [structural cycle] 1374 - + // [structural_cycle] 1375 - + t1: (struct){ 1376 - + x: (struct){ 1377 - + y?: (bool){ true } 1378 - + } 1379 - + } 1380 - + t2: (_|_){ 1381 - + // [structural_cycle] 1382 - z: (_|_){ 1383 - - // [structural cycle] 1384 - - y: (_|_){ 1385 - - // [structural cycle] selfCycle.yamlFun.t2.x.y.y: structural cycle: 1386 - - // ./yamlcycle.cue:41:28 1387 - - } 1388 - - } 1389 - - x: (_|_){ 1390 - - // [structural cycle] selfCycle.yamlFun.t2.x.y.y: structural cycle: 1391 - - // ./yamlcycle.cue:41:28 1392 - + // [structural_cycle] 1393 - + y: (_|_){ 1394 - + // [structural_cycle] selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 1395 - + // ./yamlcycle.cue:41:8 1396 - + } 1397 - + } 1398 - + x: (_|_){ 1399 - + // [structural_cycle] 1400 - + y: (_|_){ 1401 - + // [structural_cycle] selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 1402 - + // ./yamlcycle.cue:41:8 1403 - + } 1404 - } 1405 - } 1406 - } 1407 - yamlValidatePartial: (_|_){ 1408 - - // [structural cycle] 1409 - - x: (_|_){ 1410 - - // [structural cycle] selfCycle.yamlValidatePartial.x.y.y: structural cycle: 1411 - - // ./yamlcycle.cue:44:29 1412 - + // [structural_cycle] 1413 - + x: (_|_){ 1414 - + // [structural_cycle] 1415 - + y: (_|_){ 1416 - + // [structural_cycle] selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 1417 - + // ./yamlcycle.cue:44:8 1418 - + // ./yamlcycle.cue:45:8 1419 - + } 1420 - } 1421 - } 1422 - } 1423 - -- diff/todo/p2 -- 1424 - issue3443: Sort out differences in reporting of cycles. 1425 - -- out/eval -- 1426 - Errors: 1427 - noCycle.t1.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1428 - ./cycle.cue:4:7 1429 - ./cycle.cue:4:14 1430 - ./cycle.cue:5:13 1431 - noCycle.t1.#x.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1432 - ./cycle.cue:4:7 1433 - ./cycle.cue:4:14 1434 - ./cycle.cue:5:13 1435 - noCycle.t1._s.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1436 - ./cycle.cue:4:7 1437 - ./cycle.cue:4:14 1438 - ./cycle.cue:5:13 1439 - noCycle.t1._s.#x.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1440 - ./cycle.cue:4:7 1441 - ./cycle.cue:4:14 1442 - ./cycle.cue:5:13 1443 - jsonCycle.t1.x.y.y: structural cycle: 1444 - ./jsoncycle.cue:4:22 1445 - listMatchN.structCycle.x.y.y: structural cycle: 1446 - ./listmatchncycle.cue:4:23 1447 - issue3443.matchIf.#S: cannot call non-function matchIf (type struct): 1448 - ./matchn.cue:16:7 1449 - issue3443.cycle2.fail.#S: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 1450 - ./matchn.cue:55:13 1451 - ./matchn.cue:55:20 1452 - issue3443.cycle2.fail.#S.n: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 1453 - ./matchn.cue:55:13 1454 - ./matchn.cue:55:20 1455 - ./matchn.cue:55:28 1456 - ./matchn.cue:55:40 1457 - issue3443.cycle2.fail.#S.n.n: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 1458 - ./matchn.cue:55:13 1459 - ./matchn.cue:55:20 1460 - ./matchn.cue:55:28 1461 - ./matchn.cue:55:40 1462 - ./matchn.cue:55:43 1463 - issue3443.cycle2.fail.#S.n.n.n: structural cycle: 1464 - ./matchn.cue:55:13 1465 - selfCycle.t1.c: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 1466 - ./yamlcycle.cue:14:5 1467 - ./yamlcycle.cue:14:12 1468 - ./yamlcycle.cue:15:5 1469 - selfCycle.t1.c.d: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 1470 - ./yamlcycle.cue:14:5 1471 - ./yamlcycle.cue:14:12 1472 - ./yamlcycle.cue:14:20 1473 - ./yamlcycle.cue:15:8 1474 - selfCycle.t1.c.d.d: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 1475 - ./yamlcycle.cue:14:5 1476 - ./yamlcycle.cue:14:12 1477 - ./yamlcycle.cue:14:20 1478 - ./yamlcycle.cue:15:8 1479 - selfCycle.t1.c.d.d.d: structural cycle: 1480 - ./yamlcycle.cue:14:5 1481 - selfCycle.t2.c: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1482 - ./yamlcycle.cue:20:5 1483 - ./yamlcycle.cue:20:12 1484 - ./yamlcycle.cue:21:5 1485 - selfCycle.t2.c.d: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1486 - ./yamlcycle.cue:20:5 1487 - ./yamlcycle.cue:20:12 1488 - ./yamlcycle.cue:20:20 1489 - selfCycle.t2.c.d.d: structural cycle: 1490 - ./yamlcycle.cue:20:5 1491 - selfCycle.yamlVal.t1.x.y.y: structural cycle: 1492 - ./yamlcycle.cue:24:22 1493 - selfCycle.yamlVal.t2.x.y.y: structural cycle: 1494 - ./yamlcycle.cue:32:22 1495 - selfCycle.yamlFun.t1.x.y.y: structural cycle: 1496 - ./yamlcycle.cue:36:29 1497 - selfCycle.yamlFun.t2.x.y.y: structural cycle: 1498 - ./yamlcycle.cue:41:28 1499 - selfCycle.yamlValidatePartial.x.y.y: structural cycle: 1500 - ./yamlcycle.cue:44:29 1501 - 1502 - Result: 1503 - (_|_){ 1504 - // [eval] 1505 - noCycle: (_|_){ 1506 - // [eval] 1507 - t1: (_|_){ 1508 - // [eval] 1509 - _s: (_|_){ 1510 - // [eval] 1511 - #x: (_|_){ 1512 - // [eval] noCycle.t1._s.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1513 - // ./cycle.cue:4:7 1514 - // ./cycle.cue:4:14 1515 - // ./cycle.cue:5:13 1516 - // noCycle.t1._s.#x.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1517 - // ./cycle.cue:4:7 1518 - // ./cycle.cue:4:14 1519 - // ./cycle.cue:5:13 1520 - } 1521 - } 1522 - #x: (_|_){ 1523 - // [eval] noCycle.t1.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1524 - // ./cycle.cue:4:7 1525 - // ./cycle.cue:4:14 1526 - // ./cycle.cue:5:13 1527 - // noCycle.t1.#x.#x: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1528 - // ./cycle.cue:4:7 1529 - // ./cycle.cue:4:14 1530 - // ./cycle.cue:5:13 1531 - } 1532 - } 1533 - } 1534 - issue3649: (struct){ 1535 - noCycle: (struct){ 1536 - t1: (struct){ 1537 - data: (#struct){ 1538 - b?: (string){ string } 1539 - a: (struct){ 1540 - b: (string){ "foo" } 1541 - } 1542 - } 1543 - #c: (#struct){ 1544 - b?: (string){ string } 1545 - a?: (_){ matchN(1, (#list){ 1546 - 0: (_|_){// 〈2;#c〉 1547 - } 1548 - }) } 1549 - } 1550 - } 1551 - t2: (struct){ 1552 - x: (struct){ 1553 - b?: (string){ string } 1554 - y: (struct){ 1555 - a: (struct){ 1556 - d: (struct){ 1557 - b: (string){ "foo" } 1558 - } 1559 - } 1560 - } 1561 - } 1562 - c: (struct){ 1563 - b?: (string){ string } 1564 - y: (struct){ 1565 - a?: (_){ matchN(1, (#list){ 1566 - 0: (_|_){// { 1567 - // d: 〈4;c〉 1568 - // } 1569 - } 1570 - }) } 1571 - } 1572 - } 1573 - } 1574 - } 1575 - cycle: (struct){ 1576 - t1: (struct){ 1577 - data: (#struct){ 1578 - b: (string){ string } 1579 - a: (struct){ 1580 - b: (string){ "foo" } 1581 - } 1582 - } 1583 - #c: (#struct){ 1584 - b: (string){ string } 1585 - a: (_){ matchN(1, (#list){ 1586 - 0: (_|_){// 〈2;#c〉 1587 - } 1588 - }) } 1589 - } 1590 - } 1591 - } 1592 - } 1593 - builtinCyclePerm0: (struct){ 1594 - X: (string){ "mod.test" } 1595 - Y: (struct){ 1596 - #components: (#struct){ 1597 - host: (string){ "mod.test" } 1598 - } 1599 - host: (string){ "mod.test" } 1600 - } 1601 - } 1602 - builtinCyclePerm1: (struct){ 1603 - X: (string){ "mod.test" } 1604 - Y: (struct){ 1605 - #components: (#struct){ 1606 - host: (string){ "mod.test" } 1607 - } 1608 - host: (string){ "mod.test" } 1609 - } 1610 - } 1611 - builtinCyclePerm2: (struct){ 1612 - Y: (struct){ 1613 - #components: (#struct){ 1614 - host: (string){ "mod.test" } 1615 - } 1616 - host: (string){ "mod.test" } 1617 - } 1618 - X: (string){ "mod.test" } 1619 - } 1620 - builtinCyclePerm3: (struct){ 1621 - Y: (struct){ 1622 - #components: (#struct){ 1623 - host: (string){ "mod.test" } 1624 - } 1625 - host: (string){ "mod.test" } 1626 - } 1627 - X: (string){ "mod.test" } 1628 - } 1629 - builtinCyclePerm4: (struct){ 1630 - X: (string){ "mod.test" } 1631 - Y: (struct){ 1632 - #components: (#struct){ 1633 - host: (string){ "mod.test" } 1634 - } 1635 - host: (string){ "mod.test" } 1636 - } 1637 - } 1638 - builtinCyclePerm5: (struct){ 1639 - X: (string){ "mod.test" } 1640 - Y: (struct){ 1641 - #components: (#struct){ 1642 - host: (string){ "mod.test" } 1643 - } 1644 - host: (string){ "mod.test" } 1645 - } 1646 - } 1647 - issue3634: (struct){ 1648 - full: (struct){ 1649 - #Schema: (#struct){ 1650 - required?: (list){ 1651 - } 1652 - properties?: (#struct){ 1653 - } 1654 - } 1655 - out: (int){ 3 } 1656 - } 1657 - reduced: (struct){ 1658 - #D: (#struct){ 1659 - b?: (int){ int } 1660 - a?: (_|_){ 1661 - // [structural cycle] issue3634.reduced.#D.a: structural cycle 1662 - } 1663 - } 1664 - out: (int){ 1 } 1665 - } 1666 - } 1667 - jsonCycle: (_|_){ 1668 - // [structural cycle] 1669 - t1: (_|_){ 1670 - // [structural cycle] 1671 - x: (_|_){ 1672 - // [structural cycle] jsonCycle.t1.x.y.y: structural cycle: 1673 - // ./jsoncycle.cue:4:22 1674 - } 1675 - } 1676 - } 1677 - listMatchN: (_|_){ 1678 - // [eval] 1679 - structCycle: (_|_){ 1680 - // [eval] 1681 - x: (_|_){ 1682 - // [eval] listMatchN.structCycle.x.y.y: structural cycle: 1683 - // ./listmatchncycle.cue:4:23 1684 - } 1685 - } 1686 - ok: (struct){ 1687 - x: (struct){ 1688 - y?: (list){ list.MatchN(1, listMatchN.ok.x) } 1689 - } 1690 - z: (struct){ 1691 - y: (#list){ 1692 - 0: (struct){ 1693 - } 1694 - } 1695 - } 1696 - } 1697 - } 1698 - issue3410: (struct){ 1699 - _s: (struct){ 1700 - #x: (_){ matchN(1, (#list){ 1701 - 0: (_|_){// 〈2;_s〉 1702 - } 1703 - 1: (_|_){// [ 1704 - // ...〈3;_s〉, 1705 - // ] 1706 - } 1707 - }) } 1708 - } 1709 - #x: (_){ matchN(1, (#list){ 1710 - 0: (_|_){// 〈2;_s〉 1711 - } 1712 - 1: (_|_){// [ 1713 - // ...〈3;_s〉, 1714 - // ] 1715 - } 1716 - }) } 1717 - } 1718 - issue3420: (struct){ 1719 - matches1: (struct){ 1720 - #S: (_){ matchN(1, (#list){ 1721 - 0: (_|_){// _ 1722 - } 1723 - 1: (_|_){// _|_(explicit error (_|_ literal) in source) 1724 - } 1725 - }) } 1726 - s: (int){ 2 } 1727 - } 1728 - } 1729 - issue3443: (_|_){ 1730 - // [eval] 1731 - matchIf: (_|_){ 1732 - // [eval] 1733 - #S: (_|_){ 1734 - // [eval] issue3443.matchIf.#S: cannot call non-function matchIf (type struct): 1735 - // ./matchn.cue:16:7 1736 - } 1737 - } 1738 - noCycle: (struct){ 1739 - #S: (_){ matchN(1, (#list){ 1740 - 0: (_|_){// { 1741 - // n?: (〈2;#S〉 & (int|{})) 1742 - // } 1743 - } 1744 - }) } 1745 - noHang: (struct){ 1746 - s: (struct){ 1747 - n: (struct){ 1748 - n: (_){ _ } 1749 - } 1750 - } 1751 - } 1752 - } 1753 - noCycle2: (struct){ 1754 - #S: (_){ matchN(1, (#list){ 1755 - 0: (_|_){// { 1756 - // n?: (int|〈2;#S〉) 1757 - // } 1758 - } 1759 - }) } 1760 - } 1761 - cycle1: (struct){ 1762 - #S: (_){ matchN(1, (#list){ 1763 - 0: (_|_){// { 1764 - // n: 〈2;#S〉 1765 - // } 1766 - } 1767 - }) } 1768 - ok: (struct){ 1769 - s: (_){ matchN(1, (#list){ 1770 - 0: (_|_){// { 1771 - // n: 〈2;#S〉 1772 - // } 1773 - } 1774 - }) } 1775 - } 1776 - cycle: (struct){ 1777 - s: (struct){ 1778 - n: (struct){ 1779 - n: (_){ _ } 1780 - } 1781 - } 1782 - } 1783 - } 1784 - cycle2: (_|_){ 1785 - // [eval] 1786 - fail: (_|_){ 1787 - // [eval] 1788 - #S: (_|_){ 1789 - // [eval] issue3443.cycle2.fail.#S: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 1790 - // ./matchn.cue:55:13 1791 - // ./matchn.cue:55:20 1792 - // issue3443.cycle2.fail.#S.n: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 1793 - // ./matchn.cue:55:13 1794 - // ./matchn.cue:55:20 1795 - // ./matchn.cue:55:28 1796 - // ./matchn.cue:55:40 1797 - // issue3443.cycle2.fail.#S.n.n: invalid value {n:{n:{n:_}}} (does not satisfy matchN): 0 matched, expected 1: 1798 - // ./matchn.cue:55:13 1799 - // ./matchn.cue:55:20 1800 - // ./matchn.cue:55:28 1801 - // ./matchn.cue:55:40 1802 - // ./matchn.cue:55:43 1803 - // issue3443.cycle2.fail.#S.n.n.n: structural cycle: 1804 - // ./matchn.cue:55:13 1805 - n: (#struct){ 1806 - n: (#struct){ 1807 - n: (_){ _ } 1808 - } 1809 - } 1810 - } 1811 - } 1812 - } 1813 - } 1814 - issue3633: (struct){ 1815 - final: (struct){ 1816 - data: (_|_){ 1817 - // [incomplete] issue3633.final.data: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1818 - // ./matchn.cue:63:6 1819 - // ./matchn.cue:62:8 1820 - // ./matchn.cue:63:13 1821 - // issue3633.final.a: field is required but not present: 1822 - // ./matchn.cue:63:17 1823 - // ./matchn.cue:63:29 1824 - // issue3633.final.data: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1825 - // ./matchn.cue:63:17 1826 - // ./matchn.cue:62:8 1827 - // ./matchn.cue:63:24 1828 - } 1829 - #s: (_){ matchN(1, (#list){ 1830 - 0: (_|_){// matchN(1, [ 1831 - // { 1832 - // a!: _ 1833 - // }, 1834 - // ]) 1835 - } 1836 - }) } 1837 - } 1838 - } 1839 - yamlNoCycle: (struct){ 1840 - #c: (#struct){ 1841 - b?: (string){ string } 1842 - a?: ((string|bytes)){ "encoding/yaml".Validate(yamlNoCycle.#c) } 1843 - } 1844 - data: (#struct){ 1845 - b?: (string){ string } 1846 - a: (string){ "{a: \"b: foo\"}" } 1847 - } 1848 - } 1849 - selfCycle: (_|_){ 1850 - // [eval] 1851 - t1: (_|_){ 1852 - // [eval] 1853 - c: (_|_){ 1854 - // [eval] selfCycle.t1.c: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 1855 - // ./yamlcycle.cue:14:5 1856 - // ./yamlcycle.cue:14:12 1857 - // ./yamlcycle.cue:15:5 1858 - // selfCycle.t1.c.d: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 1859 - // ./yamlcycle.cue:14:5 1860 - // ./yamlcycle.cue:14:12 1861 - // ./yamlcycle.cue:14:20 1862 - // ./yamlcycle.cue:15:8 1863 - // selfCycle.t1.c.d.d: invalid value {d:{}} (does not satisfy matchN): 0 matched, expected 1: 1864 - // ./yamlcycle.cue:14:5 1865 - // ./yamlcycle.cue:14:12 1866 - // ./yamlcycle.cue:14:20 1867 - // ./yamlcycle.cue:15:8 1868 - // selfCycle.t1.c.d.d.d: structural cycle: 1869 - // ./yamlcycle.cue:14:5 1870 - d: (struct){ 1871 - } 1872 - } 1873 - } 1874 - t2: (_|_){ 1875 - // [eval] 1876 - c: (_|_){ 1877 - // [eval] selfCycle.t2.c: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1878 - // ./yamlcycle.cue:20:5 1879 - // ./yamlcycle.cue:20:12 1880 - // ./yamlcycle.cue:21:5 1881 - // selfCycle.t2.c.d: invalid value {} (does not satisfy matchN): 0 matched, expected 1: 1882 - // ./yamlcycle.cue:20:5 1883 - // ./yamlcycle.cue:20:12 1884 - // ./yamlcycle.cue:20:20 1885 - // selfCycle.t2.c.d.d: structural cycle: 1886 - // ./yamlcycle.cue:20:5 1887 - } 1888 - } 1889 - yamlVal: (_|_){ 1890 - // [structural cycle] 1891 - t1: (_|_){ 1892 - // [structural cycle] 1893 - x: (_|_){ 1894 - // [structural cycle] selfCycle.yamlVal.t1.x.y.y: structural cycle: 1895 - // ./yamlcycle.cue:24:22 1896 - } 1897 - } 1898 - t2: (_|_){ 1899 - // [structural cycle] 1900 - x: (_|_){ 1901 - // [structural cycle] selfCycle.yamlVal.t2.x.y.y: structural cycle: 1902 - // ./yamlcycle.cue:32:22 1903 - } 1904 - } 1905 - } 1906 - yamlFun: (_|_){ 1907 - // [structural cycle] 1908 - t1: (_|_){ 1909 - // [structural cycle] 1910 - x: (_|_){ 1911 - // [structural cycle] selfCycle.yamlFun.t1.x.y.y: structural cycle: 1912 - // ./yamlcycle.cue:36:29 1913 - } 1914 - } 1915 - t2: (_|_){ 1916 - // [structural cycle] 1917 - z: (_|_){ 1918 - // [structural cycle] 1919 - y: (_|_){ 1920 - // [structural cycle] selfCycle.yamlFun.t2.x.y.y: structural cycle: 1921 - // ./yamlcycle.cue:41:28 1922 - } 1923 - } 1924 - x: (_|_){ 1925 - // [structural cycle] selfCycle.yamlFun.t2.x.y.y: structural cycle: 1926 - // ./yamlcycle.cue:41:28 1927 - } 1928 - } 1929 - } 1930 - yamlValidatePartial: (_|_){ 1931 - // [structural cycle] 1932 - x: (_|_){ 1933 - // [structural cycle] selfCycle.yamlValidatePartial.x.y.y: structural cycle: 1934 - // ./yamlcycle.cue:44:29 1935 - } 1936 - } 1937 - } 1938 - } 405 + ./yamlcycle.cue:46:8 406 + [structural_cycle] selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 407 + ./yamlcycle.cue:56:8 408 + [structural_cycle] selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 409 + ./yamlcycle.cue:56:8 410 + [structural_cycle] selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 411 + ./yamlcycle.cue:60:8 412 + ./yamlcycle.cue:61:8 1939 413 -- out/compile -- 1940 414 --- cycle.cue 1941 415 { ··· 2023 497 } 2024 498 --- in.cue 2025 499 { 2026 - builtinCyclePerm0: { 2027 - X: "mod.test" 2028 - Y: { 2029 - #components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉) 2030 - host: 〈0;#components〉.host 2031 - } 2032 - X: 〈0;Y〉.host 2033 - } 2034 - builtinCyclePerm1: { 2035 - X: 〈0;Y〉.host 2036 - Y: { 2037 - #components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉) 2038 - host: 〈0;#components〉.host 2039 - } 2040 - X: "mod.test" 2041 - } 2042 - builtinCyclePerm2: { 2043 - Y: { 2044 - #components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉) 2045 - host: 〈0;#components〉.host 2046 - } 2047 - X: 〈0;Y〉.host 500 + builtinCyclePerm: { 2048 501 X: "mod.test" 2049 - } 2050 - builtinCyclePerm3: { 2051 502 Y: { 2052 503 #components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉) 2053 504 host: 〈0;#components〉.host 2054 505 } 2055 - X: "mod.test" 2056 506 X: 〈0;Y〉.host 2057 - } 2058 - builtinCyclePerm4: { 2059 - X: "mod.test" 2060 - X: 〈0;Y〉.host 2061 - Y: { 2062 - #components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉) 2063 - host: 〈0;#components〉.host 2064 - } 2065 - } 2066 - builtinCyclePerm5: { 2067 - X: 〈0;Y〉.host 2068 - X: "mod.test" 2069 - Y: { 2070 - #components: 〈import;regexp〉.FindNamedSubmatch("^(?P<host>[[:alnum:].]+)$", 〈1;X〉) 2071 - host: 〈0;#components〉.host 2072 - } 2073 507 } 2074 508 } 2075 509 --- issue3634.cue
+359 -1623
cue/testdata/cycle/comprehension.txtar
··· 1 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 2 1 -- in.cue -- 3 2 import ( 4 3 "list" ··· 11 10 a: { 12 11 parent: "" 13 12 children: [for k, v in A if v.parent == k {k}] 14 - } 13 + } @test(eq, {parent: "", children: []}) 15 14 b: { 16 15 parent: "a" 17 16 children: [for k, v in A if v.parent == k {k}] 18 - } 17 + } @test(eq, {parent: "a", children: []}) 19 18 } 20 19 21 20 // This should result in an incomplete error (a reference cycle error classifies ··· 24 23 a: { 25 24 parent: "" 26 25 children: [for k, v in B for _, w in v.children {k}] 27 - } 26 + } @test(eq, { 27 + parent: "" 28 + children: _|_ @test(err, code=incomplete, contains="B.a.children: cannot range over v.children (incomplete type list)", pos=[24:40]) 29 + }) 28 30 } 29 31 30 - // Issue #486 32 + // Issue #486: stack overflow in v0.3.0 when evaluating parametric fields with 33 + // conditional comprehensions; the same code worked correctly in v0.2.0. 34 + // https://cuelang.org/issue/486 31 35 Issue486: { 32 36 A: { 33 37 a: { ··· 52 56 }, 53 57 ] 54 58 } 59 + @test(eq, { 60 + A: { 61 + a: {parent: "", children: ["b"]} 62 + b: {parent: "a", children: ["c"]} 63 + c: {parent: "b", children: []} 64 + } 65 + }) 55 66 } 56 67 57 - // Issue #1666 68 + // Issue #1666: evaluator hangs indefinitely when combining disjunctions with 69 + // for comprehensions iterating over mapped fields. 70 + // https://cuelang.org/issue/1666 58 71 issue1666: { 59 72 #E: { 60 73 f1: [string]: #E | [...#E] ··· 71 84 } 72 85 } 73 86 } 87 + @test(eq, { 88 + #E: {f1: {}, f2: {}} 89 + _e: {f2: {a: {t: {f1: {}, f2: {}}}}, f1: {}} 90 + e: { 91 + f1: {a: {f1: {}, f2: {}}} 92 + f2: {a: {t: {f1: {}, f2: {}}}} 93 + } 94 + }) 74 95 } 75 96 76 - // Issue #779: bidirectional projection 97 + // Issue #779: for comprehension incorrectly rejected valid bidirectional 98 + // projection patterns, reporting a cycle error even when no true cycle exists. 77 99 // Should be allowed as long as the set of fields is not modified as a result 78 100 // of a comprehension. 101 + // https://cuelang.org/issue/779 79 102 issue779: { 80 103 X: Y.message 81 104 STATE: { ··· 88 111 Y: STATE & { message: X } 89 112 X: "test" 90 113 STATE: { code: 101 } 114 + @test(eq, { 115 + X: "test" 116 + STATE: {code: 101} 117 + Y: {message: "test", code: 101} 118 + }) 91 119 } 92 120 121 + // Issue #1934: regression in v0.4.1 where nested comprehensions referencing 122 + // fields within the same struct were incorrectly reported as cycles. 93 123 // Comprehension ends up inserting in the same arcs over which it 94 124 // is iterating. This is fine as long as the set is not altered. 95 - // Issue #1934 125 + // https://cuelang.org/issue/1934 96 126 selfReferential: T1: { 97 127 S: d: "bar" 98 128 ··· 101 131 for s, v in S for t, _ in T { 102 132 T: (t): S: (s): v 103 133 } 134 + @test(eq, { 135 + S: {d: "bar"} 136 + T: {e: {S: {a: "foo", d: "bar"}}} 137 + }) 104 138 } 105 139 106 - // selfReferential comprehenion for list. 107 - // Issue #1934 140 + // selfReferential comprehension for list. 141 + // https://cuelang.org/issue/1934 108 142 selfReferential: list: { 109 143 panels: [ 110 144 for i, _ in panels { ··· 112 146 } 113 147 ] 114 148 panels: [{}, {}, {}] 149 + @test(eq, {panels: [{id: 0}, {id: 1}, {id: 2}]}) 115 150 } 116 151 117 152 selfReferential: insertionError: { ··· 123 158 // defined. 124 159 ("foo3"): 1 125 160 } 161 + @test(err, code=eval, contains="adding field foo3 not allowed as field set was already referenced", pos=[6:14]) 126 162 } 127 163 } 128 164 ··· 140 176 #Output: or([for name, config in #AllOutputs { 141 177 (name): config 142 178 }]) 179 + @test(eq, { 180 + o: {retry: {reject: "ok"}} 181 + #AllOutputs: { 182 + reject: string 183 + resource: string 184 + retry: {reject: string} | {resource: string} 185 + } 186 + #Output: {reject: string} | {resource: string} 187 + }) 143 188 } 144 189 145 190 selfReferential: acrossOr: t1: p2: { ··· 154 199 resource: string 155 200 retry: #Output 156 201 } 202 + @test(eq, { 203 + #Output: {reject: string} | {resource: string} 204 + o: {retry: {reject: "ok"}} 205 + #AllOutputs: { 206 + reject: string 207 + resource: string 208 + retry: {reject: string} | {resource: string} 209 + } 210 + }) 157 211 } 158 212 159 213 selfReferential: acrossOr: t1: p3: { ··· 168 222 } 169 223 170 224 o: #Output & { retry: reject: "ok" } 225 + @test(eq, { 226 + #Output: {reject: string} | {resource: string} 227 + #AllOutputs: { 228 + reject: string 229 + resource: string 230 + retry: {reject: string} | {resource: string} 231 + } 232 + o: {retry: {reject: "ok"}} 233 + }) 171 234 } 172 235 173 236 selfReferential: acrossOr: t2: p1: { ··· 178 241 d2: string 179 242 d3: b: d 180 243 } 244 + @test(eq, { 245 + d: int | string 246 + o: {b: 2} 247 + #A: { 248 + d1: int 249 + d2: string 250 + d3: {b: int | string} 251 + } 252 + }) 181 253 } 182 254 183 255 selfReferential: acrossOr: t2: p2: { ··· 188 260 d2: string 189 261 d3: b: d 190 262 } 263 + @test(eq, { 264 + o: {b: 2} 265 + d: int | string 266 + #A: { 267 + d1: int 268 + d2: string 269 + d3: {b: int | string} 270 + } 271 + }) 191 272 } 192 273 193 274 selfReferential: acrossOr: t2: p3: { ··· 198 279 d3: b: d 199 280 } 200 281 d: or([for x, y in #A { y }]) 282 + @test(eq, { 283 + o: {b: 2} 284 + #A: { 285 + d1: int 286 + d2: string 287 + d3: {b: int | string} 288 + } 289 + d: int | string 290 + }) 201 291 } 202 292 293 + // Issue #1881: evaluator required the source of a for comprehension to be 294 + // fully evaluated before iterating, causing false structural cycle errors. 295 + // https://cuelang.org/issue/1881 203 296 issue1881: p1: { 204 297 o: #Output & { retry: output: reject: "ok" } 205 298 ··· 212 305 #Output: or([for name, config in #AllOutputs { 213 306 (name): config 214 307 }]) 308 + @test(eq, { 309 + o: {retry: {output: {reject: "ok"}}} 310 + #AllOutputs: { 311 + reject: string 312 + resource: string 313 + retry: { 314 + output: {reject: string} | {resource: string} 315 + } 316 + } 317 + #Output: {reject: string} | {resource: string} 318 + }) 215 319 } 216 320 217 321 issue1881: p2: { ··· 226 330 #Output: or([for name, config in #AllOutputs { 227 331 (name): config 228 332 }]) 333 + @test(eq, { 334 + #AllOutputs: { 335 + reject: string 336 + resource: string 337 + retry: { 338 + output: {reject: string} | {resource: string} 339 + } 340 + } 341 + o: {retry: {output: {reject: "ok"}}} 342 + #Output: {reject: string} | {resource: string} 343 + }) 229 344 } 230 345 231 346 issue1881: p3: { ··· 240 355 }]) 241 356 242 357 o: #Output & { retry: output: reject: "ok" } 358 + @test(eq, { 359 + #AllOutputs: { 360 + reject: string 361 + resource: string 362 + retry: { 363 + output: {reject: string} | {resource: string} 364 + } 365 + } 366 + #Output: {reject: string} | {resource: string} 367 + o: {retry: {output: {reject: "ok"}}} 368 + }) 243 369 } 244 370 245 371 siblingInsertion: t1: p1: { ··· 254 380 for id, v in D { 255 381 deployment: (id): env2: ENV: "True" 256 382 } 383 + @test(eq, { 384 + D: {logging: _} 385 + deployment: { 386 + logging: { 387 + env2: {ENV: "True"} 388 + env: {ENV: "True"} 389 + } 390 + } 391 + }) 257 392 } 258 393 259 394 siblingInsertion: t1: p2: { ··· 268 403 for k1, v2 in v.env2 { 269 404 deployment: (k): env: (k1): v2 270 405 } 406 + @test(eq, { 407 + D: {logging: _} 408 + deployment: { 409 + logging: { 410 + env2: {ENV: "True"} 411 + env: {ENV: "True"} 412 + } 413 + } 414 + }) 271 415 } 272 416 273 417 siblingInsertion: t2: p1: { ··· 283 427 for id, v in D { 284 428 deployment: (id): env2: ENV: "True" 285 429 } 430 + @test(eq, { 431 + D: {logging: _} 432 + deployment: { 433 + logging: { 434 + env2: {ENV: "True"} 435 + env: {ENV: "True"} 436 + } 437 + } 438 + }) 286 439 } 287 440 288 441 siblingInsertion: t2: p2: { ··· 298 451 for id, v in D { 299 452 deployment: (id): env2: ENV: "True" 300 453 } 454 + @test(eq, { 455 + D: {logging: _} 456 + deployment: { 457 + logging: { 458 + env2: {ENV: "True"} 459 + env: {ENV: "True"} 460 + } 461 + } 462 + }) 301 463 } 302 464 303 - // Issue #1407 304 - // Ensure there is a useful error message. 465 + // Issue #1407: cue export produced a misleading, location-free "cycle error" 466 + // for incomplete values; the actual problem was an incomplete value, not a 467 + // true cycle. Ensure there is a useful error message. 468 + // https://cuelang.org/issue/1407 305 469 selfReferential: fail: { 306 470 a: {} 307 471 b: a.x != "" 308 472 if b { 309 473 } 474 + @test(err, code=incomplete, contains="undefined field: x", pos=[2:7]) 310 475 } 311 476 312 - // avoid infinite recursion 477 + // Issue #2367: stack overflow triggered by a comprehension that inserts into 478 + // the same field it iterates over; the evaluator recurses infinitely instead 479 + // of returning an error. 480 + // https://cuelang.org/issue/2367 313 481 issue2367: { 314 482 a: _ 315 483 for x in [a] {a: x} 484 + @test(eq, {a: _}) 316 485 } 317 486 318 - // evalv2 incorrectly reported structural cycles here. 487 + // Issue #2310: evalv2 incorrectly reported a structural cycle when a 488 + // comprehension contained three or more identical substitutions, despite the 489 + // same pattern working with two substitutions. 490 + // https://cuelang.org/issue/2310 319 491 issue2310: original: { 320 492 #s: {#_1: string, #_2: string, #_3: string, strings.Replace(#_1, #_2, #_3, -1)} 321 493 ··· 337 509 #s & {#_2: "c", #_3: "d", _}, 338 510 #s & {#_2: "e", #_3: "f", _}, 339 511 ] 512 + @test(eq, { 513 + #s: { 514 + _|_ 515 + #_1: string 516 + #_2: string 517 + #_3: string 518 + } 519 + #sub: { 520 + _|_ 521 + #a: string 522 + _#X: [string, 523 + {_|_, #_1: string, #_2: "a", #_3: "b"}, 524 + { 525 + _|_ 526 + #_1: {_|_, #_1: string, #_2: "a", #_3: "b"} 527 + #_2: "c" 528 + #_3: "d" 529 + }, 530 + { 531 + _|_ 532 + #_1: { 533 + _|_ 534 + #_1: {_|_, #_1: string, #_2: "a", #_3: "b"} 535 + #_2: "c" 536 + #_3: "d" 537 + } 538 + #_2: "e" 539 + #_3: "f" 540 + }] 541 + #_1: { 542 + _|_ 543 + #_1: {_|_, #_1: string, #_2: "a", #_3: "b"} 544 + #_2: "c" 545 + #_3: "d" 546 + } 547 + #_2: "e" 548 + #_3: "f" 549 + } 550 + res: { 551 + "bbb" 552 + #a: "aaa" 553 + _#X: ["aaa", 554 + {"bbb", #_1: "aaa", #_2: "a", #_3: "b"}, 555 + { 556 + "bbb" 557 + #_1: {"bbb", #_1: "aaa", #_2: "a", #_3: "b"} 558 + #_2: "c" 559 + #_3: "d" 560 + }, 561 + { 562 + "bbb" 563 + #_1: { 564 + "bbb" 565 + #_1: {"bbb", #_1: "aaa", #_2: "a", #_3: "b"} 566 + #_2: "c" 567 + #_3: "d" 568 + } 569 + #_2: "e" 570 + #_3: "f" 571 + }] 572 + #_1: { 573 + "bbb" 574 + #_1: {"bbb", #_1: "aaa", #_2: "a", #_3: "b"} 575 + #_2: "c" 576 + #_3: "d" 577 + } 578 + #_2: "e" 579 + #_3: "f" 580 + } 581 + #subs: [{_|_, #_2: "a", #_3: "b", #_1: string}, 582 + {_|_, #_2: "c", #_3: "d", #_1: string}, 583 + {_|_, #_2: "e", #_3: "f", #_1: string}] 584 + }) 340 585 } 341 586 issue2310: reduced: { 342 587 res: { ··· 348 593 349 594 #s: {#str: string, #str + "a"} 350 595 #subs: [0, 1, 2] 596 + @test(eq, { 597 + res: { 598 + "Xaaa" 599 + #X: ["X", 600 + {"Xa", #str: "X"}, 601 + {"Xaa", #str: {"Xa", #str: "X"}}, 602 + { 603 + "Xaaa" 604 + #str: {"Xaa", #str: {"Xa", #str: "X"}} 605 + }] 606 + #str: {"Xaa", #str: {"Xa", #str: "X"}} 607 + } 608 + #s: {_|_, #str: string} 609 + #subs: [0, 1, 2] 610 + }) 351 611 } 612 + 352 613 -- issue3903.cue -- 353 614 // evalv3 structural cycle regression: a schema with `_deps` and comprehensions 354 615 // over those deps triggered a spurious structural cycle error that exported ··· 367 628 } 368 629 ] 369 630 } 631 + @test(eq, { 632 + s1: { 633 + _deps: [{_deps: [], objs: []}] 634 + objs: [] 635 + } 636 + #Schema: {_deps: [], objs: []} 637 + }) 370 638 } 371 639 issue3903: full: { 372 640 s1: #Schema & { ··· 390 658 }, 391 659 ] 392 660 } 661 + @test(eq, { 662 + s1: { 663 + _deps: [{ 664 + _local: ["s2 local"] 665 + _deps: [] 666 + objs: ["s2 local"] 667 + }] 668 + _local: ["s1 local"] 669 + objs: ["s1 local", "s2 local"] 670 + } 671 + s2: { 672 + _local: ["s2 local"] 673 + _deps: [] 674 + objs: ["s2 local"] 675 + } 676 + #Schema: {_local: [], _deps: [], objs: []} 677 + }) 393 678 } 394 679 -- issue2405.cue -- 395 680 // A recursive disjunction type (`#Copy` with struct/list/scalar alternatives) ··· 418 703 419 704 foo: #Copy 420 705 foo: param: a: [{b: 134}] 706 + @test(eq, { 707 + #Copy: {param: {}, result: {}} | {param: [], result: []} | {param: number, result: number} 708 + foo: { 709 + param: {a: [{b: 134}]} 710 + result: {a: [{b: 134}]} 711 + } 712 + }) 421 713 } 422 714 -- issue3941.cue -- 423 715 // evalv3 regression: a comprehension iterating over a pattern-constrained field ··· 440 732 } 441 733 } 442 734 } 735 + @test(eq, { 736 + #Metadata: {name: string} 737 + #Resource: {metadata: {name: string}} 738 + out: { 739 + _metadata: {name: "foo"} 740 + resource: { 741 + level1: {foo: {metadata: {name: "foo"}}} 742 + } 743 + _names: ["foo"] 744 + } 745 + }) 443 746 } 444 747 -- issue2229.cue -- 445 748 // A list comprehension whose result was unified back into the same list caused ··· 450 753 test: bool | *true 451 754 452 755 make: [ for k, v in X if (v & true) != _|_ { k } ] 453 - } 756 + } @test(eq, { 757 + build: *true | bool 758 + test: *true | bool 759 + make: ["build", "test"] 760 + }) 454 761 issue2229: reduced_fail: X={ 455 762 x: true 456 763 y: [ for _, v in X if v & true { _ } ] 457 - } 764 + } @test(err, code=eval, 765 + suberr=(code=eval, contains="conflicting values", pos=[2:5, 2:24, 2:28]), 766 + suberr=(code=eval, contains="conflicting values", pos=[2:5, 2:24, 2:28]), 767 + suberr=(code=eval, contains="structural cycle", pos=[2:24]), 768 + ) 458 769 -- issue4100.cue -- 459 770 // Segmentation fault in `adt.(*OpContext).freeNodeContext` in v0.14.1, 460 771 // triggered by a let binding inside a conditional that feeds into a for loop. ··· 467 778 } 468 779 } 469 780 for _ in a {} 470 - } 471 - -- out/evalalpha -- 472 - Errors: 473 - conflicting values true and [for _, v in X if (v & true) {_}] (mismatched types bool and list): 474 - ./issue2229.cue:12:5 475 - ./issue2229.cue:12:24 476 - ./issue2229.cue:12:28 477 - selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 478 - ./in.cue:122:14 479 - structural cycle: 480 - ./issue2229.cue:12:24 481 - 482 - Result: 483 - (_|_){ 484 - // [eval] 485 - A: (struct){ 486 - a: (struct){ 487 - parent: (string){ "" } 488 - children: (#list){ 489 - } 490 - } 491 - b: (struct){ 492 - parent: (string){ "a" } 493 - children: (#list){ 494 - } 495 - } 496 - } 497 - B: (struct){ 498 - a: (struct){ 499 - parent: (string){ "" } 500 - children: (_|_){ 501 - // [incomplete] B.a.children: cannot range over v.children (incomplete type list): 502 - // ./in.cue:24:40 503 - } 504 - } 505 - } 506 - Issue486: (struct){ 507 - A: (struct){ 508 - a: (struct){ 509 - parent: (string){ "" } 510 - children: (#list){ 511 - 0: (string){ "b" } 512 - } 513 - } 514 - b: (struct){ 515 - parent: (string){ "a" } 516 - children: (#list){ 517 - 0: (string){ "c" } 518 - } 519 - } 520 - c: (struct){ 521 - parent: (string){ "b" } 522 - children: (#list){ 523 - } 524 - } 525 - } 526 - } 527 - issue1666: (struct){ 528 - #E: (#struct){ 529 - f1: (#struct){ 530 - } 531 - f2: (#struct){ 532 - } 533 - } 534 - _e: (#struct){ 535 - f2: (#struct){ 536 - a: (#struct){ 537 - t: ~(issue1666.#E) 538 - } 539 - } 540 - f1: (#struct){ 541 - } 542 - } 543 - e: (#struct){ 544 - f1: (#struct){ 545 - a: (#struct){ 546 - f1: (#struct){ 547 - } 548 - f2: (#struct){ 549 - } 550 - } 551 - } 552 - f2: (#struct){ 553 - a: (#struct){ 554 - t: ~(issue1666.#E) 555 - } 556 - } 557 - } 558 - } 559 - issue779: (struct){ 560 - X: (string){ "test" } 561 - STATE: (struct){ 562 - code: (int){ 101 } 563 - } 564 - Y: (struct){ 565 - message: (string){ "test" } 566 - code: (int){ 101 } 567 - } 568 - } 569 - selfReferential: (_|_){ 570 - // [eval] 571 - T1: (struct){ 572 - S: (struct){ 573 - d: (string){ "bar" } 574 - } 575 - T: (struct){ 576 - e: (struct){ 577 - S: (struct){ 578 - a: (string){ "foo" } 579 - d: (string){ "bar" } 580 - } 581 - } 582 - } 583 - } 584 - list: (struct){ 585 - panels: (#list){ 586 - 0: (struct){ 587 - id: (int){ 0 } 588 - } 589 - 1: (struct){ 590 - id: (int){ 1 } 591 - } 592 - 2: (struct){ 593 - id: (int){ 2 } 594 - } 595 - } 596 - } 597 - insertionError: (_|_){ 598 - // [eval] 599 - A: (_|_){ 600 - // [eval] selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 601 - // ./in.cue:122:14 602 - foo: (int){ 1 } 603 - } 604 - } 605 - acrossOr: (struct){ 606 - t1: (struct){ 607 - p1: (struct){ 608 - o: (#struct){ 609 - retry: (#struct){ 610 - reject: (string){ "ok" } 611 - } 612 - } 613 - #AllOutputs: (#struct){ 614 - reject: (string){ string } 615 - resource: (string){ string } 616 - retry: (#struct){ |((#struct){ 617 - reject: (string){ string } 618 - }, (#struct){ 619 - resource: (string){ string } 620 - }) } 621 - } 622 - #Output: (#struct){ |((#struct){ 623 - reject: (string){ string } 624 - }, (#struct){ 625 - resource: (string){ string } 626 - }) } 627 - } 628 - p2: (struct){ 629 - #Output: (#struct){ |((#struct){ 630 - reject: (string){ string } 631 - }, (#struct){ 632 - resource: (string){ string } 633 - }) } 634 - o: (#struct){ 635 - retry: (#struct){ 636 - reject: (string){ "ok" } 637 - } 638 - } 639 - #AllOutputs: (#struct){ 640 - reject: (string){ string } 641 - resource: (string){ string } 642 - retry: (#struct){ |((#struct){ 643 - reject: (string){ string } 644 - }, (#struct){ 645 - resource: (string){ string } 646 - }) } 647 - } 648 - } 649 - p3: (struct){ 650 - #Output: (#struct){ |((#struct){ 651 - reject: (string){ string } 652 - }, (#struct){ 653 - resource: (string){ string } 654 - }) } 655 - #AllOutputs: (#struct){ 656 - reject: (string){ string } 657 - resource: (string){ string } 658 - retry: (#struct){ |((#struct){ 659 - reject: (string){ string } 660 - }, (#struct){ 661 - resource: (string){ string } 662 - }) } 663 - } 664 - o: (#struct){ 665 - retry: (#struct){ 666 - reject: (string){ "ok" } 667 - } 668 - } 669 - } 670 - } 671 - t2: (struct){ 672 - p1: (struct){ 673 - d: ((int|string)){ |((int){ int }, (string){ string }) } 674 - o: (struct){ 675 - b: (int){ 2 } 676 - } 677 - #A: (#struct){ 678 - d1: (int){ int } 679 - d2: (string){ string } 680 - d3: (#struct){ 681 - b: ((int|string)){ |((int){ int }, (string){ string }) } 682 - } 683 - } 684 - } 685 - p2: (struct){ 686 - o: (struct){ 687 - b: (int){ 2 } 688 - } 689 - d: ((int|string)){ |((int){ int }, (string){ string }) } 690 - #A: (#struct){ 691 - d1: (int){ int } 692 - d2: (string){ string } 693 - d3: (#struct){ 694 - b: ((int|string)){ |((int){ int }, (string){ string }) } 695 - } 696 - } 697 - } 698 - p3: (struct){ 699 - o: (struct){ 700 - b: (int){ 2 } 701 - } 702 - #A: (#struct){ 703 - d1: (int){ int } 704 - d2: (string){ string } 705 - d3: (#struct){ 706 - b: ((int|string)){ |((int){ int }, (string){ string }) } 707 - } 708 - } 709 - d: ((int|string)){ |((int){ int }, (string){ string }) } 710 - } 711 - } 712 - } 713 - fail: (_|_){ 714 - // [incomplete] selfReferential.fail.b: undefined field: x: 715 - // ./in.cue:305:7 716 - a: (struct){ 717 - } 718 - b: (_|_){ 719 - // [incomplete] selfReferential.fail.b: undefined field: x: 720 - // ./in.cue:305:7 721 - } 722 - } 723 - } 724 - issue1881: (struct){ 725 - p1: (struct){ 726 - o: (#struct){ 727 - retry: (#struct){ 728 - output: (#struct){ 729 - reject: (string){ "ok" } 730 - } 731 - } 732 - } 733 - #AllOutputs: (#struct){ 734 - reject: (string){ string } 735 - resource: (string){ string } 736 - retry: (#struct){ 737 - output: (#struct){ |((#struct){ 738 - reject: (string){ string } 739 - }, (#struct){ 740 - resource: (string){ string } 741 - }) } 742 - } 743 - } 744 - #Output: (#struct){ |((#struct){ 745 - reject: (string){ string } 746 - }, (#struct){ 747 - resource: (string){ string } 748 - }) } 749 - } 750 - p2: (struct){ 751 - #AllOutputs: (#struct){ 752 - reject: (string){ string } 753 - resource: (string){ string } 754 - retry: (#struct){ 755 - output: (#struct){ |((#struct){ 756 - reject: (string){ string } 757 - }, (#struct){ 758 - resource: (string){ string } 759 - }) } 760 - } 761 - } 762 - o: (#struct){ 763 - retry: (#struct){ 764 - output: (#struct){ 765 - reject: (string){ "ok" } 766 - } 767 - } 768 - } 769 - #Output: (#struct){ |((#struct){ 770 - reject: (string){ string } 771 - }, (#struct){ 772 - resource: (string){ string } 773 - }) } 774 - } 775 - p3: (struct){ 776 - #AllOutputs: (#struct){ 777 - reject: (string){ string } 778 - resource: (string){ string } 779 - retry: (#struct){ 780 - output: (#struct){ |((#struct){ 781 - reject: (string){ string } 782 - }, (#struct){ 783 - resource: (string){ string } 784 - }) } 785 - } 786 - } 787 - #Output: (#struct){ |((#struct){ 788 - reject: (string){ string } 789 - }, (#struct){ 790 - resource: (string){ string } 791 - }) } 792 - o: (#struct){ 793 - retry: (#struct){ 794 - output: (#struct){ 795 - reject: (string){ "ok" } 796 - } 797 - } 798 - } 799 - } 800 - } 801 - siblingInsertion: (struct){ 802 - t1: (struct){ 803 - p1: (struct){ 804 - D: (struct){ 805 - logging: (_){ _ } 806 - } 807 - deployment: (struct){ 808 - logging: (struct){ 809 - env2: (struct){ 810 - ENV: (string){ "True" } 811 - } 812 - env: (struct){ 813 - ENV: (string){ "True" } 814 - } 815 - } 816 - } 817 - } 818 - p2: (struct){ 819 - D: (struct){ 820 - logging: (_){ _ } 821 - } 822 - deployment: (struct){ 823 - logging: (struct){ 824 - env2: (struct){ 825 - ENV: (string){ "True" } 826 - } 827 - env: (struct){ 828 - ENV: (string){ "True" } 829 - } 830 - } 831 - } 832 - } 833 - } 834 - t2: (struct){ 835 - p1: (struct){ 836 - D: (struct){ 837 - logging: (_){ _ } 838 - } 839 - deployment: (struct){ 840 - logging: (struct){ 841 - env2: (struct){ 842 - ENV: (string){ "True" } 843 - } 844 - env: (struct){ 845 - ENV: (string){ "True" } 846 - } 847 - } 848 - } 849 - } 850 - p2: (struct){ 851 - D: (struct){ 852 - logging: (_){ _ } 853 - } 854 - deployment: (struct){ 855 - logging: (struct){ 856 - env2: (struct){ 857 - ENV: (string){ "True" } 858 - } 859 - env: (struct){ 860 - ENV: (string){ "True" } 861 - } 862 - } 863 - } 864 - } 865 - } 866 - } 867 - issue2367: (struct){ 868 - a: (_){ _ } 869 - } 870 - issue2310: (struct){ 871 - original: (struct){ 872 - #s: (_|_){ 873 - // [incomplete] issue2310.original.#s: error in call to strings.Replace: non-concrete value string: 874 - // ./in.cue:318:46 875 - // ./in.cue:318:38 876 - #_1: (string){ string } 877 - #_2: (string){ string } 878 - #_3: (string){ string } 879 - } 880 - #sub: (_|_){ 881 - // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 882 - // ./in.cue:318:46 883 - // ./in.cue:318:12 884 - #a: (string){ string } 885 - _#X: (#list){ 886 - 0: (string){ string } 887 - 1: (_|_){ 888 - // [incomplete] issue2310.original.#sub._#X.1: error in call to strings.Replace: non-concrete value string: 889 - // ./in.cue:318:46 890 - // ./in.cue:318:12 891 - #_1: (string){ string } 892 - #_2: (string){ "a" } 893 - #_3: (string){ "b" } 894 - } 895 - 2: (_|_){ 896 - // [incomplete] issue2310.original.#sub._#X.2.#_1: error in call to strings.Replace: non-concrete value string: 897 - // ./in.cue:318:46 898 - // ./in.cue:318:12 899 - #_1: (_|_){ 900 - // [incomplete] issue2310.original.#sub._#X.2.#_1: error in call to strings.Replace: non-concrete value string: 901 - // ./in.cue:318:46 902 - // ./in.cue:318:12 903 - #_1: (string){ string } 904 - #_2: (string){ "a" } 905 - #_3: (string){ "b" } 906 - } 907 - #_2: (string){ "c" } 908 - #_3: (string){ "d" } 909 - } 910 - 3: (_|_){ 911 - // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 912 - // ./in.cue:318:46 913 - // ./in.cue:318:12 914 - #_1: (_|_){ 915 - // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 916 - // ./in.cue:318:46 917 - // ./in.cue:318:12 918 - #_1: (_|_){ 919 - // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 920 - // ./in.cue:318:46 921 - // ./in.cue:318:12 922 - #_1: (string){ string } 923 - #_2: (string){ "a" } 924 - #_3: (string){ "b" } 925 - } 926 - #_2: (string){ "c" } 927 - #_3: (string){ "d" } 928 - } 929 - #_2: (string){ "e" } 930 - #_3: (string){ "f" } 931 - } 932 - } 933 - #_1: (_|_){ 934 - // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 935 - // ./in.cue:318:46 936 - // ./in.cue:318:12 937 - #_1: (_|_){ 938 - // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 939 - // ./in.cue:318:46 940 - // ./in.cue:318:12 941 - #_1: (string){ string } 942 - #_2: (string){ "a" } 943 - #_3: (string){ "b" } 944 - } 945 - #_2: (string){ "c" } 946 - #_3: (string){ "d" } 947 - } 948 - #_2: (string){ "e" } 949 - #_3: (string){ "f" } 950 - } 951 - res: (string){ 952 - "bbb" 953 - #a: (string){ "aaa" } 954 - _#X: (#list){ 955 - 0: (string){ "aaa" } 956 - 1: (string){ 957 - "bbb" 958 - #_1: (string){ "aaa" } 959 - #_2: (string){ "a" } 960 - #_3: (string){ "b" } 961 - } 962 - 2: (string){ 963 - "bbb" 964 - #_1: (string){ 965 - "bbb" 966 - #_1: (string){ "aaa" } 967 - #_2: (string){ "a" } 968 - #_3: (string){ "b" } 969 - } 970 - #_2: (string){ "c" } 971 - #_3: (string){ "d" } 972 - } 973 - 3: (string){ 974 - "bbb" 975 - #_1: (string){ 976 - "bbb" 977 - #_1: (string){ 978 - "bbb" 979 - #_1: (string){ "aaa" } 980 - #_2: (string){ "a" } 981 - #_3: (string){ "b" } 982 - } 983 - #_2: (string){ "c" } 984 - #_3: (string){ "d" } 985 - } 986 - #_2: (string){ "e" } 987 - #_3: (string){ "f" } 988 - } 989 - } 990 - #_1: (string){ 991 - "bbb" 992 - #_1: (string){ 993 - "bbb" 994 - #_1: (string){ "aaa" } 995 - #_2: (string){ "a" } 996 - #_3: (string){ "b" } 997 - } 998 - #_2: (string){ "c" } 999 - #_3: (string){ "d" } 1000 - } 1001 - #_2: (string){ "e" } 1002 - #_3: (string){ "f" } 1003 - } 1004 - #subs: (#list){ 1005 - 0: (_|_){ 1006 - // [incomplete] issue2310.original.#subs.0: error in call to strings.Replace: non-concrete value string: 1007 - // ./in.cue:318:46 1008 - // ./in.cue:318:12 1009 - #_2: (string){ "a" } 1010 - #_3: (string){ "b" } 1011 - #_1: (string){ string } 1012 - } 1013 - 1: (_|_){ 1014 - // [incomplete] issue2310.original.#subs.1: error in call to strings.Replace: non-concrete value string: 1015 - // ./in.cue:318:46 1016 - // ./in.cue:318:12 1017 - #_2: (string){ "c" } 1018 - #_3: (string){ "d" } 1019 - #_1: (string){ string } 1020 - } 1021 - 2: (_|_){ 1022 - // [incomplete] issue2310.original.#subs.2: error in call to strings.Replace: non-concrete value string: 1023 - // ./in.cue:318:46 1024 - // ./in.cue:318:12 1025 - #_2: (string){ "e" } 1026 - #_3: (string){ "f" } 1027 - #_1: (string){ string } 1028 - } 1029 - } 1030 - } 1031 - reduced: (struct){ 1032 - res: (string){ 1033 - "Xaaa" 1034 - #X: (#list){ 1035 - 0: (string){ "X" } 1036 - 1: (string){ 1037 - "Xa" 1038 - #str: (string){ "X" } 1039 - } 1040 - 2: (string){ 1041 - "Xaa" 1042 - #str: (string){ 1043 - "Xa" 1044 - #str: (string){ "X" } 1045 - } 1046 - } 1047 - 3: (string){ 1048 - "Xaaa" 1049 - #str: (string){ 1050 - "Xaa" 1051 - #str: (string){ 1052 - "Xa" 1053 - #str: (string){ "X" } 1054 - } 1055 - } 1056 - } 1057 - } 1058 - #str: (string){ 1059 - "Xaa" 1060 - #str: (string){ 1061 - "Xa" 1062 - #str: (string){ "X" } 1063 - } 1064 - } 1065 - } 1066 - #s: (_|_){ 1067 - // [incomplete] issue2310.reduced.#s: non-concrete value string in operand to +: 1068 - // ./in.cue:347:21 1069 - // ./in.cue:347:13 1070 - #str: (string){ string } 1071 - } 1072 - #subs: (#list){ 1073 - 0: (int){ 0 } 1074 - 1: (int){ 1 } 1075 - 2: (int){ 2 } 1076 - } 1077 - } 1078 - } 1079 - issue2229: (_|_){ 1080 - // [eval] 1081 - full_ok: (struct){ 1082 - build: (bool){ |(*(bool){ true }, (bool){ bool }) } 1083 - test: (bool){ |(*(bool){ true }, (bool){ bool }) } 1084 - make: (#list){ 1085 - 0: (string){ "build" } 1086 - 1: (string){ "test" } 1087 - } 1088 - } 1089 - reduced_fail: (_|_){ 1090 - // [eval] 1091 - x: (bool){ true } 1092 - y: (_|_){ 1093 - // [eval] conflicting values true and [for _, v in X if (v & true) {_}] (mismatched types bool and list): 1094 - // ./issue2229.cue:12:5 1095 - // ./issue2229.cue:12:24 1096 - // ./issue2229.cue:12:28 1097 - // structural cycle: 1098 - // ./issue2229.cue:12:24 1099 - 0: (_){ _ } 1100 - } 1101 - } 1102 - } 1103 - issue2405: (struct){ 1104 - #Copy: (#struct){ |((#struct){ 1105 - param: (#struct){ 1106 - } 1107 - result: (#struct){ 1108 - } 1109 - }, (#struct){ 1110 - param: (list){ 1111 - } 1112 - result: (#list){ 1113 - } 1114 - }, (#struct){ 1115 - param: (number){ number } 1116 - result: (number){ number } 1117 - }) } 1118 - foo: (#struct){ 1119 - param: (#struct){ 1120 - a: (#list){ 1121 - 0: (struct){ 1122 - b: (int){ 134 } 1123 - } 1124 - } 1125 - } 1126 - result: (#struct){ 1127 - a: (#list){ 1128 - 0: (#struct){ 1129 - b: (int){ 134 } 1130 - } 1131 - } 1132 - } 1133 - } 1134 - } 1135 - issue3903: (struct){ 1136 - reduced: (struct){ 1137 - s1: (#struct){ 1138 - _deps: (#list){ 1139 - 0: ~(issue3903.reduced.#Schema) 1140 - } 1141 - objs: (#list){ 1142 - } 1143 - } 1144 - #Schema: (#struct){ 1145 - _deps: (list){ 1146 - } 1147 - objs: (#list){ 1148 - } 1149 - } 1150 - } 1151 - full: (struct){ 1152 - s1: (#struct){ 1153 - _deps: (#list){ 1154 - 0: (#struct){ 1155 - _local: (#list){ 1156 - 0: (string){ "s2 local" } 1157 - } 1158 - _deps: (list){ 1159 - } 1160 - objs: (#list){ 1161 - 0: (string){ "s2 local" } 1162 - } 1163 - } 1164 - } 1165 - _local: (#list){ 1166 - 0: (string){ "s1 local" } 1167 - } 1168 - objs: (#list){ 1169 - 0: (string){ "s1 local" } 1170 - 1: (string){ "s2 local" } 1171 - } 1172 - } 1173 - s2: (#struct){ 1174 - _local: (#list){ 1175 - 0: (string){ "s2 local" } 1176 - } 1177 - _deps: (list){ 1178 - } 1179 - objs: (#list){ 1180 - 0: (string){ "s2 local" } 1181 - } 1182 - } 1183 - #Schema: (#struct){ 1184 - _local: (list){ 1185 - } 1186 - _deps: (list){ 1187 - } 1188 - objs: (#list){ 1189 - } 1190 - } 1191 - } 1192 - } 1193 - issue3941: (struct){ 1194 - full: (struct){ 1195 - #Metadata: (#struct){ 1196 - name: (string){ string } 1197 - } 1198 - #Resource: (#struct){ 1199 - metadata: ~(issue3941.full.#Metadata) 1200 - } 1201 - out: (struct){ 1202 - _metadata: (struct){ 1203 - name: (string){ "foo" } 1204 - } 1205 - resource: (struct){ 1206 - level1: (struct){ 1207 - foo: (#struct){ 1208 - metadata: (#struct){ 1209 - name: (string){ "foo" } 1210 - } 1211 - } 1212 - } 1213 - } 1214 - _names: (#list){ 1215 - 0: (string){ "foo" } 1216 - } 1217 - } 1218 - } 1219 - } 1220 - issue4100: (struct){ 1221 - a: (#list){ 1222 - let l#1 = (#list){ 1223 - 0: (int){ 0 } 1224 - } 1225 - 0: (int){ 0 } 1226 - } 1227 - } 781 + @test(eq, {a: [0]}) 1228 782 } 1229 - -- diff/-out/evalalpha<==>+out/eval -- 1230 - diff old new 1231 - --- old 1232 - +++ new 1233 - @@ -1,6 +1,12 @@ 1234 - Errors: 1235 - +conflicting values true and [for _, v in X if (v & true) {_}] (mismatched types bool and list): 1236 - + ./issue2229.cue:12:5 1237 - + ./issue2229.cue:12:24 1238 - + ./issue2229.cue:12:28 1239 - selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 1240 - ./in.cue:122:14 1241 - +structural cycle: 1242 - + ./issue2229.cue:12:24 1243 - 1244 - Result: 1245 - (_|_){ 1246 - @@ -55,12 +61,12 @@ 1247 - } 1248 - } 1249 - _e: (#struct){ 1250 - - f1: (#struct){ 1251 - - } 1252 - - f2: (#struct){ 1253 - - a: (#struct){ 1254 - - t: ~(issue1666.#E) 1255 - - } 1256 - + f2: (#struct){ 1257 - + a: (#struct){ 1258 - + t: ~(issue1666.#E) 1259 - + } 1260 - + } 1261 - + f1: (#struct){ 1262 - } 1263 - } 1264 - e: (#struct){ 1265 - @@ -529,25 +535,25 @@ 1266 - // [incomplete] issue2310.original.#subs.0: error in call to strings.Replace: non-concrete value string: 1267 - // ./in.cue:318:46 1268 - // ./in.cue:318:12 1269 - - #_1: (string){ string } 1270 - #_2: (string){ "a" } 1271 - #_3: (string){ "b" } 1272 - + #_1: (string){ string } 1273 - } 1274 - 1: (_|_){ 1275 - // [incomplete] issue2310.original.#subs.1: error in call to strings.Replace: non-concrete value string: 1276 - // ./in.cue:318:46 1277 - // ./in.cue:318:12 1278 - - #_1: (string){ string } 1279 - - #_2: (string){ "c" } 1280 - - #_3: (string){ "d" } 1281 - + #_2: (string){ "c" } 1282 - + #_3: (string){ "d" } 1283 - + #_1: (string){ string } 1284 - } 1285 - 2: (_|_){ 1286 - // [incomplete] issue2310.original.#subs.2: error in call to strings.Replace: non-concrete value string: 1287 - // ./in.cue:318:46 1288 - // ./in.cue:318:12 1289 - - #_1: (string){ string } 1290 - #_2: (string){ "e" } 1291 - #_3: (string){ "f" } 1292 - + #_1: (string){ string } 1293 - } 1294 - } 1295 - } 1296 - @@ -599,16 +605,67 @@ 1297 - } 1298 - } 1299 - } 1300 - + issue2229: (_|_){ 1301 - + // [eval] 1302 - + full_ok: (struct){ 1303 - + build: (bool){ |(*(bool){ true }, (bool){ bool }) } 1304 - + test: (bool){ |(*(bool){ true }, (bool){ bool }) } 1305 - + make: (#list){ 1306 - + 0: (string){ "build" } 1307 - + 1: (string){ "test" } 1308 - + } 1309 - + } 1310 - + reduced_fail: (_|_){ 1311 - + // [eval] 1312 - + x: (bool){ true } 1313 - + y: (_|_){ 1314 - + // [eval] conflicting values true and [for _, v in X if (v & true) {_}] (mismatched types bool and list): 1315 - + // ./issue2229.cue:12:5 1316 - + // ./issue2229.cue:12:24 1317 - + // ./issue2229.cue:12:28 1318 - + // structural cycle: 1319 - + // ./issue2229.cue:12:24 1320 - + 0: (_){ _ } 1321 - + } 1322 - + } 1323 - + } 1324 - + issue2405: (struct){ 1325 - + #Copy: (#struct){ |((#struct){ 1326 - + param: (#struct){ 1327 - + } 1328 - + result: (#struct){ 1329 - + } 1330 - + }, (#struct){ 1331 - + param: (list){ 1332 - + } 1333 - + result: (#list){ 1334 - + } 1335 - + }, (#struct){ 1336 - + param: (number){ number } 1337 - + result: (number){ number } 1338 - + }) } 1339 - + foo: (#struct){ 1340 - + param: (#struct){ 1341 - + a: (#list){ 1342 - + 0: (struct){ 1343 - + b: (int){ 134 } 1344 - + } 1345 - + } 1346 - + } 1347 - + result: (#struct){ 1348 - + a: (#list){ 1349 - + 0: (#struct){ 1350 - + b: (int){ 134 } 1351 - + } 1352 - + } 1353 - + } 1354 - + } 1355 - + } 1356 - issue3903: (struct){ 1357 - reduced: (struct){ 1358 - s1: (#struct){ 1359 - _deps: (#list){ 1360 - - 0: (#struct){ 1361 - - _deps: (list){ 1362 - - } 1363 - - objs: (#list){ 1364 - - } 1365 - - } 1366 - + 0: ~(issue3903.reduced.#Schema) 1367 - } 1368 - objs: (#list){ 1369 - } 1370 - @@ -689,4 +746,12 @@ 1371 - } 1372 - } 1373 - } 1374 - + issue4100: (struct){ 1375 - + a: (#list){ 1376 - + let l#1 = (#list){ 1377 - + 0: (int){ 0 } 1378 - + } 1379 - + 0: (int){ 0 } 1380 - + } 1381 - + } 1382 - } 1383 783 -- out/eval/stats -- 1384 784 Leaks: 91 1385 785 Freed: 821 ··· 1398 798 MaxConjunctInfos: 10 1399 799 MaxReqSets: 12 1400 800 MaxRedirect: 1 1401 - -- diff/explanation -- 1402 - B.a.children: now correctly marked as incomplete 1403 - -- out/eval -- 1404 - Errors: 1405 - selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 1406 - ./in.cue:122:14 1407 - 1408 - Result: 1409 - (_|_){ 1410 - // [eval] 1411 - A: (struct){ 1412 - a: (struct){ 1413 - parent: (string){ "" } 1414 - children: (#list){ 1415 - } 1416 - } 1417 - b: (struct){ 1418 - parent: (string){ "a" } 1419 - children: (#list){ 1420 - } 1421 - } 1422 - } 1423 - B: (struct){ 1424 - a: (struct){ 1425 - parent: (string){ "" } 1426 - children: (_|_){ 1427 - // [incomplete] B.a.children: cannot range over v.children (incomplete type list): 1428 - // ./in.cue:24:40 1429 - } 1430 - } 1431 - } 1432 - Issue486: (struct){ 1433 - A: (struct){ 1434 - a: (struct){ 1435 - parent: (string){ "" } 1436 - children: (#list){ 1437 - 0: (string){ "b" } 1438 - } 1439 - } 1440 - b: (struct){ 1441 - parent: (string){ "a" } 1442 - children: (#list){ 1443 - 0: (string){ "c" } 1444 - } 1445 - } 1446 - c: (struct){ 1447 - parent: (string){ "b" } 1448 - children: (#list){ 1449 - } 1450 - } 1451 - } 1452 - } 1453 - issue1666: (struct){ 1454 - #E: (#struct){ 1455 - f1: (#struct){ 1456 - } 1457 - f2: (#struct){ 1458 - } 1459 - } 1460 - _e: (#struct){ 1461 - f1: (#struct){ 1462 - } 1463 - f2: (#struct){ 1464 - a: (#struct){ 1465 - t: ~(issue1666.#E) 1466 - } 1467 - } 1468 - } 1469 - e: (#struct){ 1470 - f1: (#struct){ 1471 - a: (#struct){ 1472 - f1: (#struct){ 1473 - } 1474 - f2: (#struct){ 1475 - } 1476 - } 1477 - } 1478 - f2: (#struct){ 1479 - a: (#struct){ 1480 - t: ~(issue1666.#E) 1481 - } 1482 - } 1483 - } 1484 - } 1485 - issue779: (struct){ 1486 - X: (string){ "test" } 1487 - STATE: (struct){ 1488 - code: (int){ 101 } 1489 - } 1490 - Y: (struct){ 1491 - message: (string){ "test" } 1492 - code: (int){ 101 } 1493 - } 1494 - } 1495 - selfReferential: (_|_){ 1496 - // [eval] 1497 - T1: (struct){ 1498 - S: (struct){ 1499 - d: (string){ "bar" } 1500 - } 1501 - T: (struct){ 1502 - e: (struct){ 1503 - S: (struct){ 1504 - a: (string){ "foo" } 1505 - d: (string){ "bar" } 1506 - } 1507 - } 1508 - } 1509 - } 1510 - list: (struct){ 1511 - panels: (#list){ 1512 - 0: (struct){ 1513 - id: (int){ 0 } 1514 - } 1515 - 1: (struct){ 1516 - id: (int){ 1 } 1517 - } 1518 - 2: (struct){ 1519 - id: (int){ 2 } 1520 - } 1521 - } 1522 - } 1523 - insertionError: (_|_){ 1524 - // [eval] 1525 - A: (_|_){ 1526 - // [eval] selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 1527 - // ./in.cue:122:14 1528 - foo: (int){ 1 } 1529 - } 1530 - } 1531 - acrossOr: (struct){ 1532 - t1: (struct){ 1533 - p1: (struct){ 1534 - o: (#struct){ 1535 - retry: (#struct){ 1536 - reject: (string){ "ok" } 1537 - } 1538 - } 1539 - #AllOutputs: (#struct){ 1540 - reject: (string){ string } 1541 - resource: (string){ string } 1542 - retry: (#struct){ |((#struct){ 1543 - reject: (string){ string } 1544 - }, (#struct){ 1545 - resource: (string){ string } 1546 - }) } 1547 - } 1548 - #Output: (#struct){ |((#struct){ 1549 - reject: (string){ string } 1550 - }, (#struct){ 1551 - resource: (string){ string } 1552 - }) } 1553 - } 1554 - p2: (struct){ 1555 - #Output: (#struct){ |((#struct){ 1556 - reject: (string){ string } 1557 - }, (#struct){ 1558 - resource: (string){ string } 1559 - }) } 1560 - o: (#struct){ 1561 - retry: (#struct){ 1562 - reject: (string){ "ok" } 1563 - } 1564 - } 1565 - #AllOutputs: (#struct){ 1566 - reject: (string){ string } 1567 - resource: (string){ string } 1568 - retry: (#struct){ |((#struct){ 1569 - reject: (string){ string } 1570 - }, (#struct){ 1571 - resource: (string){ string } 1572 - }) } 1573 - } 1574 - } 1575 - p3: (struct){ 1576 - #Output: (#struct){ |((#struct){ 1577 - reject: (string){ string } 1578 - }, (#struct){ 1579 - resource: (string){ string } 1580 - }) } 1581 - #AllOutputs: (#struct){ 1582 - reject: (string){ string } 1583 - resource: (string){ string } 1584 - retry: (#struct){ |((#struct){ 1585 - reject: (string){ string } 1586 - }, (#struct){ 1587 - resource: (string){ string } 1588 - }) } 1589 - } 1590 - o: (#struct){ 1591 - retry: (#struct){ 1592 - reject: (string){ "ok" } 1593 - } 1594 - } 1595 - } 1596 - } 1597 - t2: (struct){ 1598 - p1: (struct){ 1599 - d: ((int|string)){ |((int){ int }, (string){ string }) } 1600 - o: (struct){ 1601 - b: (int){ 2 } 1602 - } 1603 - #A: (#struct){ 1604 - d1: (int){ int } 1605 - d2: (string){ string } 1606 - d3: (#struct){ 1607 - b: ((int|string)){ |((int){ int }, (string){ string }) } 1608 - } 1609 - } 1610 - } 1611 - p2: (struct){ 1612 - o: (struct){ 1613 - b: (int){ 2 } 1614 - } 1615 - d: ((int|string)){ |((int){ int }, (string){ string }) } 1616 - #A: (#struct){ 1617 - d1: (int){ int } 1618 - d2: (string){ string } 1619 - d3: (#struct){ 1620 - b: ((int|string)){ |((int){ int }, (string){ string }) } 1621 - } 1622 - } 1623 - } 1624 - p3: (struct){ 1625 - o: (struct){ 1626 - b: (int){ 2 } 1627 - } 1628 - #A: (#struct){ 1629 - d1: (int){ int } 1630 - d2: (string){ string } 1631 - d3: (#struct){ 1632 - b: ((int|string)){ |((int){ int }, (string){ string }) } 1633 - } 1634 - } 1635 - d: ((int|string)){ |((int){ int }, (string){ string }) } 1636 - } 1637 - } 1638 - } 1639 - fail: (_|_){ 1640 - // [incomplete] selfReferential.fail.b: undefined field: x: 1641 - // ./in.cue:305:7 1642 - a: (struct){ 1643 - } 1644 - b: (_|_){ 1645 - // [incomplete] selfReferential.fail.b: undefined field: x: 1646 - // ./in.cue:305:7 1647 - } 1648 - } 1649 - } 1650 - issue1881: (struct){ 1651 - p1: (struct){ 1652 - o: (#struct){ 1653 - retry: (#struct){ 1654 - output: (#struct){ 1655 - reject: (string){ "ok" } 1656 - } 1657 - } 1658 - } 1659 - #AllOutputs: (#struct){ 1660 - reject: (string){ string } 1661 - resource: (string){ string } 1662 - retry: (#struct){ 1663 - output: (#struct){ |((#struct){ 1664 - reject: (string){ string } 1665 - }, (#struct){ 1666 - resource: (string){ string } 1667 - }) } 1668 - } 1669 - } 1670 - #Output: (#struct){ |((#struct){ 1671 - reject: (string){ string } 1672 - }, (#struct){ 1673 - resource: (string){ string } 1674 - }) } 1675 - } 1676 - p2: (struct){ 1677 - #AllOutputs: (#struct){ 1678 - reject: (string){ string } 1679 - resource: (string){ string } 1680 - retry: (#struct){ 1681 - output: (#struct){ |((#struct){ 1682 - reject: (string){ string } 1683 - }, (#struct){ 1684 - resource: (string){ string } 1685 - }) } 1686 - } 1687 - } 1688 - o: (#struct){ 1689 - retry: (#struct){ 1690 - output: (#struct){ 1691 - reject: (string){ "ok" } 1692 - } 1693 - } 1694 - } 1695 - #Output: (#struct){ |((#struct){ 1696 - reject: (string){ string } 1697 - }, (#struct){ 1698 - resource: (string){ string } 1699 - }) } 1700 - } 1701 - p3: (struct){ 1702 - #AllOutputs: (#struct){ 1703 - reject: (string){ string } 1704 - resource: (string){ string } 1705 - retry: (#struct){ 1706 - output: (#struct){ |((#struct){ 1707 - reject: (string){ string } 1708 - }, (#struct){ 1709 - resource: (string){ string } 1710 - }) } 1711 - } 1712 - } 1713 - #Output: (#struct){ |((#struct){ 1714 - reject: (string){ string } 1715 - }, (#struct){ 1716 - resource: (string){ string } 1717 - }) } 1718 - o: (#struct){ 1719 - retry: (#struct){ 1720 - output: (#struct){ 1721 - reject: (string){ "ok" } 1722 - } 1723 - } 1724 - } 1725 - } 1726 - } 1727 - siblingInsertion: (struct){ 1728 - t1: (struct){ 1729 - p1: (struct){ 1730 - D: (struct){ 1731 - logging: (_){ _ } 1732 - } 1733 - deployment: (struct){ 1734 - logging: (struct){ 1735 - env2: (struct){ 1736 - ENV: (string){ "True" } 1737 - } 1738 - env: (struct){ 1739 - ENV: (string){ "True" } 1740 - } 1741 - } 1742 - } 1743 - } 1744 - p2: (struct){ 1745 - D: (struct){ 1746 - logging: (_){ _ } 1747 - } 1748 - deployment: (struct){ 1749 - logging: (struct){ 1750 - env2: (struct){ 1751 - ENV: (string){ "True" } 1752 - } 1753 - env: (struct){ 1754 - ENV: (string){ "True" } 1755 - } 1756 - } 1757 - } 1758 - } 1759 - } 1760 - t2: (struct){ 1761 - p1: (struct){ 1762 - D: (struct){ 1763 - logging: (_){ _ } 1764 - } 1765 - deployment: (struct){ 1766 - logging: (struct){ 1767 - env2: (struct){ 1768 - ENV: (string){ "True" } 1769 - } 1770 - env: (struct){ 1771 - ENV: (string){ "True" } 1772 - } 1773 - } 1774 - } 1775 - } 1776 - p2: (struct){ 1777 - D: (struct){ 1778 - logging: (_){ _ } 1779 - } 1780 - deployment: (struct){ 1781 - logging: (struct){ 1782 - env2: (struct){ 1783 - ENV: (string){ "True" } 1784 - } 1785 - env: (struct){ 1786 - ENV: (string){ "True" } 1787 - } 1788 - } 1789 - } 1790 - } 1791 - } 1792 - } 1793 - issue2367: (struct){ 1794 - a: (_){ _ } 1795 - } 1796 - issue2310: (struct){ 1797 - original: (struct){ 1798 - #s: (_|_){ 1799 - // [incomplete] issue2310.original.#s: error in call to strings.Replace: non-concrete value string: 1800 - // ./in.cue:318:46 1801 - // ./in.cue:318:38 1802 - #_1: (string){ string } 1803 - #_2: (string){ string } 1804 - #_3: (string){ string } 1805 - } 1806 - #sub: (_|_){ 1807 - // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1808 - // ./in.cue:318:46 1809 - // ./in.cue:318:12 1810 - #a: (string){ string } 1811 - _#X: (#list){ 1812 - 0: (string){ string } 1813 - 1: (_|_){ 1814 - // [incomplete] issue2310.original.#sub._#X.1: error in call to strings.Replace: non-concrete value string: 1815 - // ./in.cue:318:46 1816 - // ./in.cue:318:12 1817 - #_1: (string){ string } 1818 - #_2: (string){ "a" } 1819 - #_3: (string){ "b" } 1820 - } 1821 - 2: (_|_){ 1822 - // [incomplete] issue2310.original.#sub._#X.2.#_1: error in call to strings.Replace: non-concrete value string: 1823 - // ./in.cue:318:46 1824 - // ./in.cue:318:12 1825 - #_1: (_|_){ 1826 - // [incomplete] issue2310.original.#sub._#X.2.#_1: error in call to strings.Replace: non-concrete value string: 1827 - // ./in.cue:318:46 1828 - // ./in.cue:318:12 1829 - #_1: (string){ string } 1830 - #_2: (string){ "a" } 1831 - #_3: (string){ "b" } 1832 - } 1833 - #_2: (string){ "c" } 1834 - #_3: (string){ "d" } 1835 - } 1836 - 3: (_|_){ 1837 - // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1838 - // ./in.cue:318:46 1839 - // ./in.cue:318:12 1840 - #_1: (_|_){ 1841 - // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1842 - // ./in.cue:318:46 1843 - // ./in.cue:318:12 1844 - #_1: (_|_){ 1845 - // [incomplete] issue2310.original.#sub._#X.3.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1846 - // ./in.cue:318:46 1847 - // ./in.cue:318:12 1848 - #_1: (string){ string } 1849 - #_2: (string){ "a" } 1850 - #_3: (string){ "b" } 1851 - } 1852 - #_2: (string){ "c" } 1853 - #_3: (string){ "d" } 1854 - } 1855 - #_2: (string){ "e" } 1856 - #_3: (string){ "f" } 1857 - } 1858 - } 1859 - #_1: (_|_){ 1860 - // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1861 - // ./in.cue:318:46 1862 - // ./in.cue:318:12 1863 - #_1: (_|_){ 1864 - // [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 1865 - // ./in.cue:318:46 1866 - // ./in.cue:318:12 1867 - #_1: (string){ string } 1868 - #_2: (string){ "a" } 1869 - #_3: (string){ "b" } 1870 - } 1871 - #_2: (string){ "c" } 1872 - #_3: (string){ "d" } 1873 - } 1874 - #_2: (string){ "e" } 1875 - #_3: (string){ "f" } 1876 - } 1877 - res: (string){ 1878 - "bbb" 1879 - #a: (string){ "aaa" } 1880 - _#X: (#list){ 1881 - 0: (string){ "aaa" } 1882 - 1: (string){ 1883 - "bbb" 1884 - #_1: (string){ "aaa" } 1885 - #_2: (string){ "a" } 1886 - #_3: (string){ "b" } 1887 - } 1888 - 2: (string){ 1889 - "bbb" 1890 - #_1: (string){ 1891 - "bbb" 1892 - #_1: (string){ "aaa" } 1893 - #_2: (string){ "a" } 1894 - #_3: (string){ "b" } 1895 - } 1896 - #_2: (string){ "c" } 1897 - #_3: (string){ "d" } 1898 - } 1899 - 3: (string){ 1900 - "bbb" 1901 - #_1: (string){ 1902 - "bbb" 1903 - #_1: (string){ 1904 - "bbb" 1905 - #_1: (string){ "aaa" } 1906 - #_2: (string){ "a" } 1907 - #_3: (string){ "b" } 1908 - } 1909 - #_2: (string){ "c" } 1910 - #_3: (string){ "d" } 1911 - } 1912 - #_2: (string){ "e" } 1913 - #_3: (string){ "f" } 1914 - } 1915 - } 1916 - #_1: (string){ 1917 - "bbb" 1918 - #_1: (string){ 1919 - "bbb" 1920 - #_1: (string){ "aaa" } 1921 - #_2: (string){ "a" } 1922 - #_3: (string){ "b" } 1923 - } 1924 - #_2: (string){ "c" } 1925 - #_3: (string){ "d" } 1926 - } 1927 - #_2: (string){ "e" } 1928 - #_3: (string){ "f" } 1929 - } 1930 - #subs: (#list){ 1931 - 0: (_|_){ 1932 - // [incomplete] issue2310.original.#subs.0: error in call to strings.Replace: non-concrete value string: 1933 - // ./in.cue:318:46 1934 - // ./in.cue:318:12 1935 - #_1: (string){ string } 1936 - #_2: (string){ "a" } 1937 - #_3: (string){ "b" } 1938 - } 1939 - 1: (_|_){ 1940 - // [incomplete] issue2310.original.#subs.1: error in call to strings.Replace: non-concrete value string: 1941 - // ./in.cue:318:46 1942 - // ./in.cue:318:12 1943 - #_1: (string){ string } 1944 - #_2: (string){ "c" } 1945 - #_3: (string){ "d" } 1946 - } 1947 - 2: (_|_){ 1948 - // [incomplete] issue2310.original.#subs.2: error in call to strings.Replace: non-concrete value string: 1949 - // ./in.cue:318:46 1950 - // ./in.cue:318:12 1951 - #_1: (string){ string } 1952 - #_2: (string){ "e" } 1953 - #_3: (string){ "f" } 1954 - } 1955 - } 1956 - } 1957 - reduced: (struct){ 1958 - res: (string){ 1959 - "Xaaa" 1960 - #X: (#list){ 1961 - 0: (string){ "X" } 1962 - 1: (string){ 1963 - "Xa" 1964 - #str: (string){ "X" } 1965 - } 1966 - 2: (string){ 1967 - "Xaa" 1968 - #str: (string){ 1969 - "Xa" 1970 - #str: (string){ "X" } 1971 - } 1972 - } 1973 - 3: (string){ 1974 - "Xaaa" 1975 - #str: (string){ 1976 - "Xaa" 1977 - #str: (string){ 1978 - "Xa" 1979 - #str: (string){ "X" } 1980 - } 1981 - } 1982 - } 1983 - } 1984 - #str: (string){ 1985 - "Xaa" 1986 - #str: (string){ 1987 - "Xa" 1988 - #str: (string){ "X" } 1989 - } 1990 - } 1991 - } 1992 - #s: (_|_){ 1993 - // [incomplete] issue2310.reduced.#s: non-concrete value string in operand to +: 1994 - // ./in.cue:347:21 1995 - // ./in.cue:347:13 1996 - #str: (string){ string } 1997 - } 1998 - #subs: (#list){ 1999 - 0: (int){ 0 } 2000 - 1: (int){ 1 } 2001 - 2: (int){ 2 } 2002 - } 2003 - } 2004 - } 2005 - issue3903: (struct){ 2006 - reduced: (struct){ 2007 - s1: (#struct){ 2008 - _deps: (#list){ 2009 - 0: (#struct){ 2010 - _deps: (list){ 2011 - } 2012 - objs: (#list){ 2013 - } 2014 - } 2015 - } 2016 - objs: (#list){ 2017 - } 2018 - } 2019 - #Schema: (#struct){ 2020 - _deps: (list){ 2021 - } 2022 - objs: (#list){ 2023 - } 2024 - } 2025 - } 2026 - full: (struct){ 2027 - s1: (#struct){ 2028 - _deps: (#list){ 2029 - 0: (#struct){ 2030 - _local: (#list){ 2031 - 0: (string){ "s2 local" } 2032 - } 2033 - _deps: (list){ 2034 - } 2035 - objs: (#list){ 2036 - 0: (string){ "s2 local" } 2037 - } 2038 - } 2039 - } 2040 - _local: (#list){ 2041 - 0: (string){ "s1 local" } 2042 - } 2043 - objs: (#list){ 2044 - 0: (string){ "s1 local" } 2045 - 1: (string){ "s2 local" } 2046 - } 2047 - } 2048 - s2: (#struct){ 2049 - _local: (#list){ 2050 - 0: (string){ "s2 local" } 2051 - } 2052 - _deps: (list){ 2053 - } 2054 - objs: (#list){ 2055 - 0: (string){ "s2 local" } 2056 - } 2057 - } 2058 - #Schema: (#struct){ 2059 - _local: (list){ 2060 - } 2061 - _deps: (list){ 2062 - } 2063 - objs: (#list){ 2064 - } 2065 - } 2066 - } 2067 - } 2068 - issue3941: (struct){ 2069 - full: (struct){ 2070 - #Metadata: (#struct){ 2071 - name: (string){ string } 2072 - } 2073 - #Resource: (#struct){ 2074 - metadata: ~(issue3941.full.#Metadata) 2075 - } 2076 - out: (struct){ 2077 - _metadata: (struct){ 2078 - name: (string){ "foo" } 2079 - } 2080 - resource: (struct){ 2081 - level1: (struct){ 2082 - foo: (#struct){ 2083 - metadata: (#struct){ 2084 - name: (string){ "foo" } 2085 - } 2086 - } 2087 - } 2088 - } 2089 - _names: (#list){ 2090 - 0: (string){ "foo" } 2091 - } 2092 - } 2093 - } 2094 - } 2095 - } 801 + -- out/errors.txt -- 802 + [incomplete] B.a.children: cannot range over v.children (incomplete type list): 803 + ./in.cue:24:40 804 + [eval] selfReferential.insertionError.A: adding field foo3 not allowed as field set was already referenced: 805 + ./in.cue:158:14 806 + [incomplete] selfReferential.fail.b: undefined field: x: 807 + ./in.cue:470:7 808 + [incomplete] issue2310.original.#s: error in call to strings.Replace: non-concrete value string: 809 + ./in.cue:491:46 810 + ./in.cue:491:38 811 + [incomplete] issue2310.original.#sub.#_1.#_1: error in call to strings.Replace: non-concrete value string: 812 + ./in.cue:491:46 813 + ./in.cue:491:12 814 + [incomplete] issue2310.original.#subs.0: error in call to strings.Replace: non-concrete value string: 815 + ./in.cue:491:46 816 + ./in.cue:491:12 817 + [incomplete] issue2310.original.#subs.1: error in call to strings.Replace: non-concrete value string: 818 + ./in.cue:491:46 819 + ./in.cue:491:12 820 + [incomplete] issue2310.original.#subs.2: error in call to strings.Replace: non-concrete value string: 821 + ./in.cue:491:46 822 + ./in.cue:491:12 823 + [incomplete] issue2310.reduced.#s: non-concrete value string in operand to +: 824 + ./in.cue:593:21 825 + ./in.cue:593:13 826 + [eval] conflicting values true and [for _, v in X if (v & true) {_}] (mismatched types bool and list): 827 + ./issue2229.cue:16:5 828 + ./issue2229.cue:16:24 829 + ./issue2229.cue:16:28 830 + structural cycle: 831 + ./issue2229.cue:16:24 2096 832 -- out/compile -- 2097 833 --- in.cue 2098 834 {
+66 -268
cue/testdata/cycle/disjunction.txtar
··· 1 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 2 1 -- in.cue -- 3 2 // cycle is a structural cycle 4 - cycle: a: cycle 3 + cycle: a: cycle @test(err, code=structural_cycle, pos=[]) 5 4 6 5 // reference to outside structural cycle 7 - r1a: cycle | int 8 - r1b: int | cycle 6 + r1a: cycle | int @test(eq, int) 7 + r1b: int | cycle @test(eq, int) 9 8 10 - r2a: cycle | 1 11 - r2b: 1 | cycle 9 + r2a: cycle | 1 @test(eq, 1) 10 + r2b: 1 | cycle @test(eq, 1) 12 11 13 - r3a: cycle | null 14 - r3b: null | cycle 12 + r3a: cycle | null @test(eq, null) 13 + r3b: null | cycle @test(eq, null) 15 14 16 - r4a: cycle | {} 17 - r4b: {} | cycle 15 + r4a: cycle | {} @test(eq, {}) 16 + r4b: {} | cycle @test(eq, {}) 18 17 19 - r5a: cycle | [] 20 - r5b: [] | cycle 18 + r5a: cycle | [] @test(eq, []) 19 + r5b: [] | cycle @test(eq, []) 21 20 22 21 // reference to ancestor node 23 - s1a: x: s1a | int 24 - s1b: x: int | s1b 22 + s1a: { 23 + x: s1a | int 24 + @test(eq, {x: int}) 25 + } 26 + s1b: { 27 + x: int | s1b 28 + @test(eq, {x: int}) 29 + } 25 30 26 - s2a: x: s2a | 1 27 - s2b: x: 1 | s2b 31 + s2a: { 32 + x: s2a | 1 33 + @test(eq, {x: 1}) 34 + } 35 + s2b: { 36 + x: 1 | s2b 37 + @test(eq, {x: 1}) 38 + } 28 39 29 - s3a: x: s3a | null 30 - s3b: x: null | s3b 40 + s3a: { 41 + x: s3a | null 42 + @test(eq, {x: null}) 43 + } 44 + s3b: { 45 + x: null | s3b 46 + @test(eq, {x: null}) 47 + } 31 48 32 - s4a: x: s4a | {} 33 - s4b: x: {} | s4b 49 + s4a: { 50 + x: s4a | {} 51 + @test(eq, {x: {}}) 52 + } 53 + s4b: { 54 + x: {} | s4b 55 + @test(eq, {x: {}}) 56 + } 34 57 35 - s5a: x: s5a | [] 36 - s5b: x: [] | s5b 58 + s5a: { 59 + x: s5a | [] 60 + @test(eq, {x: []}) 61 + } 62 + s5b: { 63 + x: [] | s5b 64 + @test(eq, {x: []}) 65 + } 37 66 38 67 -- issue3042.cue -- 39 68 // Array element validation not being enforced for elements nested inside ··· 52 81 ] 53 82 } 54 83 } 84 + @test(err, code=eval, 85 + suberr=(code=eval, path=data, contains="conflicting values %s and %s (mismatched types %s and %s)", args=[{secret:{infra:[{name:"bar1"}]}}, [...#nesting], struct, list], pos=[4:57, 6:8, 6:19]), 86 + suberr=(code=eval, path=data, contains="conflicting values %s and %s (mismatched types %s and %s)", args=[{secret:{infra:[{name:"bar1"}]}}, string, struct, string], pos=[4:12, 6:8, 6:19]), 87 + ) 55 88 } 89 + -- out/errors.txt -- 90 + [structural_cycle] cycle.a: structural cycle 91 + [eval] issue3042.data: 2 errors in empty disjunction: 92 + issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and [...#nesting] (mismatched types struct and list): 93 + ./issue3042.cue:8:57 94 + ./issue3042.cue:10:8 95 + ./issue3042.cue:10:19 96 + issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and string (mismatched types struct and string): 97 + ./issue3042.cue:8:12 98 + ./issue3042.cue:10:8 99 + ./issue3042.cue:10:19 56 100 -- out/eval/stats -- 57 101 Leaks: 25 58 102 Freed: 117 ··· 65 109 Disjuncts: 73 66 110 67 111 NumCloseIDs: 20 68 - -- out/evalalpha -- 69 - Errors: 70 - cycle.a: structural cycle 71 - issue3042.data: 2 errors in empty disjunction: 72 - issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and [...#nesting] (mismatched types struct and list): 73 - ./issue3042.cue:8:57 74 - ./issue3042.cue:10:8 75 - ./issue3042.cue:10:19 76 - issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and string (mismatched types struct and string): 77 - ./issue3042.cue:8:12 78 - ./issue3042.cue:10:8 79 - ./issue3042.cue:10:19 80 - 81 - Result: 82 - (_|_){ 83 - // [eval] 84 - cycle: (_|_){ 85 - // [structural_cycle] 86 - a: (_|_){ 87 - // [structural_cycle] cycle.a: structural cycle 88 - } 89 - } 90 - r1a: (int){ int } 91 - r1b: (int){ int } 92 - r2a: (int){ 1 } 93 - r2b: (int){ 1 } 94 - r3a: (null){ null } 95 - r3b: (null){ null } 96 - r4a: (struct){ 97 - } 98 - r4b: (struct){ 99 - } 100 - r5a: (#list){ 101 - } 102 - r5b: (#list){ 103 - } 104 - s1a: (struct){ 105 - x: (int){ int } 106 - } 107 - s1b: (struct){ 108 - x: (int){ int } 109 - } 110 - s2a: (struct){ 111 - x: (int){ 1 } 112 - } 113 - s2b: (struct){ 114 - x: (int){ 1 } 115 - } 116 - s3a: (struct){ 117 - x: (null){ null } 118 - } 119 - s3b: (struct){ 120 - x: (null){ null } 121 - } 122 - s4a: (struct){ 123 - x: (struct){ 124 - } 125 - } 126 - s4b: (struct){ 127 - x: (struct){ 128 - } 129 - } 130 - s5a: (struct){ 131 - x: (#list){ 132 - } 133 - } 134 - s5b: (struct){ 135 - x: (#list){ 136 - } 137 - } 138 - issue3042: (_|_){ 139 - // [eval] 140 - #foo: (string){ =~"^foo" } 141 - #nesting: ((string|list|struct)){ |((string){ string }, (#struct){ 142 - name?: (string){ =~"^foo" } 143 - }, (list){ 144 - }) } 145 - data: (_|_){ 146 - // [eval] issue3042.data: 2 errors in empty disjunction: 147 - // issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and [...#nesting] (mismatched types struct and list): 148 - // ./issue3042.cue:8:57 149 - // ./issue3042.cue:10:8 150 - // ./issue3042.cue:10:19 151 - // issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and string (mismatched types struct and string): 152 - // ./issue3042.cue:8:12 153 - // ./issue3042.cue:10:8 154 - // ./issue3042.cue:10:19 155 - secret: (struct){ 156 - infra: (list){ list } 157 - } 158 - } 159 - } 160 - } 161 - -- diff/-out/evalalpha<==>+out/eval -- 162 - diff old new 163 - --- old 164 - +++ new 165 - @@ -1,22 +1,22 @@ 166 - Errors: 167 - cycle.a: structural cycle 168 - issue3042.data: 2 errors in empty disjunction: 169 - -issue3042.data: conflicting values [...#nesting] and {secret:{infra:[{name:"bar1"}]}} (mismatched types list and struct): 170 - - ./issue3042.cue:5:57 171 - - ./issue3042.cue:7:8 172 - - ./issue3042.cue:7:19 173 - -issue3042.data: conflicting values string and {secret:{infra:[{name:"bar1"}]}} (mismatched types string and struct): 174 - - ./issue3042.cue:5:12 175 - - ./issue3042.cue:7:8 176 - - ./issue3042.cue:7:19 177 - +issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and [...#nesting] (mismatched types struct and list): 178 - + ./issue3042.cue:8:57 179 - + ./issue3042.cue:10:8 180 - + ./issue3042.cue:10:19 181 - +issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and string (mismatched types struct and string): 182 - + ./issue3042.cue:8:12 183 - + ./issue3042.cue:10:8 184 - + ./issue3042.cue:10:19 185 - 186 - Result: 187 - (_|_){ 188 - // [eval] 189 - cycle: (_|_){ 190 - - // [structural cycle] 191 - + // [structural_cycle] 192 - a: (_|_){ 193 - - // [structural cycle] cycle.a: structural cycle 194 - + // [structural_cycle] cycle.a: structural cycle 195 - } 196 - } 197 - r1a: (int){ int } 198 - @@ -76,14 +76,14 @@ 199 - }) } 200 - data: (_|_){ 201 - // [eval] issue3042.data: 2 errors in empty disjunction: 202 - - // issue3042.data: conflicting values [...#nesting] and {secret:{infra:[{name:"bar1"}]}} (mismatched types list and struct): 203 - - // ./issue3042.cue:5:57 204 - - // ./issue3042.cue:7:8 205 - - // ./issue3042.cue:7:19 206 - - // issue3042.data: conflicting values string and {secret:{infra:[{name:"bar1"}]}} (mismatched types string and struct): 207 - - // ./issue3042.cue:5:12 208 - - // ./issue3042.cue:7:8 209 - - // ./issue3042.cue:7:19 210 - + // issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and [...#nesting] (mismatched types struct and list): 211 - + // ./issue3042.cue:8:57 212 - + // ./issue3042.cue:10:8 213 - + // ./issue3042.cue:10:19 214 - + // issue3042.data: conflicting values {secret:{infra:[{name:"bar1"}]}} and string (mismatched types struct and string): 215 - + // ./issue3042.cue:8:12 216 - + // ./issue3042.cue:10:8 217 - + // ./issue3042.cue:10:19 218 - secret: (struct){ 219 - infra: (list){ list } 220 - } 221 - -- out/eval -- 222 - Errors: 223 - cycle.a: structural cycle 224 - issue3042.data: 2 errors in empty disjunction: 225 - issue3042.data: conflicting values [...#nesting] and {secret:{infra:[{name:"bar1"}]}} (mismatched types list and struct): 226 - ./issue3042.cue:5:57 227 - ./issue3042.cue:7:8 228 - ./issue3042.cue:7:19 229 - issue3042.data: conflicting values string and {secret:{infra:[{name:"bar1"}]}} (mismatched types string and struct): 230 - ./issue3042.cue:5:12 231 - ./issue3042.cue:7:8 232 - ./issue3042.cue:7:19 233 - 234 - Result: 235 - (_|_){ 236 - // [eval] 237 - cycle: (_|_){ 238 - // [structural cycle] 239 - a: (_|_){ 240 - // [structural cycle] cycle.a: structural cycle 241 - } 242 - } 243 - r1a: (int){ int } 244 - r1b: (int){ int } 245 - r2a: (int){ 1 } 246 - r2b: (int){ 1 } 247 - r3a: (null){ null } 248 - r3b: (null){ null } 249 - r4a: (struct){ 250 - } 251 - r4b: (struct){ 252 - } 253 - r5a: (#list){ 254 - } 255 - r5b: (#list){ 256 - } 257 - s1a: (struct){ 258 - x: (int){ int } 259 - } 260 - s1b: (struct){ 261 - x: (int){ int } 262 - } 263 - s2a: (struct){ 264 - x: (int){ 1 } 265 - } 266 - s2b: (struct){ 267 - x: (int){ 1 } 268 - } 269 - s3a: (struct){ 270 - x: (null){ null } 271 - } 272 - s3b: (struct){ 273 - x: (null){ null } 274 - } 275 - s4a: (struct){ 276 - x: (struct){ 277 - } 278 - } 279 - s4b: (struct){ 280 - x: (struct){ 281 - } 282 - } 283 - s5a: (struct){ 284 - x: (#list){ 285 - } 286 - } 287 - s5b: (struct){ 288 - x: (#list){ 289 - } 290 - } 291 - issue3042: (_|_){ 292 - // [eval] 293 - #foo: (string){ =~"^foo" } 294 - #nesting: ((string|list|struct)){ |((string){ string }, (#struct){ 295 - name?: (string){ =~"^foo" } 296 - }, (list){ 297 - }) } 298 - data: (_|_){ 299 - // [eval] issue3042.data: 2 errors in empty disjunction: 300 - // issue3042.data: conflicting values [...#nesting] and {secret:{infra:[{name:"bar1"}]}} (mismatched types list and struct): 301 - // ./issue3042.cue:5:57 302 - // ./issue3042.cue:7:8 303 - // ./issue3042.cue:7:19 304 - // issue3042.data: conflicting values string and {secret:{infra:[{name:"bar1"}]}} (mismatched types string and struct): 305 - // ./issue3042.cue:5:12 306 - // ./issue3042.cue:7:8 307 - // ./issue3042.cue:7:19 308 - secret: (struct){ 309 - infra: (list){ list } 310 - } 311 - } 312 - } 313 - } 314 112 -- out/compile -- 315 113 --- in.cue 316 114 {
+14 -29
cue/testdata/cycle/issue241.txtar
··· 2 2 # CUE incorrectly reports an empty disjunction error instead of handling 3 3 # the abstract `!=` constraint between fields sharing a disjunction type. 4 4 # https://cuelang.org/issue/241 5 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 6 5 -- in.cue -- 7 6 #Value: 0 | 1 8 7 9 - foo: #Value 8 + foo: #Value @test(err, code=cycle|incomplete, args=[bar], pos=[-2:13, 2:6, 3:6]) 10 9 foo: !=bar 11 - bar: #Value 12 - bar: !=foo 10 + bar: #Value @test(eq, 0 | 1) 11 + bar: !=foo @test(err:todo, code=cycle|incomplete) 13 12 14 13 #Value: 0 | 1 15 14 16 - Foo: #Value 15 + Foo: #Value @test(eq, 1) 17 16 Foo: !=Bar 18 - Bar: #Value 17 + Bar: #Value @test(eq, 0) 19 18 Bar: !=Foo 20 19 Bar: 0 21 20 ··· 23 22 cell: a: !=cell.b 24 23 cell: b: 0 | 1 25 24 cell: b: !=cell.a 26 - cell: a: 0 27 - cell: b: _ 25 + cell: a: 0 @test(eq, 0) 26 + cell: b: _ @test(eq, 1) 28 27 29 - a: cell.a 30 - b: cell.b 28 + a: cell.a @test(eq, 0) 29 + b: cell.b @test(eq, 1) 30 + -- out/errors.txt -- 31 + [cycle] foo: cycle across unresolved disjunction referenced by bar: 32 + ./in.cue:1:13 33 + ./in.cue:5:6 34 + ./in.cue:6:6 31 35 -- out/eval/stats -- 32 36 Leaks: 6 33 37 Freed: 37 ··· 40 44 Disjuncts: 32 41 45 42 46 NumCloseIDs: 4 43 - -- out/evalalpha -- 44 - (struct){ 45 - #Value: (int){ |((int){ 0 }, (int){ 1 }) } 46 - foo: (_|_){ 47 - // [cycle] foo: cycle across unresolved disjunction referenced by bar: 48 - // ./in.cue:1:13 49 - // ./in.cue:5:6 50 - // ./in.cue:6:6 51 - } 52 - bar: (int){ |((int){ 0 }, (int){ 1 }) } 53 - Foo: (int){ 1 } 54 - Bar: (int){ 0 } 55 - cell: (struct){ 56 - a: (int){ 0 } 57 - b: (int){ 1 } 58 - } 59 - a: (int){ 0 } 60 - b: (int){ 1 } 61 - } 62 47 -- out/compile -- 63 48 --- in.cue 64 49 {
+6 -36
cue/testdata/cycle/issue242.txtar
··· 2 2 # in a structural cycle involving a disjunction (e.g. a grid where each cell 3 3 # must differ from its neighbors). 4 4 # https://cuelang.org/issue/242 5 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 6 5 -- in.cue -- 7 6 #size: 2 8 7 #CellValue: 0 | 1 | 2 | 3 ··· 30 29 cell: "0": "1": 1 31 30 cell: "1": "0": 2 32 31 cell: "1": "1": 3 32 + @test(eq, { 33 + "0": {"0": 0, "1": 1} 34 + "1": {"0": 2, "1": 3} 35 + }, at=cell) 33 36 34 37 cell2: a: 0 | 1 35 38 cell2: a: !=cell2.b ··· 39 42 40 43 cell2: a: _ 41 44 cell2: b: 1 45 + @test(eq, {a: 0, b: 1}, at=cell2) 42 46 43 47 cell3: a: 0 | 1 44 48 cell3: a: !=cell3.b ··· 48 52 49 53 cell3: a: 0 50 54 cell3: b: _ 55 + @test(eq, {a: 0, b: 1}, at=cell3) 51 56 52 57 cell4: a: 0 | 1 53 58 cell4: a: !=cell4.b ··· 103 108 Disjuncts: 52 104 109 105 110 NumCloseIDs: 8 106 - -- out/evalalpha -- 107 - (struct){ 108 - #size: (int){ 2 } 109 - #CellValue: (int){ |((int){ 0 }, (int){ 1 }, (int){ 2 }, (int){ 3 }) } 110 - cell: (struct){ 111 - "0": (struct){ 112 - "0": (int){ 0 } 113 - "1": (int){ 1 } 114 - } 115 - "1": (struct){ 116 - "0": (int){ 2 } 117 - "1": (int){ 3 } 118 - } 119 - } 120 - cell2: (struct){ 121 - a: (int){ 0 } 122 - b: (int){ 1 } 123 - } 124 - cell3: (struct){ 125 - a: (int){ 0 } 126 - b: (int){ 1 } 127 - } 128 - cell4: (struct){ 129 - a: (int){ 0 } 130 - b: (int){ 1 } 131 - } 132 - cell5: (struct){ 133 - b: (int){ 1 } 134 - a: (int){ 0 } 135 - } 136 - a: (int){ 0 } 137 - b: (int){ 1 } 138 - c: (int){ 2 } 139 - d: (int){ 3 } 140 - } 141 111 -- out/compile -- 142 112 --- in.cue 143 113 {
+4 -19
cue/testdata/cycle/issue2526.txtar
··· 1 1 # The evaluator enters an infinite loop when processing a cycle involving 2 2 # struct embeddings, causing `cue eval` to hang indefinitely. 3 3 # https://cuelang.org/issue/2526 4 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 5 4 -- in.cue -- 6 5 x 7 6 x: { 8 7 y 9 8 y: x 10 9 } 10 + @test(err, code=structural_cycle, path=x.y, contains="structural cycle", pos=[]) 11 + -- out/errors.txt -- 12 + [structural_cycle] x.y: structural cycle 11 13 -- out/compile -- 12 14 --- in.cue 13 15 { ··· 16 18 〈0;y〉 17 19 y: 〈1;x〉 18 20 } 19 - } 20 - -- out/evalalpha -- 21 - Errors: 22 - x.y: structural cycle 23 - 24 - Result: 25 - (_|_){ 26 - // [structural_cycle] 27 - x: (_|_){ 28 - // [structural_cycle] 29 - y: (_|_){ 30 - // [structural_cycle] x.y: structural cycle 31 - } 32 - } 33 - y: (_|_){ 34 - // [structural_cycle] x.y: structural cycle 35 - } 36 - } 21 + }
+4 -21
cue/testdata/cycle/issue306.txtar
··· 1 1 # CUE panics/crashes instead of reporting a clean error when evaluating 2 2 # values with cyclic field dependencies. 3 3 # https://cuelang.org/issue/306 4 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 5 4 -- in.cue -- 6 - a: 12 5 + a: 12 @test(eq, 12) 7 6 #Controller: settings: { 8 7 controller: #Controller 9 - } 8 + } @test(err, code=structural_cycle, path=controller, contains="structural cycle", pos=[]) 9 + -- out/errors.txt -- 10 + [structural_cycle] #Controller.settings.controller: structural cycle 10 11 -- out/eval/stats -- 11 12 Leaks: 0 12 13 Freed: 5 ··· 17 18 Unifications: 5 18 19 Conjuncts: 5 19 20 Disjuncts: 0 20 - -- out/evalalpha -- 21 - Errors: 22 - #Controller.settings.controller: structural cycle 23 - 24 - Result: 25 - (_|_){ 26 - // [structural_cycle] 27 - a: (int){ 12 } 28 - #Controller: (_|_){ 29 - // [structural_cycle] 30 - settings: (_|_){ 31 - // [structural_cycle] 32 - controller: (_|_){ 33 - // [structural_cycle] #Controller.settings.controller: structural cycle 34 - } 35 - } 36 - } 37 - } 38 21 -- out/compile -- 39 22 --- in.cue 40 23 {
+72 -95
cue/testdata/cycle/issue3118.txtar
··· 1 1 # Cycle errors report no source position information, making it impossible 2 2 # to locate the offending code. 3 3 # https://cuelang.org/issue/3118 4 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 5 4 -- in.cue -- 6 5 #TimeSpan: { 7 6 start: float ··· 20 19 examples: eg1: { 21 20 start: 10.0 22 21 duration: 2.1 22 + @test(eq, {start: 10.0, duration: 2.1, end: 12.1}) 23 23 } 24 24 25 25 examples: eg2: { 26 26 start: 10.0 27 + @test(eq, { 28 + start: _|_ @test(err, code=incomplete, pos=[6:12, 4:12, 8:12]) 29 + duration: _|_ @test(err, code=incomplete, pos=[7:12, 4:12, 8:12]) 30 + end: _|_ @test(err, code=incomplete, pos=[7:12, 4:12, 8:12]) 31 + }) 27 32 } 28 33 29 34 examples: eg3: { 30 35 end: 10.0 36 + @test(eq, { 37 + end: _|_ @test(err, code=incomplete, pos=[8:12, 2:12, 6:12, 10:9]) 38 + start: _|_ @test(err, code=incomplete, pos=[7:12, 2:12, 6:12, 10:9]) 39 + duration: _|_ @test(err, code=incomplete, pos=[7:12, 2:12, 6:12, 10:9]) 40 + }) 31 41 } 42 + -- out/errors.txt -- 43 + [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 44 + ./in.cue:10:11 45 + #TimeSpan.start: non-concrete value float in operand to -: 46 + ./in.cue:6:12 47 + ./in.cue:4:12 48 + ./in.cue:8:12 49 + #TimeSpan.duration: non-concrete value float in operand to -: 50 + ./in.cue:7:12 51 + ./in.cue:4:12 52 + ./in.cue:8:12 53 + [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 54 + ./in.cue:10:11 55 + #TimeSpan.duration: non-concrete value float in operand to -: 56 + ./in.cue:7:12 57 + ./in.cue:4:12 58 + ./in.cue:8:12 59 + [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 60 + ./in.cue:10:11 61 + #TimeSpan.duration: non-concrete value float in operand to -: 62 + ./in.cue:7:12 63 + ./in.cue:4:12 64 + ./in.cue:8:12 65 + [incomplete] examples.eg2.start: non-concrete value end for bound <=: 66 + ./in.cue:10:11 67 + examples.eg2.start: non-concrete value float in operand to -: 68 + ./in.cue:6:12 69 + ./in.cue:4:12 70 + ./in.cue:8:12 71 + examples.eg2.duration: non-concrete value float in operand to -: 72 + ./in.cue:7:12 73 + ./in.cue:4:12 74 + ./in.cue:8:12 75 + [incomplete] examples.eg2.duration: non-concrete value float in operand to -: 76 + ./in.cue:7:12 77 + ./in.cue:4:12 78 + ./in.cue:8:12 79 + [incomplete] examples.eg2.duration: non-concrete value float in operand to -: 80 + ./in.cue:7:12 81 + ./in.cue:4:12 82 + ./in.cue:8:12 83 + [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 84 + ./in.cue:7:12 85 + ./in.cue:2:12 86 + ./in.cue:6:12 87 + ./in.cue:10:9 88 + examples.eg3.end: non-concrete value <=10.0 & float in operand to +: 89 + ./in.cue:8:12 90 + ./in.cue:2:12 91 + ./in.cue:6:12 92 + ./in.cue:10:9 93 + [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 94 + ./in.cue:7:12 95 + ./in.cue:2:12 96 + ./in.cue:6:12 97 + ./in.cue:10:9 98 + [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 99 + ./in.cue:7:12 100 + ./in.cue:2:12 101 + ./in.cue:6:12 102 + ./in.cue:10:9 32 103 -- out/eval/stats -- 33 104 Leaks: 0 34 105 Freed: 18 ··· 41 112 Disjuncts: 0 42 113 43 114 NumCloseIDs: 3 44 - -- out/evalalpha -- 45 - (struct){ 46 - #TimeSpan: (#struct){ 47 - start: (_|_){ 48 - // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 49 - // ./in.cue:10:11 50 - // #TimeSpan.start: non-concrete value float in operand to -: 51 - // ./in.cue:6:12 52 - // ./in.cue:4:12 53 - // ./in.cue:8:12 54 - // #TimeSpan.duration: non-concrete value float in operand to -: 55 - // ./in.cue:7:12 56 - // ./in.cue:4:12 57 - // ./in.cue:8:12 58 - } 59 - duration: (_|_){ 60 - // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 61 - // ./in.cue:10:11 62 - // #TimeSpan.duration: non-concrete value float in operand to -: 63 - // ./in.cue:7:12 64 - // ./in.cue:4:12 65 - // ./in.cue:8:12 66 - } 67 - end: (_|_){ 68 - // [incomplete] #TimeSpan.start: non-concrete value end for bound <=: 69 - // ./in.cue:10:11 70 - // #TimeSpan.duration: non-concrete value float in operand to -: 71 - // ./in.cue:7:12 72 - // ./in.cue:4:12 73 - // ./in.cue:8:12 74 - } 75 - } 76 - examples: (struct){ 77 - eg1: (#struct){ 78 - start: (float){ 10.0 } 79 - duration: (float){ 2.1 } 80 - end: (float){ 12.1 } 81 - } 82 - eg2: (#struct){ 83 - start: (_|_){ 84 - // [incomplete] examples.eg2.start: non-concrete value end for bound <=: 85 - // ./in.cue:10:11 86 - // examples.eg2.start: non-concrete value float in operand to -: 87 - // ./in.cue:6:12 88 - // ./in.cue:4:12 89 - // ./in.cue:8:12 90 - // examples.eg2.duration: non-concrete value float in operand to -: 91 - // ./in.cue:7:12 92 - // ./in.cue:4:12 93 - // ./in.cue:8:12 94 - } 95 - duration: (_|_){ 96 - // [incomplete] examples.eg2.duration: non-concrete value float in operand to -: 97 - // ./in.cue:7:12 98 - // ./in.cue:4:12 99 - // ./in.cue:8:12 100 - } 101 - end: (_|_){ 102 - // [incomplete] examples.eg2.duration: non-concrete value float in operand to -: 103 - // ./in.cue:7:12 104 - // ./in.cue:4:12 105 - // ./in.cue:8:12 106 - } 107 - } 108 - eg3: (#struct){ 109 - end: (_|_){ 110 - // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 111 - // ./in.cue:7:12 112 - // ./in.cue:2:12 113 - // ./in.cue:6:12 114 - // ./in.cue:10:9 115 - // examples.eg3.end: non-concrete value <=10.0 & float in operand to +: 116 - // ./in.cue:8:12 117 - // ./in.cue:2:12 118 - // ./in.cue:6:12 119 - // ./in.cue:10:9 120 - } 121 - start: (_|_){ 122 - // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 123 - // ./in.cue:7:12 124 - // ./in.cue:2:12 125 - // ./in.cue:6:12 126 - // ./in.cue:10:9 127 - } 128 - duration: (_|_){ 129 - // [incomplete] examples.eg3.duration: non-concrete value <=10.0 & float in operand to -: 130 - // ./in.cue:7:12 131 - // ./in.cue:2:12 132 - // ./in.cue:6:12 133 - // ./in.cue:10:9 134 - } 135 - } 136 - } 137 - } 138 115 -- out/compile -- 139 116 --- in.cue 140 117 {
+11 -29
cue/testdata/cycle/issue3570.txtar
··· 1 1 # evalv2 panics in `DerefValue` when processing a specific CUE input 2 2 # discovered via oss-fuzz, reproducing on both v0.9.2 and v0.10.1. 3 3 # https://cuelang.org/issue/3570 4 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 5 4 -- in.cue -- 6 5 foo: foo: 25 | 44 7 6 foo 8 - foo: foo 9 - -- out/compile -- 10 - --- in.cue 11 - { 12 - foo: { 13 - foo: (25|44) 14 - } 15 - 〈0;foo〉 16 - foo: 〈0;foo〉 17 - } 18 - -- out/evalalpha -- 19 - Errors: 20 - 2 errors in empty disjunction: 7 + foo: foo @test(eq, {foo: _}) 8 + -- out/errors.txt -- 9 + [eval] 2 errors in empty disjunction: 21 10 conflicting values {foo:{foo:(25|44)},foo,foo:foo} and 25 (mismatched types struct and int): 22 11 ./in.cue:1:1 23 12 ./in.cue:1:11 ··· 26 15 ./in.cue:1:1 27 16 ./in.cue:1:16 28 17 ./in.cue:2:1 29 - 30 - Result: 31 - (_|_){ 32 - // [eval] 2 errors in empty disjunction: 33 - // conflicting values {foo:{foo:(25|44)},foo,foo:foo} and 25 (mismatched types struct and int): 34 - // ./in.cue:1:1 35 - // ./in.cue:1:11 36 - // ./in.cue:2:1 37 - // conflicting values {foo:{foo:(25|44)},foo,foo:foo} and 44 (mismatched types struct and int): 38 - // ./in.cue:1:1 39 - // ./in.cue:1:16 40 - // ./in.cue:2:1 41 - foo: (struct){ 42 - foo: (_){ _ } 18 + -- out/compile -- 19 + --- in.cue 20 + { 21 + foo: { 22 + foo: (25|44) 43 23 } 44 - } 24 + 〈0;foo〉 25 + foo: 〈0;foo〉 26 + }
+34 -248
cue/testdata/cycle/issue3571.txtar
··· 1 1 # evalv3 incorrectly reports a structural cycle error for a CUE definition that 2 2 # validates correctly under evalv2, representing a regression in cycle detection. 3 3 # https://cuelang.org/issue/3571 4 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 5 4 -- in.cue -- 6 5 // These tests should NOT have structural cycles. 7 6 simplified: { ··· 9 8 in: _ 10 9 x: #T 11 10 x: x: #T 12 - 11 + 13 12 #T: { 14 13 in: x 15 14 x: _ 16 15 } 16 + 17 + @test(eq, { 18 + in: {x: {in: _, x: _}, in: {in: _, x: _}} 19 + x: {x: {in: _, x: _}, in: {in: _, x: _}} 20 + #T: {in: _, x: _} 21 + }) 17 22 } 18 23 19 24 issue3571: { ··· 30 35 in: #in 31 36 #in: _ 32 37 } 38 + 39 + @test(eq, { 40 + a: { 41 + in: { 42 + f: true 43 + g: { 44 + #in: {f: {#in: {x: true}, in: {x: true}}} 45 + in: {f: {#in: {x: true}, in: {x: true}}} 46 + } 47 + } 48 + #in: { 49 + g: { 50 + #in: {f: {#in: {x: true}, in: {x: true}}} 51 + in: {f: {#in: {x: true}, in: {x: true}}} 52 + } 53 + f?: _ 54 + } 55 + } 56 + #T: {in: _, #in: _} 57 + }) 33 58 } 34 59 -- out/eval/stats -- 35 60 Leaks: 0 ··· 44 69 Notifications: 1 45 70 46 71 NumCloseIDs: 12 47 - -- out/evalalpha -- 48 - (struct){ 49 - simplified: (#struct){ 50 - in: (#struct){ 51 - x: ~(simplified.#T) 52 - in: ~(simplified.#T) 53 - } 54 - x: (#struct){ 55 - x: ~(simplified.#T) 56 - in: ~(simplified.#T) 57 - } 58 - #T: (#struct){ 59 - in: (_){ _ } 60 - x: (_){ _ } 61 - } 62 - } 63 - issue3571: (struct){ 64 - a: (#struct){ 65 - in: (#struct){ 66 - f: (bool){ true } 67 - g: (#struct){ 68 - #in: (#struct){ 69 - f: (#struct){ 70 - #in: (#struct){ 71 - x: (bool){ true } 72 - } 73 - in: ~(issue3571.a.in.g.#in.f.#in) 74 - } 75 - } 76 - in: ~(issue3571.a.in.g.#in) 77 - } 78 - } 79 - #in: (#struct){ 80 - g: (#struct){ 81 - #in: (#struct){ 82 - f: (#struct){ 83 - #in: (#struct){ 84 - x: (bool){ true } 85 - } 86 - in: ~(issue3571.a.#in.g.#in.f.#in) 87 - } 88 - } 89 - in: ~(issue3571.a.#in.g.#in) 90 - } 91 - f?: (_){ _ } 92 - } 93 - } 94 - #T: (#struct){ 95 - in: (_){ _ } 96 - #in: (_){ _ } 97 - } 98 - } 99 - } 100 - -- diff/-out/evalalpha<==>+out/eval -- 101 - diff old new 102 - --- old 103 - +++ new 104 - @@ -1,24 +1,12 @@ 105 - (struct){ 106 - simplified: (#struct){ 107 - in: (#struct){ 108 - - in: (#struct){ 109 - - in: (_){ _ } 110 - - x: (_){ _ } 111 - - } 112 - - x: (#struct){ 113 - - in: (_){ _ } 114 - - x: (_){ _ } 115 - - } 116 - + x: ~(simplified.#T) 117 - + in: ~(simplified.#T) 118 - } 119 - x: (#struct){ 120 - - in: (#struct){ 121 - - in: (_){ _ } 122 - - x: (_){ _ } 123 - - } 124 - - x: (#struct){ 125 - - in: (_){ _ } 126 - - x: (_){ _ } 127 - - } 128 - + x: ~(simplified.#T) 129 - + in: ~(simplified.#T) 130 - } 131 - #T: (#struct){ 132 - in: (_){ _ } 133 - @@ -28,52 +16,30 @@ 134 - issue3571: (struct){ 135 - a: (#struct){ 136 - in: (#struct){ 137 - - g: (#struct){ 138 - - in: (#struct){ 139 - - f: (#struct){ 140 - - in: (#struct){ 141 - - x: (bool){ true } 142 - - } 143 - - #in: (#struct){ 144 - - x: (bool){ true } 145 - - } 146 - - } 147 - - } 148 - - #in: (#struct){ 149 - - f: (#struct){ 150 - - in: (#struct){ 151 - - x: (bool){ true } 152 - - } 153 - - #in: (#struct){ 154 - - x: (bool){ true } 155 - - } 156 - - } 157 - - } 158 - - } 159 - f: (bool){ true } 160 - + g: (#struct){ 161 - + #in: (#struct){ 162 - + f: (#struct){ 163 - + #in: (#struct){ 164 - + x: (bool){ true } 165 - + } 166 - + in: ~(issue3571.a.in.g.#in.f.#in) 167 - + } 168 - + } 169 - + in: ~(issue3571.a.in.g.#in) 170 - + } 171 - } 172 - #in: (#struct){ 173 - g: (#struct){ 174 - - in: (#struct){ 175 - - f: (#struct){ 176 - - in: (#struct){ 177 - - x: (bool){ true } 178 - - } 179 - - #in: (#struct){ 180 - - x: (bool){ true } 181 - - } 182 - - } 183 - - } 184 - - #in: (#struct){ 185 - - f: (#struct){ 186 - - in: (#struct){ 187 - - x: (bool){ true } 188 - - } 189 - - #in: (#struct){ 190 - - x: (bool){ true } 191 - - } 192 - - } 193 - - } 194 - + #in: (#struct){ 195 - + f: (#struct){ 196 - + #in: (#struct){ 197 - + x: (bool){ true } 198 - + } 199 - + in: ~(issue3571.a.#in.g.#in.f.#in) 200 - + } 201 - + } 202 - + in: ~(issue3571.a.#in.g.#in) 203 - } 204 - f?: (_){ _ } 205 - } 206 - -- out/eval -- 207 - (struct){ 208 - simplified: (#struct){ 209 - in: (#struct){ 210 - in: (#struct){ 211 - in: (_){ _ } 212 - x: (_){ _ } 213 - } 214 - x: (#struct){ 215 - in: (_){ _ } 216 - x: (_){ _ } 217 - } 218 - } 219 - x: (#struct){ 220 - in: (#struct){ 221 - in: (_){ _ } 222 - x: (_){ _ } 223 - } 224 - x: (#struct){ 225 - in: (_){ _ } 226 - x: (_){ _ } 227 - } 228 - } 229 - #T: (#struct){ 230 - in: (_){ _ } 231 - x: (_){ _ } 232 - } 233 - } 234 - issue3571: (struct){ 235 - a: (#struct){ 236 - in: (#struct){ 237 - g: (#struct){ 238 - in: (#struct){ 239 - f: (#struct){ 240 - in: (#struct){ 241 - x: (bool){ true } 242 - } 243 - #in: (#struct){ 244 - x: (bool){ true } 245 - } 246 - } 247 - } 248 - #in: (#struct){ 249 - f: (#struct){ 250 - in: (#struct){ 251 - x: (bool){ true } 252 - } 253 - #in: (#struct){ 254 - x: (bool){ true } 255 - } 256 - } 257 - } 258 - } 259 - f: (bool){ true } 260 - } 261 - #in: (#struct){ 262 - g: (#struct){ 263 - in: (#struct){ 264 - f: (#struct){ 265 - in: (#struct){ 266 - x: (bool){ true } 267 - } 268 - #in: (#struct){ 269 - x: (bool){ true } 270 - } 271 - } 272 - } 273 - #in: (#struct){ 274 - f: (#struct){ 275 - in: (#struct){ 276 - x: (bool){ true } 277 - } 278 - #in: (#struct){ 279 - x: (bool){ true } 280 - } 281 - } 282 - } 283 - } 284 - f?: (_){ _ } 285 - } 286 - } 287 - #T: (#struct){ 288 - in: (_){ _ } 289 - #in: (_){ _ } 290 - } 291 - } 292 - } 72 + -- out/todo.txt -- 73 + v2 expands all structure-shared fields inline (no ~() references), while v3 74 + uses structure sharing (~(path) notation) for fields that share the same 75 + underlying vertex. Specifically, in `simplified`, v2 expands `in` and `x` 76 + with their full #T contents, while v3 represents them as ~(simplified.#T). 77 + Similarly in `issue3571.a`, v2 expands `in` and `#in` fully, while v3 uses 78 + shared references like ~(issue3571.a.in.g.#in) and ~(issue3571.a.#in.g.#in). 293 79 -- out/compile -- 294 80 --- in.cue 295 81 {
+13 -32
cue/testdata/cycle/issue3827.txtar
··· 2 2 # a definition that succeeds without error under evalv2, regressing on a 3 3 # real-world GitHub Actions schema. 4 4 # https://cuelang.org/issue/3827 5 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 6 5 -- in.cue -- 7 6 reduced: { 8 7 A: b: (A.c & {}).x 9 8 A: null | { c: x: 1 } 9 + @test(eq, {A: {b: 1, c: {x: 1}}}) 10 10 } 11 11 12 12 full: { ··· 17 17 path: "bar" 18 18 } 19 19 } 20 - 20 + 21 21 Y=#Workflow: #Step: (Y.steps & {x: {}}).x 22 - 22 + 23 23 #Workflow: null | { 24 24 steps: [string]: { 25 25 uses?: string 26 26 with?: [string]: string 27 27 } 28 28 } 29 + @test(eq, { 30 + out: { 31 + uses: "actions/upload-artifact@v3" 32 + with: {name: "foo", path: "bar"} 33 + } 34 + #Workflow: { 35 + #Step: {uses?: string, with?: {}} 36 + steps: {} 37 + } 38 + }) 29 39 } 30 40 -- out/eval/stats -- 31 41 Leaks: 9 ··· 40 50 Notifications: 2 41 51 42 52 NumCloseIDs: 7 43 - -- out/evalalpha -- 44 - (struct){ 45 - reduced: (struct){ 46 - A: (struct){ 47 - b: (int){ 1 } 48 - c: (struct){ 49 - x: (int){ 1 } 50 - } 51 - } 52 - } 53 - full: (struct){ 54 - out: (#struct){ 55 - uses: (string){ "actions/upload-artifact@v3" } 56 - with: (#struct){ 57 - name: (string){ "foo" } 58 - path: (string){ "bar" } 59 - } 60 - } 61 - #Workflow: (#struct){ 62 - #Step: (#struct){ 63 - uses?: (string){ string } 64 - with?: (#struct){ 65 - } 66 - } 67 - steps: (#struct){ 68 - } 69 - } 70 - } 71 - } 72 53 -- out/compile -- 73 54 --- in.cue 74 55 {
+23 -43
cue/testdata/cycle/issue4203.txtar
··· 1 1 # A CUE file using comprehensions and struct embeddings that exports 2 2 # successfully in v0.13.2 fails with "undefined field" in later versions. 3 3 # https://cuelang.org/issue/4203 4 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 5 4 -- in.cue -- 6 5 import "strings" 7 6 ··· 27 26 28 27 output: _input[0].variable 29 28 } 30 - -- out/evalalpha -- 31 - (struct){ 32 - _listBuilder: (struct){ 33 - kind: (string){ "kind1" } 34 - _deps: (list){ 35 - } 36 - _kindJoin: (struct){ 37 - _objs: (list){ 38 - } 39 - _out: (string){ "" } 40 - } 41 - _depKinds: (string){ "" } 42 - variable: (string){ "{}" } 43 - } 44 - output: (string){ "{kind1}" } 45 - _input: (#list){ 46 - 0: (struct){ 47 - _deps: (#list){ 48 - 0: (struct){ 49 - kind: (string){ "kind1" } 50 - _deps: (list){ 51 - } 52 - _kindJoin: (struct){ 53 - _objs: (list){ 54 - } 55 - _out: (string){ "" } 56 - } 57 - _depKinds: (string){ "" } 58 - variable: (string){ "{}" } 59 - } 60 - } 61 - kind: (string){ "kind1" } 62 - _kindJoin: (struct){ 63 - _objs: (list){ 64 - } 65 - _out: (string){ "" } 66 - } 67 - _depKinds: (string){ "kind1" } 68 - variable: (string){ "{kind1}" } 69 - } 70 - } 71 - } 29 + @test(eq, { 30 + _listBuilder: { 31 + kind: "kind1" 32 + _deps: [] 33 + _kindJoin: {_objs: [], _out: ""} 34 + _depKinds: "" 35 + variable: "{}" 36 + } 37 + output: "{kind1}" 38 + _input: [{ 39 + _deps: [{ 40 + kind: "kind1" 41 + _deps: [] 42 + _kindJoin: {_objs: [], _out: ""} 43 + _depKinds: "" 44 + variable: "{}" 45 + }] 46 + kind: "kind1" 47 + _kindJoin: {_objs: [], _out: ""} 48 + _depKinds: "kind1" 49 + variable: "{kind1}" 50 + }] 51 + }) 72 52 -- out/compile -- 73 53 --- in.cue 74 54 {
+9 -78
cue/testdata/cycle/issue4210.txtar
··· 4 4 # prevent cycle detection, causing CUE to loop forever instead of reporting an 5 5 # error. Affects all variants: `{a & _}.b`, `{a.b}.c`, nested structs, etc. 6 6 # https://cuelang.org/issue/4210 7 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 8 7 -- in.cue -- 9 8 t1: { 10 9 a: b: c: {a}.b 10 + @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 11 11 } 12 12 t2: { 13 13 a: b: c: {a & _}.b 14 + @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 14 15 } 15 16 t3: { 16 17 a: b: c: d: {a.b}.c 18 + @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 17 19 } 18 20 t4: { 19 21 x: y: z: {a}.y 20 22 a: x 23 + @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 21 24 } 22 - -- out/evalalpha -- 23 - Errors: 24 - t1.a.b.c.c: structural cycle 25 - t2.a.b.c.c: structural cycle 26 - t3.a.b.c.d.d: structural cycle 27 - t4.x.y.z.z: structural cycle 28 - 29 - Result: 30 - (_|_){ 31 - // [structural_cycle] 32 - t1: (_|_){ 33 - // [structural_cycle] 34 - a: (_|_){ 35 - // [structural_cycle] 36 - b: (_|_){ 37 - // [structural_cycle] 38 - c: (_|_){ 39 - // [structural_cycle] 40 - c: (_|_){ 41 - // [structural_cycle] t1.a.b.c.c: structural cycle 42 - } 43 - } 44 - } 45 - } 46 - } 47 - t2: (_|_){ 48 - // [structural_cycle] 49 - a: (_|_){ 50 - // [structural_cycle] 51 - b: (_|_){ 52 - // [structural_cycle] 53 - c: (_|_){ 54 - // [structural_cycle] 55 - c: (_|_){ 56 - // [structural_cycle] t2.a.b.c.c: structural cycle 57 - } 58 - } 59 - } 60 - } 61 - } 62 - t3: (_|_){ 63 - // [structural_cycle] 64 - a: (_|_){ 65 - // [structural_cycle] 66 - b: (_|_){ 67 - // [structural_cycle] 68 - c: (_|_){ 69 - // [structural_cycle] 70 - d: (_|_){ 71 - // [structural_cycle] 72 - d: (_|_){ 73 - // [structural_cycle] t3.a.b.c.d.d: structural cycle 74 - } 75 - } 76 - } 77 - } 78 - } 79 - } 80 - t4: (_|_){ 81 - // [structural_cycle] 82 - x: (_|_){ 83 - // [structural_cycle] 84 - y: (_|_){ 85 - // [structural_cycle] 86 - z: (_|_){ 87 - // [structural_cycle] 88 - z: (_|_){ 89 - // [structural_cycle] t4.x.y.z.z: structural cycle 90 - } 91 - } 92 - } 93 - } 94 - a: (_|_){ 95 - // [structural_cycle] t4.x.y.z.z: structural cycle 96 - } 97 - } 98 - } 25 + -- out/errors.txt -- 26 + [structural_cycle] t1.a.b.c.c: structural cycle 27 + [structural_cycle] t2.a.b.c.c: structural cycle 28 + [structural_cycle] t3.a.b.c.d.d: structural cycle 29 + [structural_cycle] t4.x.y.z.z: structural cycle 99 30 -- out/compile -- 100 31 --- in.cue 101 32 {
+44 -2
cue/testdata/cycle/issue4228.txtar
··· 2 2 # The combination of error() with self interpolation and complex nested 3 3 # struct patterns can cause infinite recursion when formatting error messages. 4 4 # https://cuelang.org/issue/4228 5 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 6 5 -- in.cue -- 7 6 package main 8 7 ··· 69 68 // Usage 70 69 argocd: _namespacedResourceKinds & { 71 70 app: apps: {} 72 - } 71 + } @test(err, code=eval) 73 72 74 73 -- export.cue -- 75 74 @experiment(aliasv2) ··· 93 92 } 94 93 95 94 #manifests: {#export, #entries: [_globalScope]}.yamlStream 95 + 96 + @test(err, code=eval) 97 + -- out/errors.txt -- 98 + [eval] #manifests: error in call to encoding/yaml.MarshalStream: <- invalid {namespace:string,revisionHistoryLimit:*3 | int,k8s:_|_(#entries.0.argocd.app.apps: <- invalid value at path '#entries.0.argocd.app.apps'),name:string}: 99 + ./export.cue:18:14 100 + ./in.cue:15:38 101 + ./in.cue:16:8 102 + ./in.cue:23:3 103 + ./in.cue:40:8 104 + ./in.cue:47:22 105 + ./in.cue:65:13 106 + [incomplete] _setTypeMeta.#template.k8s.apiVersion: required field missing: #apiVersion: 107 + ./in.cue:23:20 108 + [incomplete] _setTypeMeta.#template.k8s.kind: required field missing: #kind: 109 + ./in.cue:24:14 110 + [eval] _namespacedResourceKinds.app.#template.k8s.apiVersion: field not allowed: 111 + ./in.cue:23:3 112 + [eval] _namespacedResourceKinds.app.#template.k8s.kind: field not allowed: 113 + ./in.cue:24:3 114 + [eval] _namespacedResourceKinds.app.#template.k8s.metadata: field not allowed: 115 + ./in.cue:5:7 116 + ./in.cue:11:7 117 + [eval] argocd.app.apps: 4 errors in empty disjunction: 118 + argocd.app.apps.k8s.apiVersion: field not allowed: 119 + ./in.cue:23:3 120 + argocd.app.apps.k8s.kind: field not allowed: 121 + ./in.cue:24:3 122 + argocd.app.apps.k8s.metadata: field not allowed: 123 + ./in.cue:5:7 124 + ./in.cue:11:7 125 + argocd.app.apps: <- invalid {namespace:string,revisionHistoryLimit:*3 | int,k8s:_|_(argocd.app.apps.k8s.apiVersion: field not allowed (and 2 more errors)),name:string}: 126 + ./in.cue:16:8 127 + ./in.cue:15:38 128 + ./in.cue:40:8 129 + ./in.cue:47:22 130 + ./in.cue:65:13 131 + [eval] argocd.app.#template.k8s.apiVersion: field not allowed: 132 + ./in.cue:23:3 133 + [eval] argocd.app.#template.k8s.kind: field not allowed: 134 + ./in.cue:24:3 135 + [eval] argocd.app.#template.k8s.metadata: field not allowed: 136 + ./in.cue:5:7 137 + ./in.cue:11:7 96 138 -- out/eval/stats -- 97 139 Leaks: 1 98 140 Freed: 187
+4 -19
cue/testdata/cycle/issue4230.txtar
··· 4 4 # correctly. The root cause: calls with only literal arguments were incorrectly 5 5 # deferred when evaluated from within a cyclic context, resulting in empty output. 6 6 # https://cuelang.org/issue/4230 7 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 8 7 -- in.cue -- 9 8 #transform: { 10 9 _input: {...} ··· 18 17 x: X={ 19 18 regions: (#transform & {_input: X})._output 20 19 app: region: or(["west", "east"]) & "west" 21 - } 20 + } @test(eq, { 21 + regions: ["west"] 22 + app: {region: "west"} 23 + }) 22 24 -- out/compile -- 23 25 --- in.cue 24 26 { ··· 44 46 } 45 47 } 46 48 } 47 - -- out/evalalpha -- 48 - (struct){ 49 - #transform: (#struct){ 50 - _input: (#struct){ 51 - } 52 - _output: (#list){ 53 - } 54 - } 55 - x: (struct){ 56 - regions: (#list){ 57 - 0: (string){ "west" } 58 - } 59 - app: (struct){ 60 - region: (string){ "west" } 61 - } 62 - } 63 - }
+29 -61
cue/testdata/cycle/issue4244.txtar
··· 2 2 # result unexpectedly compared to the inline form, indicating a bug in how 3 3 # `let`-bound values are resolved relative to their enclosing scope. 4 4 # https://cuelang.org/issue/4244 5 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 6 5 -- in.cue -- 7 6 import "strings" 8 7 ··· 10 9 let splits = strings.Split(id, "_never_") 11 10 let prefix = splits[0] 12 11 13 - #ID: =~"^\(prefix)$" 14 - #SubID: =~"^\(prefix):sub$" 12 + #ID: =~"^\(prefix)$" @test(err, code=incomplete, contains="invalid interpolation", pos=[0:12, -2:22]) 13 + #SubID: =~"^\(prefix):sub$" @test(err, code=incomplete, contains="invalid interpolation", pos=[0:12, -3:22]) 15 14 16 - id: #ID 17 - subid: #SubID 15 + id: #ID @test(err, code=incomplete, contains="invalid interpolation", pos=[-3:12, -5:22]) 16 + subid: #SubID @test(err, code=incomplete, contains="invalid interpolation", pos=[-3:12, -6:22]) 18 17 } 19 18 20 19 case1: #schema & { 21 20 id: "foo" 22 21 subid: "foo:sub" 23 - } 22 + } @test(eq, { 23 + id: "foo" 24 + subid: "foo:sub" 25 + #ID: =~"^foo$" 26 + #SubID: =~"^foo:sub$" 27 + }) 24 28 25 29 case2: #schema & { 26 30 subid: "foo:sub" 27 31 id: "foo" 28 - } 29 - -- out/evalalpha -- 30 - (struct){ 31 - #schema: (#struct){ 32 - let splits#1 = (_|_){ 33 - // [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 34 - // ./in.cue:7:12 35 - // ./in.cue:5:22 36 - } 37 - let prefix#2 = (_|_){ 38 - // [incomplete] #schema.prefix: index out of range [0] with length 1: 39 - // ./in.cue:5:22 40 - } 41 - #ID: (_|_){ 42 - // [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 43 - // ./in.cue:7:12 44 - // ./in.cue:5:22 45 - } 46 - #SubID: (_|_){ 47 - // [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 48 - // ./in.cue:8:12 49 - // ./in.cue:5:22 50 - } 51 - id: (_|_){ 52 - // [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 53 - // ./in.cue:7:12 54 - // ./in.cue:5:22 55 - } 56 - subid: (_|_){ 57 - // [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 58 - // ./in.cue:8:12 59 - // ./in.cue:5:22 60 - } 61 - } 62 - case1: (#struct){ 63 - id: (string){ "foo" } 64 - subid: (string){ "foo:sub" } 65 - let splits#1 = (#list){ 66 - 0: (string){ "foo" } 67 - } 68 - let prefix#2 = (string){ "foo" } 69 - #ID: (string){ =~"^foo$" } 70 - #SubID: (string){ =~"^foo:sub$" } 71 - } 72 - case2: (#struct){ 73 - subid: (string){ "foo:sub" } 74 - id: (string){ "foo" } 75 - let splits#1 = (#list){ 76 - 0: (string){ "foo" } 77 - } 78 - let prefix#2 = (string){ "foo" } 79 - #ID: (string){ =~"^foo$" } 80 - #SubID: (string){ =~"^foo:sub$" } 81 - } 82 - } 32 + } @test(eq, { 33 + subid: "foo:sub" 34 + id: "foo" 35 + #ID: =~"^foo$" 36 + #SubID: =~"^foo:sub$" 37 + }) 38 + -- out/errors.txt -- 39 + [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 40 + ./in.cue:7:12 41 + ./in.cue:5:22 42 + [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 43 + ./in.cue:8:12 44 + ./in.cue:5:22 45 + [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 46 + ./in.cue:7:12 47 + ./in.cue:5:22 48 + [incomplete] #schema.prefix: invalid interpolation: index out of range [0] with length 1: 49 + ./in.cue:8:12 50 + ./in.cue:5:22 83 51 -- out/compile -- 84 52 --- in.cue 85 53 {
+70 -135
cue/testdata/cycle/issue429.txtar
··· 6 6 # TODO: a bound value resolving to a disjunction should probably be an error. 7 7 # In this case #Size.amx should resolve. 8 8 # https://cuelang.org/issue/429 9 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 10 9 -- in.cue -- 11 10 // Range disjunction without cycle (checks only one-way). 12 11 #Size: { ··· 15 14 max: >min | *min 16 15 } 17 16 18 - s0: #Size & {res: 1} 17 + s0: #Size & {res: 1} @test(eq, { 18 + res: 1 19 + min: *2 | >1 20 + max: *2 | >1 | >2 21 + }) 22 + 19 23 // This discards the default for max. This is correct, but unfortunate. 20 24 // TODO: is there a tweak to the default mechanism possible that would fix that? 21 25 // Tread very carefully, though! Perhaps we could have a builtin that 22 26 // discards any default, so that we can at least manually override this 23 27 // behavior. 24 - s1: #Size & {min: 5} 25 - s2: #Size & {max: 5} 28 + s1: #Size & {min: 5} @test(eq, { 29 + min: 5 30 + res: *0 | >=0 & int 31 + max: *5 | >5 32 + }) 33 + s2: #Size & {max: 5} @test(eq, { 34 + max: 5 35 + res: *0 | >=0 & int 36 + min: *1 | >0 37 + }) 26 38 s3: #Size & { 27 39 min: 5 28 40 max: 10 29 - } 41 + } @test(eq, {min: 5, max: 10, res: *0 | >=0 & int}) 30 42 es3: #Size & { 31 43 min: 10 32 44 max: 5 33 - } 45 + } @test(err, code=eval, 46 + suberr=(code=eval, path=max, contains="%d errors in empty disjunction:", args=[2], pos=[]), 47 + suberr=(code=eval, path=max, contains="conflicting values %s and %s", args=[1, 5], pos=[-29:16, -28:15, 0:6, 2:7]), 48 + suberr=(code=eval, path=max, contains="conflicting values %s and %s", args=[10, 5], pos=[-28:15, 0:6, 1:7, 2:7]), 49 + suberr=(code=eval, path=max, contains="invalid value %v (out of bound %s)", args=[5, >10], pos=[-28:7, 2:7])) 34 50 35 51 // Disjunctions with cycles 36 52 // TODO: improve error message here. Logic is correct, though. ··· 41 57 } 42 58 r1: #nonEmptyRange & { 43 59 min: 3 44 - } 60 + } @test(eq, { 61 + min: _|_ @test(err, code=incomplete, contains="r1.min: non-concrete value max for bound < (and 2 more errors)", pos=[46:8]) 62 + max: >3 63 + }) 45 64 r2: #nonEmptyRange & { 46 65 max: 5 47 - } 66 + } @test(eq, {max: 5, min: *1 | <5 & int}) 48 67 r3: #nonEmptyRange & { 49 68 min: 3 50 69 max: 6 51 - } 70 + } @test(eq, {min: 3, max: 6}) 52 71 53 72 er3: #nonEmptyRange & { 54 73 min: 5 55 74 max: 5 56 - } 57 - -- out/evalalpha -- 58 - Errors: 59 - er3.min: 2 errors in empty disjunction: 60 - er3.min: conflicting values 1 and 5: 61 - ./in.cue:28:8 62 - ./in.cue:43:6 63 - ./in.cue:44:7 64 - es3.max: 2 errors in empty disjunction: 75 + } @test(err, code=eval, 76 + suberr=(code=eval, path=min, contains="conflicting values %s and %s", args=[1, 5], pos=[-18:8, 0:6, 1:7]), 77 + suberr=(code=eval, path=min, contains="invalid value %v (out of bound %s)", args=[5, <5], pos=[-17:7, 1:7]), 78 + suberr=(code=eval, path=min, contains="invalid value %v (out of bound %s)", args=[5, <5], pos=[-17:7, 1:7])) 79 + -- out/errors.txt -- 80 + [eval] es3.max: 2 errors in empty disjunction: 65 81 es3.max: 4 errors in empty disjunction: 66 82 es3.max: conflicting values 1 and 5: 67 83 ./in.cue:4:16 68 84 ./in.cue:5:15 69 - ./in.cue:20:6 70 - ./in.cue:22:7 85 + ./in.cue:33:6 86 + ./in.cue:35:7 71 87 es3.max: conflicting values 10 and 5: 72 88 ./in.cue:5:15 73 - ./in.cue:20:6 74 - ./in.cue:21:7 75 - ./in.cue:22:7 89 + ./in.cue:33:6 90 + ./in.cue:34:7 91 + ./in.cue:35:7 76 92 es3.max: invalid value 5 (out of bound >10): 77 93 ./in.cue:5:7 78 - ./in.cue:22:7 94 + ./in.cue:35:7 95 + [cycle] #nonEmptyRange.min: cycle with field: max: 96 + ./in.cue:46:8 97 + #nonEmptyRange.max: cycle with field: min: 98 + ./in.cue:47:8 99 + [cycle] #nonEmptyRange.min: cycle with field: max: 100 + ./in.cue:46:8 101 + #nonEmptyRange.max: cycle with field: min: 102 + ./in.cue:47:8 103 + [incomplete] r1.min: 2 errors in empty disjunction: 104 + r1.min: conflicting values 1 and 3: 105 + ./in.cue:45:8 106 + ./in.cue:49:5 107 + ./in.cue:50:7 108 + r1.min: non-concrete value max for bound <: 109 + ./in.cue:46:8 110 + [eval] er3.min: 2 errors in empty disjunction: 111 + er3.min: conflicting values 1 and 5: 112 + ./in.cue:45:8 113 + ./in.cue:63:6 114 + ./in.cue:64:7 115 + er3.min: invalid value 5 (out of bound <5): 116 + ./in.cue:46:7 117 + ./in.cue:64:7 118 + [eval] er3.min: 2 errors in empty disjunction: 119 + er3.min: conflicting values 1 and 5: 120 + ./in.cue:45:8 121 + ./in.cue:63:6 122 + ./in.cue:64:7 79 123 er3.min: invalid value 5 (out of bound <5): 80 - ./in.cue:29:7 81 - ./in.cue:44:7 82 - 83 - Result: 84 - (_|_){ 85 - // [eval] 86 - #Size: (#struct){ 87 - res: (int){ |(*(int){ 0 }, (int){ &(>=0, int) }) } 88 - min: (number){ |(*(int){ 1 }, (number){ >0 }) } 89 - max: (number){ |(*(int){ 1 }, (number){ >0 }, (number){ >1 }) } 90 - } 91 - s0: (#struct){ 92 - res: (int){ 1 } 93 - min: (number){ |(*(int){ 2 }, (number){ >1 }) } 94 - max: (number){ |(*(int){ 2 }, (number){ >1 }, (number){ >2 }) } 95 - } 96 - s1: (#struct){ 97 - min: (int){ 5 } 98 - res: (int){ |(*(int){ 0 }, (int){ &(>=0, int) }) } 99 - max: (number){ |(*(int){ 5 }, (number){ >5 }) } 100 - } 101 - s2: (#struct){ 102 - max: (int){ 5 } 103 - res: (int){ |(*(int){ 0 }, (int){ &(>=0, int) }) } 104 - min: (number){ |(*(int){ 1 }, (number){ >0 }) } 105 - } 106 - s3: (#struct){ 107 - min: (int){ 5 } 108 - max: (int){ 10 } 109 - res: (int){ |(*(int){ 0 }, (int){ &(>=0, int) }) } 110 - } 111 - es3: (_|_){ 112 - // [eval] 113 - min: (int){ 10 } 114 - max: (_|_){ 115 - // [eval] es3.max: 2 errors in empty disjunction: 116 - // es3.max: 4 errors in empty disjunction: 117 - // es3.max: conflicting values 1 and 5: 118 - // ./in.cue:4:16 119 - // ./in.cue:5:15 120 - // ./in.cue:20:6 121 - // ./in.cue:22:7 122 - // es3.max: conflicting values 10 and 5: 123 - // ./in.cue:5:15 124 - // ./in.cue:20:6 125 - // ./in.cue:21:7 126 - // ./in.cue:22:7 127 - // es3.max: invalid value 5 (out of bound >10): 128 - // ./in.cue:5:7 129 - // ./in.cue:22:7 130 - } 131 - res: (int){ |(*(int){ 0 }, (int){ &(>=0, int) }) } 132 - } 133 - #nonEmptyRange: (#struct){ 134 - min: (_|_){ 135 - // [cycle] #nonEmptyRange.min: cycle with field: max: 136 - // ./in.cue:29:8 137 - // #nonEmptyRange.max: cycle with field: min: 138 - // ./in.cue:30:8 139 - } 140 - max: (_|_){ 141 - // [cycle] #nonEmptyRange.min: cycle with field: max: 142 - // ./in.cue:29:8 143 - // #nonEmptyRange.max: cycle with field: min: 144 - // ./in.cue:30:8 145 - } 146 - } 147 - r1: (#struct){ 148 - min: (_|_){ 149 - // [incomplete] r1.min: 2 errors in empty disjunction: 150 - // r1.min: conflicting values 1 and 3: 151 - // ./in.cue:28:8 152 - // ./in.cue:32:5 153 - // ./in.cue:33:7 154 - // r1.min: non-concrete value max for bound <: 155 - // ./in.cue:29:8 156 - } 157 - max: (number){ >3 } 158 - } 159 - r2: (#struct){ 160 - max: (int){ 5 } 161 - min: (int){ |(*(int){ 1 }, (int){ &(<5, int) }) } 162 - } 163 - r3: (#struct){ 164 - min: (int){ 3 } 165 - max: (int){ 6 } 166 - } 167 - er3: (_|_){ 168 - // [eval] 169 - min: (_|_){ 170 - // [eval] er3.min: 2 errors in empty disjunction: 171 - // er3.min: conflicting values 1 and 5: 172 - // ./in.cue:28:8 173 - // ./in.cue:43:6 174 - // ./in.cue:44:7 175 - // er3.min: invalid value 5 (out of bound <5): 176 - // ./in.cue:29:7 177 - // ./in.cue:44:7 178 - } 179 - max: (_|_){ 180 - // [eval] er3.min: 2 errors in empty disjunction: 181 - // er3.min: conflicting values 1 and 5: 182 - // ./in.cue:28:8 183 - // ./in.cue:43:6 184 - // ./in.cue:44:7 185 - // er3.min: invalid value 5 (out of bound <5): 186 - // ./in.cue:29:7 187 - // ./in.cue:44:7 188 - } 189 - } 190 - } 124 + ./in.cue:46:7 125 + ./in.cue:64:7 191 126 -- out/compile -- 192 127 --- in.cue 193 128 {
+14 -208
cue/testdata/cycle/issue494.txtar
··· 4 4 # The equivalent closed-type pattern `#d: [rn=string]: [...] & _Q[0:len(#d[rn])]` 5 5 # works correctly. The self-referential slice constraint is not being unified. 6 6 # https://cuelang.org/issue/494 7 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 8 7 -- in.cue -- 9 8 _Q: [{pos: 0}, {pos: 1}] 10 9 11 10 a: [rn=string]: _Q[0:len(a[rn])] 12 - a: ben: [{}] 11 + a: ben: [{}] @test(eq, [{pos: 0}]) 13 12 14 13 b: [rn=string]: _Q[0:1] 15 - b: ben: [{}] 14 + b: ben: [{}] @test(eq, [{pos: 0}]) 16 15 17 16 c: [rn=string]: [...{l: len(a[rn])}] 18 - c: ben: [{}] 17 + c: ben: [{}] @test(eq, [{l: 1}]) 19 18 20 19 #d: [rn=string]: [...{pos: uint}] & _Q[0:len(#d[rn])] 21 - #d: ben: [{}] 20 + #d: ben: [{}] @test(eq, [{pos: 0}]) 22 21 23 - d: #d 22 + d: #d @test(eq, {ben: [{pos: 0}]}) 24 23 25 24 e: [rn=string]: _Q[0 : len(a[rn])+1] 26 - e: ben: [{}, ...] 25 + e: ben: [{}, ...] @test(eq, [{pos: 0}, {pos: 1}]) 27 26 28 27 f: [rn=string]: _Q[0 : len(a[rn])+1] 29 - f: ben: [{}] 28 + f: ben: [{}] @test(err, code=eval, contains="incompatible list lengths", pos=[]) 30 29 31 30 g: [rn=string]: _Q[0:len(a[rn])] 32 - g: ben: [{}, {}] 31 + g: ben: [{}, {}] @test(err, code=eval, contains="incompatible list lengths", pos=[]) 32 + -- out/errors.txt -- 33 + [eval] f.ben: incompatible list lengths (1 and 2) 34 + [eval] g.ben: incompatible list lengths (1 and 2) 35 + -- out/todo.txt -- 36 + v2 expands `d` into an independent struct; v3 shares the same vertex as `#d` (d: ~(#d)). 37 + v2 includes extra sub-fields pos values in f.ben and g.ben error output. 33 38 -- out/eval/stats -- 34 39 Leaks: 0 35 40 Freed: 36 ··· 40 45 Unifications: 36 41 46 Conjuncts: 59 42 47 Disjuncts: 0 43 - -- out/evalalpha -- 44 - Errors: 45 - f.ben: incompatible list lengths (1 and 2) 46 - g.ben: incompatible list lengths (1 and 2) 47 - 48 - Result: 49 - (_|_){ 50 - // [eval] 51 - _Q: (#list){ 52 - 0: (struct){ 53 - pos: (int){ 0 } 54 - } 55 - 1: (struct){ 56 - pos: (int){ 1 } 57 - } 58 - } 59 - a: (struct){ 60 - ben: (#list){ 61 - 0: (struct){ 62 - pos: (int){ 0 } 63 - } 64 - } 65 - } 66 - b: (struct){ 67 - ben: (#list){ 68 - 0: (struct){ 69 - pos: (int){ 0 } 70 - } 71 - } 72 - } 73 - c: (struct){ 74 - ben: (#list){ 75 - 0: (struct){ 76 - l: (int){ 1 } 77 - } 78 - } 79 - } 80 - #d: (#struct){ 81 - ben: (#list){ 82 - 0: (#struct){ 83 - pos: (int){ 0 } 84 - } 85 - } 86 - } 87 - d: ~(#d) 88 - e: (struct){ 89 - ben: (#list){ 90 - 0: (struct){ 91 - pos: (int){ 0 } 92 - } 93 - 1: (struct){ 94 - pos: (int){ 1 } 95 - } 96 - } 97 - } 98 - f: (_|_){ 99 - // [eval] 100 - ben: (_|_){ 101 - // [eval] f.ben: incompatible list lengths (1 and 2) 102 - 0: (struct){ 103 - } 104 - } 105 - } 106 - g: (_|_){ 107 - // [eval] 108 - ben: (_|_){ 109 - // [eval] g.ben: incompatible list lengths (1 and 2) 110 - 0: (struct){ 111 - } 112 - 1: (struct){ 113 - } 114 - } 115 - } 116 - } 117 - -- diff/-out/evalalpha<==>+out/eval -- 118 - diff old new 119 - --- old 120 - +++ new 121 - @@ -41,13 +41,7 @@ 122 - } 123 - } 124 - } 125 - - d: (#struct){ 126 - - ben: (#list){ 127 - - 0: (#struct){ 128 - - pos: (int){ 0 } 129 - - } 130 - - } 131 - - } 132 - + d: ~(#d) 133 - e: (struct){ 134 - ben: (#list){ 135 - 0: (struct){ 136 - @@ -63,10 +57,6 @@ 137 - ben: (_|_){ 138 - // [eval] f.ben: incompatible list lengths (1 and 2) 139 - 0: (struct){ 140 - - pos: (int){ 0 } 141 - - } 142 - - 1: (struct){ 143 - - pos: (int){ 1 } 144 - } 145 - } 146 - } 147 - @@ -75,7 +65,6 @@ 148 - ben: (_|_){ 149 - // [eval] g.ben: incompatible list lengths (1 and 2) 150 - 0: (struct){ 151 - - pos: (int){ 0 } 152 - } 153 - 1: (struct){ 154 - } 155 - -- diff/todo/p2 -- 156 - error path moved 157 - -- out/eval -- 158 - Errors: 159 - f.ben: incompatible list lengths (1 and 2) 160 - g.ben: incompatible list lengths (1 and 2) 161 - 162 - Result: 163 - (_|_){ 164 - // [eval] 165 - _Q: (#list){ 166 - 0: (struct){ 167 - pos: (int){ 0 } 168 - } 169 - 1: (struct){ 170 - pos: (int){ 1 } 171 - } 172 - } 173 - a: (struct){ 174 - ben: (#list){ 175 - 0: (struct){ 176 - pos: (int){ 0 } 177 - } 178 - } 179 - } 180 - b: (struct){ 181 - ben: (#list){ 182 - 0: (struct){ 183 - pos: (int){ 0 } 184 - } 185 - } 186 - } 187 - c: (struct){ 188 - ben: (#list){ 189 - 0: (struct){ 190 - l: (int){ 1 } 191 - } 192 - } 193 - } 194 - #d: (#struct){ 195 - ben: (#list){ 196 - 0: (#struct){ 197 - pos: (int){ 0 } 198 - } 199 - } 200 - } 201 - d: (#struct){ 202 - ben: (#list){ 203 - 0: (#struct){ 204 - pos: (int){ 0 } 205 - } 206 - } 207 - } 208 - e: (struct){ 209 - ben: (#list){ 210 - 0: (struct){ 211 - pos: (int){ 0 } 212 - } 213 - 1: (struct){ 214 - pos: (int){ 1 } 215 - } 216 - } 217 - } 218 - f: (_|_){ 219 - // [eval] 220 - ben: (_|_){ 221 - // [eval] f.ben: incompatible list lengths (1 and 2) 222 - 0: (struct){ 223 - pos: (int){ 0 } 224 - } 225 - 1: (struct){ 226 - pos: (int){ 1 } 227 - } 228 - } 229 - } 230 - g: (_|_){ 231 - // [eval] 232 - ben: (_|_){ 233 - // [eval] g.ben: incompatible list lengths (1 and 2) 234 - 0: (struct){ 235 - pos: (int){ 0 } 236 - } 237 - 1: (struct){ 238 - } 239 - } 240 - } 241 - } 242 48 -- out/compile -- 243 49 --- in.cue 244 50 {
+50 -453
cue/testdata/cycle/issue502.txtar
··· 4 4 # `mas: one: { mas: two: { ... } }`) but gets "structural cycle" errors for 5 5 # `#a.mas.one._link.mas.two.link` etc. Shallow nesting (one level) works fine. 6 6 # https://cuelang.org/issue/502 7 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 8 7 -- in.cue -- 9 8 #T: { 10 9 config: _ ··· 35 34 } 36 35 } 37 36 38 - a: #a & {config: a: 34} 37 + a: #a & {config: a: 34} @test(eq, { 38 + config: {a: 34} 39 + body: 34 40 + mas: one: { 41 + cfg: {b: 34} 42 + _link: { 43 + config: {b: int} 44 + body: int 45 + mas: two: { 46 + cfg: {c: int} 47 + _link: {config: {c: int}, body: int, mas: {}} 48 + link: {config: {c: int}, body: int, mas: {}} 49 + } 50 + } 51 + link: { 52 + config: {b: 34} 53 + body: 34 54 + mas: two: { 55 + cfg: {c: 34} 56 + _link: {config: {c: int}, body: int, mas: {}} 57 + link: {config: {c: 34}, body: 34, mas: {}} 58 + } 59 + } 60 + } 61 + }) 39 62 -- reduced.cue -- 40 63 reduced: t1: { 41 64 #T: x: y?: { ··· 44 67 } 45 68 a: #T 46 69 a: x: y: V: x: y: V: {} 70 + 71 + @test(eq, { 72 + #T: x: y?: { 73 + V: _ 74 + z: x: y?: { 75 + _|_ 76 + V: _ 77 + z: _|_ @test(err, code=structural_cycle, contains="reduced.t1.#T.x.y.z.x.y.z: structural cycle", pos=[]) 78 + } 79 + } 80 + a: x: y: { 81 + V: x: y: V: {} 82 + z: x: y: { 83 + V: {} 84 + z: x: y?: { 85 + _|_ 86 + V: _ 87 + z: _|_ @test(err, code=structural_cycle, contains="reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle", pos=[]) 88 + } 89 + } 90 + } 91 + }) 47 92 } 48 93 -- out/eval/stats -- 49 94 Leaks: 1 ··· 57 102 Disjuncts: 0 58 103 59 104 NumCloseIDs: 45 60 - -- out/evalalpha -- 61 - (struct){ 62 - #T: (#struct){ 63 - config: (_){ _ } 64 - body: (_){ _ } 65 - mas: (#struct){ 66 - } 67 - } 68 - #a: (#struct){ 69 - config: (#struct){ 70 - a: (int){ int } 71 - } 72 - body: (int){ int } 73 - mas: (#struct){ 74 - one: (#struct){ 75 - cfg: (#struct){ 76 - b: (int){ int } 77 - } 78 - _link: (#struct){ 79 - config: (#struct){ 80 - b: (int){ int } 81 - } 82 - body: (int){ int } 83 - mas: (#struct){ 84 - two: (#struct){ 85 - cfg: (#struct){ 86 - c: (int){ int } 87 - } 88 - _link: (#struct){ 89 - config: (#struct){ 90 - c: (int){ int } 91 - } 92 - body: (int){ int } 93 - mas: (#struct){ 94 - } 95 - } 96 - link: (#struct){ 97 - config: (#struct){ 98 - c: (int){ int } 99 - } 100 - body: (int){ int } 101 - mas: (#struct){ 102 - } 103 - } 104 - } 105 - } 106 - } 107 - link: (#struct){ 108 - config: (#struct){ 109 - b: (int){ int } 110 - } 111 - body: (int){ int } 112 - mas: (#struct){ 113 - two: (#struct){ 114 - cfg: (#struct){ 115 - c: (int){ int } 116 - } 117 - _link: (#struct){ 118 - config: (#struct){ 119 - c: (int){ int } 120 - } 121 - body: (int){ int } 122 - mas: (#struct){ 123 - } 124 - } 125 - link: (#struct){ 126 - config: (#struct){ 127 - c: (int){ int } 128 - } 129 - body: (int){ int } 130 - mas: (#struct){ 131 - } 132 - } 133 - } 134 - } 135 - } 136 - } 137 - } 138 - } 139 - a: (#struct){ 140 - config: (#struct){ 141 - a: (int){ 34 } 142 - } 143 - body: (int){ 34 } 144 - mas: (#struct){ 145 - one: (#struct){ 146 - cfg: (#struct){ 147 - b: (int){ 34 } 148 - } 149 - _link: (#struct){ 150 - config: (#struct){ 151 - b: (int){ int } 152 - } 153 - body: (int){ int } 154 - mas: (#struct){ 155 - two: (#struct){ 156 - cfg: (#struct){ 157 - c: (int){ int } 158 - } 159 - _link: (#struct){ 160 - config: (#struct){ 161 - c: (int){ int } 162 - } 163 - body: (int){ int } 164 - mas: (#struct){ 165 - } 166 - } 167 - link: (#struct){ 168 - config: (#struct){ 169 - c: (int){ int } 170 - } 171 - body: (int){ int } 172 - mas: (#struct){ 173 - } 174 - } 175 - } 176 - } 177 - } 178 - link: (#struct){ 179 - config: (#struct){ 180 - b: (int){ 34 } 181 - } 182 - body: (int){ 34 } 183 - mas: (#struct){ 184 - two: (#struct){ 185 - cfg: (#struct){ 186 - c: (int){ 34 } 187 - } 188 - _link: (#struct){ 189 - config: (#struct){ 190 - c: (int){ int } 191 - } 192 - body: (int){ int } 193 - mas: (#struct){ 194 - } 195 - } 196 - link: (#struct){ 197 - config: (#struct){ 198 - c: (int){ 34 } 199 - } 200 - body: (int){ 34 } 201 - mas: (#struct){ 202 - } 203 - } 204 - } 205 - } 206 - } 207 - } 208 - } 209 - } 210 - reduced: (struct){ 211 - t1: (struct){ 212 - #T: (#struct){ 213 - x: (#struct){ 214 - y?: (#struct){ 215 - V: (_){ _ } 216 - z: (#struct){ 217 - x: (#struct){ 218 - y?: (_|_){ 219 - // [structural_cycle] 220 - V: (_){ _ } 221 - z: (_|_){ 222 - // [structural_cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle 223 - } 224 - } 225 - } 226 - } 227 - } 228 - } 229 - } 230 - a: (#struct){ 231 - x: (#struct){ 232 - y: (#struct){ 233 - V: (#struct){ 234 - x: (struct){ 235 - y: (struct){ 236 - V: (struct){ 237 - } 238 - } 239 - } 240 - } 241 - z: (#struct){ 242 - x: (#struct){ 243 - y: (#struct){ 244 - V: (#struct){ 245 - } 246 - z: (#struct){ 247 - x: (#struct){ 248 - y?: (_|_){ 249 - // [structural_cycle] 250 - V: (_){ _ } 251 - z: (_|_){ 252 - // [structural_cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle 253 - } 254 - } 255 - } 256 - } 257 - } 258 - } 259 - } 260 - } 261 - } 262 - } 263 - } 264 - } 265 - } 266 - -- diff/-out/evalalpha<==>+out/eval -- 267 - diff old new 268 - --- old 269 - +++ new 270 - @@ -156,10 +156,10 @@ 271 - z: (#struct){ 272 - x: (#struct){ 273 - y?: (_|_){ 274 - - // [structural cycle] 275 - + // [structural_cycle] 276 - V: (_){ _ } 277 - z: (_|_){ 278 - - // [structural cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle 279 - + // [structural_cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle 280 - } 281 - } 282 - } 283 - @@ -170,7 +170,7 @@ 284 - a: (#struct){ 285 - x: (#struct){ 286 - y: (#struct){ 287 - - V: (struct){ 288 - + V: (#struct){ 289 - x: (struct){ 290 - y: (struct){ 291 - V: (struct){ 292 - @@ -186,10 +186,10 @@ 293 - z: (#struct){ 294 - x: (#struct){ 295 - y?: (_|_){ 296 - - // [structural cycle] 297 - + // [structural_cycle] 298 - V: (_){ _ } 299 - z: (_|_){ 300 - - // [structural cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle 301 - + // [structural_cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle 302 - } 303 - } 304 - } 305 - -- out/eval -- 306 - (struct){ 307 - #T: (#struct){ 308 - config: (_){ _ } 309 - body: (_){ _ } 310 - mas: (#struct){ 311 - } 312 - } 313 - #a: (#struct){ 314 - config: (#struct){ 315 - a: (int){ int } 316 - } 317 - body: (int){ int } 318 - mas: (#struct){ 319 - one: (#struct){ 320 - cfg: (#struct){ 321 - b: (int){ int } 322 - } 323 - _link: (#struct){ 324 - config: (#struct){ 325 - b: (int){ int } 326 - } 327 - body: (int){ int } 328 - mas: (#struct){ 329 - two: (#struct){ 330 - cfg: (#struct){ 331 - c: (int){ int } 332 - } 333 - _link: (#struct){ 334 - config: (#struct){ 335 - c: (int){ int } 336 - } 337 - body: (int){ int } 338 - mas: (#struct){ 339 - } 340 - } 341 - link: (#struct){ 342 - config: (#struct){ 343 - c: (int){ int } 344 - } 345 - body: (int){ int } 346 - mas: (#struct){ 347 - } 348 - } 349 - } 350 - } 351 - } 352 - link: (#struct){ 353 - config: (#struct){ 354 - b: (int){ int } 355 - } 356 - body: (int){ int } 357 - mas: (#struct){ 358 - two: (#struct){ 359 - cfg: (#struct){ 360 - c: (int){ int } 361 - } 362 - _link: (#struct){ 363 - config: (#struct){ 364 - c: (int){ int } 365 - } 366 - body: (int){ int } 367 - mas: (#struct){ 368 - } 369 - } 370 - link: (#struct){ 371 - config: (#struct){ 372 - c: (int){ int } 373 - } 374 - body: (int){ int } 375 - mas: (#struct){ 376 - } 377 - } 378 - } 379 - } 380 - } 381 - } 382 - } 383 - } 384 - a: (#struct){ 385 - config: (#struct){ 386 - a: (int){ 34 } 387 - } 388 - body: (int){ 34 } 389 - mas: (#struct){ 390 - one: (#struct){ 391 - cfg: (#struct){ 392 - b: (int){ 34 } 393 - } 394 - _link: (#struct){ 395 - config: (#struct){ 396 - b: (int){ int } 397 - } 398 - body: (int){ int } 399 - mas: (#struct){ 400 - two: (#struct){ 401 - cfg: (#struct){ 402 - c: (int){ int } 403 - } 404 - _link: (#struct){ 405 - config: (#struct){ 406 - c: (int){ int } 407 - } 408 - body: (int){ int } 409 - mas: (#struct){ 410 - } 411 - } 412 - link: (#struct){ 413 - config: (#struct){ 414 - c: (int){ int } 415 - } 416 - body: (int){ int } 417 - mas: (#struct){ 418 - } 419 - } 420 - } 421 - } 422 - } 423 - link: (#struct){ 424 - config: (#struct){ 425 - b: (int){ 34 } 426 - } 427 - body: (int){ 34 } 428 - mas: (#struct){ 429 - two: (#struct){ 430 - cfg: (#struct){ 431 - c: (int){ 34 } 432 - } 433 - _link: (#struct){ 434 - config: (#struct){ 435 - c: (int){ int } 436 - } 437 - body: (int){ int } 438 - mas: (#struct){ 439 - } 440 - } 441 - link: (#struct){ 442 - config: (#struct){ 443 - c: (int){ 34 } 444 - } 445 - body: (int){ 34 } 446 - mas: (#struct){ 447 - } 448 - } 449 - } 450 - } 451 - } 452 - } 453 - } 454 - } 455 - reduced: (struct){ 456 - t1: (struct){ 457 - #T: (#struct){ 458 - x: (#struct){ 459 - y?: (#struct){ 460 - V: (_){ _ } 461 - z: (#struct){ 462 - x: (#struct){ 463 - y?: (_|_){ 464 - // [structural cycle] 465 - V: (_){ _ } 466 - z: (_|_){ 467 - // [structural cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle 468 - } 469 - } 470 - } 471 - } 472 - } 473 - } 474 - } 475 - a: (#struct){ 476 - x: (#struct){ 477 - y: (#struct){ 478 - V: (struct){ 479 - x: (struct){ 480 - y: (struct){ 481 - V: (struct){ 482 - } 483 - } 484 - } 485 - } 486 - z: (#struct){ 487 - x: (#struct){ 488 - y: (#struct){ 489 - V: (#struct){ 490 - } 491 - z: (#struct){ 492 - x: (#struct){ 493 - y?: (_|_){ 494 - // [structural cycle] 495 - V: (_){ _ } 496 - z: (_|_){ 497 - // [structural cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle 498 - } 499 - } 500 - } 501 - } 502 - } 503 - } 504 - } 505 - } 506 - } 507 - } 508 - } 509 - } 510 - } 105 + -- out/errors.txt -- 106 + [structural_cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle 107 + [structural_cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle 511 108 -- out/compile -- 512 109 --- in.cue 513 110 {
+108 -863
cue/testdata/cycle/issue990.txtar
··· 1 1 # CUE incorrectly reports a structural cycle error for a valid CUE expression 2 2 # that does not actually contain a cycle, producing a false positive. 3 3 # https://cuelang.org/issue/990 4 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 5 4 -- in.cue -- 6 5 // A simple discriminated element 7 6 #AC: { ··· 81 80 // Test 82 81 83 82 out: #sub & {#p: _test.s1} 84 - -- diff/todo/p3 -- 85 - Reordering 86 - -- out/evalalpha -- 87 - (struct){ 88 - #AC: (#struct){ 89 - k: (string){ "simple" } 90 - d: ~(#C) 91 - } 92 - #AS: (#struct){ 93 - k: (string){ "complex" } 94 - d: ~(#S) 95 - } 96 - #R: (#struct){ 97 - a: (#struct){ |((#struct){ 98 - k: (string){ "simple" } 99 - d: ~(#C) 100 - }, (#struct){ 101 - k: (string){ "complex" } 102 - d: ~(#S) 103 - }) } 104 - } 105 - #S: (#struct){ 106 - n: (string){ string } 107 - r: (#struct){ 108 - } 109 - } 110 - #C: (#struct){ 111 - n: (string){ string } 112 - } 113 - #sub: (#struct){ 114 - #p: ~(#AS) 115 - dict: (#struct){ 116 - } 117 - let subs#1multi = (〈3;#sub〉 & { 118 - #p: 〈2;rd〉.a 119 - }) 120 - } 121 - _test: (struct){ 122 - c1: (#struct){ 123 - d: (#struct){ 124 - n: (string){ "c1" } 125 - } 126 - k: (string){ "simple" } 127 - } 128 - s3: (#struct){ 129 - d: (#struct){ 130 - n: (string){ "s3" } 131 - r: (#struct){ 132 - r1: (#struct){ 133 - a: (#struct){ 134 - d: (#struct){ 135 - n: (string){ "c1" } 136 - } 137 - k: (string){ "simple" } 138 - } 139 - } 140 - } 141 - } 142 - k: (string){ "complex" } 143 - } 144 - s2: (#struct){ 145 - d: (#struct){ 146 - n: (string){ "s2" } 147 - r: (#struct){ 148 - r1: (#struct){ 149 - a: (#struct){ 150 - d: (#struct){ 151 - n: (string){ "c1" } 152 - } 153 - k: (string){ "simple" } 154 - } 155 - } 156 - r2: (#struct){ 157 - a: (#struct){ 158 - d: (#struct){ 159 - n: (string){ "s3" } 160 - r: (#struct){ 161 - r1: (#struct){ 162 - a: (#struct){ 163 - d: (#struct){ 164 - n: (string){ "c1" } 165 - } 166 - k: (string){ "simple" } 167 - } 168 - } 169 - } 170 - } 171 - k: (string){ "complex" } 172 - } 173 - } 174 - } 175 - } 176 - k: (string){ "complex" } 177 - } 178 - s1: (#struct){ 179 - d: (#struct){ 180 - n: (string){ "s1" } 181 - r: (#struct){ 182 - r1: (#struct){ 183 - a: (#struct){ 184 - d: (#struct){ 185 - n: (string){ "c1" } 186 - } 187 - k: (string){ "simple" } 188 - } 189 - } 190 - r2: (#struct){ 191 - a: (#struct){ 192 - d: (#struct){ 193 - n: (string){ "s2" } 194 - r: (#struct){ 195 - r1: (#struct){ 196 - a: (#struct){ 197 - d: (#struct){ 198 - n: (string){ "c1" } 199 - } 200 - k: (string){ "simple" } 201 - } 202 - } 203 - r2: (#struct){ 204 - a: (#struct){ 205 - d: (#struct){ 206 - n: (string){ "s3" } 207 - r: (#struct){ 208 - r1: (#struct){ 209 - a: (#struct){ 210 - d: (#struct){ 211 - n: (string){ "c1" } 212 - } 213 - k: (string){ "simple" } 214 - } 215 - } 216 - } 217 - } 218 - k: (string){ "complex" } 219 - } 220 - } 221 - } 222 - } 223 - k: (string){ "complex" } 224 - } 225 - } 226 - } 227 - } 228 - k: (string){ "complex" } 229 - } 230 - } 231 - out: (#struct){ 232 - #p: (#struct){ 233 - d: (#struct){ 234 - n: (string){ "s1" } 235 - r: (#struct){ 236 - r1: (#struct){ 237 - a: (#struct){ 238 - d: (#struct){ 239 - n: (string){ "c1" } 240 - } 241 - k: (string){ "simple" } 242 - } 243 - } 244 - r2: (#struct){ 245 - a: (#struct){ 246 - d: (#struct){ 247 - n: (string){ "s2" } 248 - r: (#struct){ 249 - r1: (#struct){ 250 - a: (#struct){ 251 - d: (#struct){ 252 - n: (string){ "c1" } 253 - } 254 - k: (string){ "simple" } 255 - } 256 - } 257 - r2: (#struct){ 258 - a: (#struct){ 259 - d: (#struct){ 260 - n: (string){ "s3" } 261 - r: (#struct){ 262 - r1: (#struct){ 263 - a: (#struct){ 264 - d: (#struct){ 265 - n: (string){ "c1" } 266 - } 267 - k: (string){ "simple" } 268 - } 269 - } 270 - } 271 - } 272 - k: (string){ "complex" } 273 - } 274 - } 275 - } 276 - } 277 - k: (string){ "complex" } 278 - } 279 - } 280 - } 281 - } 282 - k: (string){ "complex" } 283 - } 284 - dict: (#struct){ 285 - r1: ~(out.#p.d.r.r1) 286 - r2_r1: (#struct){ 287 - a: (#struct){ 288 - d: (#struct){ 289 - n: (string){ "c1" } 290 - } 291 - k: (string){ "simple" } 292 - } 293 - } 294 - r2_r2_r1: (#struct){ 295 - a: (#struct){ 296 - d: (#struct){ 297 - n: (string){ "c1" } 298 - } 299 - k: (string){ "simple" } 300 - } 301 - } 302 - } 303 - let subs#1multi = (〈3;#sub〉 & { 304 - #p: 〈2;rd〉.a 305 - }) 306 - } 307 - } 308 - -- diff/-out/evalalpha<==>+out/eval -- 309 - diff old new 310 - --- old 311 - +++ new 312 - @@ -1,31 +1,19 @@ 313 - (struct){ 314 - #AC: (#struct){ 315 - k: (string){ "simple" } 316 - - d: (#struct){ 317 - - n: (string){ string } 318 - - } 319 - + d: ~(#C) 320 - } 321 - #AS: (#struct){ 322 - k: (string){ "complex" } 323 - - d: (#struct){ 324 - - n: (string){ string } 325 - - r: (#struct){ 326 - - } 327 - - } 328 - + d: ~(#S) 329 - } 330 - #R: (#struct){ 331 - a: (#struct){ |((#struct){ 332 - k: (string){ "simple" } 333 - - d: (#struct){ 334 - - n: (string){ string } 335 - - } 336 - + d: ~(#C) 337 - }, (#struct){ 338 - k: (string){ "complex" } 339 - - d: (#struct){ 340 - - n: (string){ string } 341 - - r: (#struct){ 342 - - } 343 - - } 344 - + d: ~(#S) 345 - }) } 346 - } 347 - #S: (#struct){ 348 - @@ -37,14 +25,7 @@ 349 - n: (string){ string } 350 - } 351 - #sub: (#struct){ 352 - - #p: (#struct){ 353 - - k: (string){ "complex" } 354 - - d: (#struct){ 355 - - n: (string){ string } 356 - - r: (#struct){ 357 - - } 358 - - } 359 - - } 360 - + #p: ~(#AS) 361 - dict: (#struct){ 362 - } 363 - let subs#1multi = (〈3;#sub〉 & { 364 - @@ -53,190 +34,183 @@ 365 - } 366 - _test: (struct){ 367 - c1: (#struct){ 368 - - k: (string){ "simple" } 369 - d: (#struct){ 370 - n: (string){ "c1" } 371 - } 372 - + k: (string){ "simple" } 373 - } 374 - s3: (#struct){ 375 - - k: (string){ "complex" } 376 - d: (#struct){ 377 - n: (string){ "s3" } 378 - r: (#struct){ 379 - r1: (#struct){ 380 - a: (#struct){ 381 - - k: (string){ "simple" } 382 - - d: (#struct){ 383 - - n: (string){ "c1" } 384 - - } 385 - - } 386 - - } 387 - - } 388 - - } 389 - + d: (#struct){ 390 - + n: (string){ "c1" } 391 - + } 392 - + k: (string){ "simple" } 393 - + } 394 - + } 395 - + } 396 - + } 397 - + k: (string){ "complex" } 398 - } 399 - s2: (#struct){ 400 - - k: (string){ "complex" } 401 - d: (#struct){ 402 - n: (string){ "s2" } 403 - r: (#struct){ 404 - r1: (#struct){ 405 - a: (#struct){ 406 - - k: (string){ "simple" } 407 - - d: (#struct){ 408 - - n: (string){ "c1" } 409 - - } 410 - - } 411 - - } 412 - - r2: (#struct){ 413 - - a: (#struct){ 414 - - k: (string){ "complex" } 415 - + d: (#struct){ 416 - + n: (string){ "c1" } 417 - + } 418 - + k: (string){ "simple" } 419 - + } 420 - + } 421 - + r2: (#struct){ 422 - + a: (#struct){ 423 - d: (#struct){ 424 - n: (string){ "s3" } 425 - r: (#struct){ 426 - r1: (#struct){ 427 - a: (#struct){ 428 - - k: (string){ "simple" } 429 - - d: (#struct){ 430 - - n: (string){ "c1" } 431 - - } 432 - - } 433 - - } 434 - - } 435 - - } 436 - - } 437 - - } 438 - - } 439 - - } 440 - + d: (#struct){ 441 - + n: (string){ "c1" } 442 - + } 443 - + k: (string){ "simple" } 444 - + } 445 - + } 446 - + } 447 - + } 448 - + k: (string){ "complex" } 449 - + } 450 - + } 451 - + } 452 - + } 453 - + k: (string){ "complex" } 454 - } 455 - s1: (#struct){ 456 - - k: (string){ "complex" } 457 - - d: (#struct){ 458 - - n: (string){ "s1" } 459 - - r: (#struct){ 460 - - r1: (#struct){ 461 - - a: (#struct){ 462 - - k: (string){ "simple" } 463 - - d: (#struct){ 464 - - n: (string){ "c1" } 465 - - } 466 - - } 467 - - } 468 - - r2: (#struct){ 469 - - a: (#struct){ 470 - - k: (string){ "complex" } 471 - - d: (#struct){ 472 - - n: (string){ "s2" } 473 - - r: (#struct){ 474 - - r1: (#struct){ 475 - - a: (#struct){ 476 - - k: (string){ "simple" } 477 - - d: (#struct){ 478 - - n: (string){ "c1" } 479 - - } 480 - - } 481 - - } 482 - - r2: (#struct){ 483 - - a: (#struct){ 484 - - k: (string){ "complex" } 485 - - d: (#struct){ 486 - - n: (string){ "s3" } 487 - - r: (#struct){ 488 - - r1: (#struct){ 489 - - a: (#struct){ 490 - - k: (string){ "simple" } 491 - - d: (#struct){ 492 - - n: (string){ "c1" } 493 - - } 494 - - } 495 - - } 496 - - } 497 - - } 498 - - } 499 - - } 500 - - } 501 - - } 502 - - } 503 - - } 504 - - } 505 - - } 506 - + d: (#struct){ 507 - + n: (string){ "s1" } 508 - + r: (#struct){ 509 - + r1: (#struct){ 510 - + a: (#struct){ 511 - + d: (#struct){ 512 - + n: (string){ "c1" } 513 - + } 514 - + k: (string){ "simple" } 515 - + } 516 - + } 517 - + r2: (#struct){ 518 - + a: (#struct){ 519 - + d: (#struct){ 520 - + n: (string){ "s2" } 521 - + r: (#struct){ 522 - + r1: (#struct){ 523 - + a: (#struct){ 524 - + d: (#struct){ 525 - + n: (string){ "c1" } 526 - + } 527 - + k: (string){ "simple" } 528 - + } 529 - + } 530 - + r2: (#struct){ 531 - + a: (#struct){ 532 - + d: (#struct){ 533 - + n: (string){ "s3" } 534 - + r: (#struct){ 535 - + r1: (#struct){ 536 - + a: (#struct){ 537 - + d: (#struct){ 538 - + n: (string){ "c1" } 539 - + } 540 - + k: (string){ "simple" } 541 - + } 542 - + } 543 - + } 544 - + } 545 - + k: (string){ "complex" } 546 - + } 547 - + } 548 - + } 549 - + } 550 - + k: (string){ "complex" } 551 - + } 552 - + } 553 - + } 554 - + } 555 - + k: (string){ "complex" } 556 - } 557 - } 558 - out: (#struct){ 559 - #p: (#struct){ 560 - - k: (string){ "complex" } 561 - - d: (#struct){ 562 - - n: (string){ "s1" } 563 - - r: (#struct){ 564 - - r1: (#struct){ 565 - - a: (#struct){ 566 - - k: (string){ "simple" } 567 - - d: (#struct){ 568 - - n: (string){ "c1" } 569 - - } 570 - - } 571 - - } 572 - - r2: (#struct){ 573 - - a: (#struct){ 574 - - k: (string){ "complex" } 575 - - d: (#struct){ 576 - - n: (string){ "s2" } 577 - - r: (#struct){ 578 - - r1: (#struct){ 579 - - a: (#struct){ 580 - - k: (string){ "simple" } 581 - - d: (#struct){ 582 - - n: (string){ "c1" } 583 - - } 584 - - } 585 - - } 586 - - r2: (#struct){ 587 - - a: (#struct){ 588 - - k: (string){ "complex" } 589 - - d: (#struct){ 590 - - n: (string){ "s3" } 591 - - r: (#struct){ 592 - - r1: (#struct){ 593 - - a: (#struct){ 594 - - k: (string){ "simple" } 595 - - d: (#struct){ 596 - - n: (string){ "c1" } 597 - - } 598 - - } 599 - - } 600 - - } 601 - - } 602 - - } 603 - - } 604 - - } 605 - - } 606 - - } 607 - - } 608 - - } 609 - - } 610 - - } 611 - - dict: (#struct){ 612 - - r1: (#struct){ 613 - - a: (#struct){ 614 - - k: (string){ "simple" } 615 - - d: (#struct){ 616 - - n: (string){ "c1" } 617 - - } 618 - - } 619 - - } 620 - + d: (#struct){ 621 - + n: (string){ "s1" } 622 - + r: (#struct){ 623 - + r1: (#struct){ 624 - + a: (#struct){ 625 - + d: (#struct){ 626 - + n: (string){ "c1" } 627 - + } 628 - + k: (string){ "simple" } 629 - + } 630 - + } 631 - + r2: (#struct){ 632 - + a: (#struct){ 633 - + d: (#struct){ 634 - + n: (string){ "s2" } 635 - + r: (#struct){ 636 - + r1: (#struct){ 637 - + a: (#struct){ 638 - + d: (#struct){ 639 - + n: (string){ "c1" } 640 - + } 641 - + k: (string){ "simple" } 642 - + } 643 - + } 644 - + r2: (#struct){ 645 - + a: (#struct){ 646 - + d: (#struct){ 647 - + n: (string){ "s3" } 648 - + r: (#struct){ 649 - + r1: (#struct){ 650 - + a: (#struct){ 651 - + d: (#struct){ 652 - + n: (string){ "c1" } 653 - + } 654 - + k: (string){ "simple" } 655 - + } 656 - + } 657 - + } 658 - + } 659 - + k: (string){ "complex" } 660 - + } 661 - + } 662 - + } 663 - + } 664 - + k: (string){ "complex" } 665 - + } 666 - + } 667 - + } 668 - + } 669 - + k: (string){ "complex" } 670 - + } 671 - + dict: (#struct){ 672 - + r1: ~(out.#p.d.r.r1) 673 - r2_r1: (#struct){ 674 - a: (#struct){ 675 - - k: (string){ "simple" } 676 - - d: (#struct){ 677 - - n: (string){ "c1" } 678 - - } 679 - + d: (#struct){ 680 - + n: (string){ "c1" } 681 - + } 682 - + k: (string){ "simple" } 683 - } 684 - } 685 - r2_r2_r1: (#struct){ 686 - a: (#struct){ 687 - - k: (string){ "simple" } 688 - - d: (#struct){ 689 - - n: (string){ "c1" } 690 - - } 691 - + d: (#struct){ 692 - + n: (string){ "c1" } 693 - + } 694 - + k: (string){ "simple" } 695 - } 696 - } 697 - } 83 + 84 + // TODO(fmt): can we improve this? 85 + @test(eq, { 86 + #AC: {k: "simple", d: {n: string}} 87 + #AS: {k: "complex", d: {n: string, r: {}}} 88 + #R: { 89 + a: {k: "simple", d: {n: string}} | {k: "complex", d: {n: string, r: {}}} 90 + } 91 + #S: {n: string, r: {}} 92 + #C: {n: string} 93 + #sub: { 94 + #p: {k: "complex", d: {n: string, r: {}}} 95 + dict: {} 96 + } 97 + _test: { 98 + c1: {d: {n: "c1"}, k: "simple"} 99 + s3: { 100 + d: { 101 + n: "s3" 102 + r: {r1: {a: {d: {n: "c1"}, k: "simple"}}} 103 + } 104 + k: "complex" 105 + } 106 + s2: { 107 + d: { 108 + n: "s2" 109 + r: { 110 + r1: {a: {d: {n: "c1"}, k: "simple"}} 111 + r2: { 112 + a: { 113 + d: { 114 + n: "s3" 115 + r: {r1: {a: {d: {n: "c1"}, k: "simple"}}} 116 + } 117 + k: "complex" 118 + } 119 + } 120 + } 121 + } 122 + k: "complex" 123 + } 124 + s1: { 125 + d: { 126 + n: "s1" 127 + r: { 128 + r1: {a: {d: {n: "c1"}, k: "simple"}} 129 + r2: { 130 + a: { 131 + d: { 132 + n: "s2" 133 + r: { 134 + r1: {a: {d: {n: "c1"}, k: "simple"}} 135 + r2: { 136 + a: { 137 + d: { 138 + n: "s3" 139 + r: {r1: {a: {d: {n: "c1"}, k: "simple"}}} 140 + } 141 + k: "complex" 142 + } 143 + } 144 + } 145 + } 146 + k: "complex" 147 + } 148 + } 149 + } 150 + } 151 + k: "complex" 152 + } 153 + } 154 + out: { 155 + #p: { 156 + d: { 157 + n: "s1" 158 + r: { 159 + r1: {a: {d: {n: "c1"}, k: "simple"}} 160 + r2: { 161 + a: { 162 + d: { 163 + n: "s2" 164 + r: { 165 + r1: {a: {d: {n: "c1"}, k: "simple"}} 166 + r2: { 167 + a: { 168 + d: { 169 + n: "s3" 170 + r: {r1: {a: {d: {n: "c1"}, k: "simple"}}} 171 + } 172 + k: "complex" 173 + } 174 + } 175 + } 176 + } 177 + k: "complex" 178 + } 179 + } 180 + } 181 + } 182 + k: "complex" 183 + } 184 + dict: { 185 + r1: {a: {d: {n: "c1"}, k: "simple"}} 186 + r2_r1: {a: {d: {n: "c1"}, k: "simple"}} 187 + r2_r2_r1: {a: {d: {n: "c1"}, k: "simple"}} 188 + } 189 + } 190 + }) 698 191 -- out/eval/stats -- 699 192 Leaks: 192 700 193 Freed: 678 ··· 712 205 MaxConjunctInfos: 5 713 206 MaxReqSets: 19 714 207 MaxRedirect: 4 715 - -- out/eval -- 716 - (struct){ 717 - #AC: (#struct){ 718 - k: (string){ "simple" } 719 - d: (#struct){ 720 - n: (string){ string } 721 - } 722 - } 723 - #AS: (#struct){ 724 - k: (string){ "complex" } 725 - d: (#struct){ 726 - n: (string){ string } 727 - r: (#struct){ 728 - } 729 - } 730 - } 731 - #R: (#struct){ 732 - a: (#struct){ |((#struct){ 733 - k: (string){ "simple" } 734 - d: (#struct){ 735 - n: (string){ string } 736 - } 737 - }, (#struct){ 738 - k: (string){ "complex" } 739 - d: (#struct){ 740 - n: (string){ string } 741 - r: (#struct){ 742 - } 743 - } 744 - }) } 745 - } 746 - #S: (#struct){ 747 - n: (string){ string } 748 - r: (#struct){ 749 - } 750 - } 751 - #C: (#struct){ 752 - n: (string){ string } 753 - } 754 - #sub: (#struct){ 755 - #p: (#struct){ 756 - k: (string){ "complex" } 757 - d: (#struct){ 758 - n: (string){ string } 759 - r: (#struct){ 760 - } 761 - } 762 - } 763 - dict: (#struct){ 764 - } 765 - let subs#1multi = (〈3;#sub〉 & { 766 - #p: 〈2;rd〉.a 767 - }) 768 - } 769 - _test: (struct){ 770 - c1: (#struct){ 771 - k: (string){ "simple" } 772 - d: (#struct){ 773 - n: (string){ "c1" } 774 - } 775 - } 776 - s3: (#struct){ 777 - k: (string){ "complex" } 778 - d: (#struct){ 779 - n: (string){ "s3" } 780 - r: (#struct){ 781 - r1: (#struct){ 782 - a: (#struct){ 783 - k: (string){ "simple" } 784 - d: (#struct){ 785 - n: (string){ "c1" } 786 - } 787 - } 788 - } 789 - } 790 - } 791 - } 792 - s2: (#struct){ 793 - k: (string){ "complex" } 794 - d: (#struct){ 795 - n: (string){ "s2" } 796 - r: (#struct){ 797 - r1: (#struct){ 798 - a: (#struct){ 799 - k: (string){ "simple" } 800 - d: (#struct){ 801 - n: (string){ "c1" } 802 - } 803 - } 804 - } 805 - r2: (#struct){ 806 - a: (#struct){ 807 - k: (string){ "complex" } 808 - d: (#struct){ 809 - n: (string){ "s3" } 810 - r: (#struct){ 811 - r1: (#struct){ 812 - a: (#struct){ 813 - k: (string){ "simple" } 814 - d: (#struct){ 815 - n: (string){ "c1" } 816 - } 817 - } 818 - } 819 - } 820 - } 821 - } 822 - } 823 - } 824 - } 825 - } 826 - s1: (#struct){ 827 - k: (string){ "complex" } 828 - d: (#struct){ 829 - n: (string){ "s1" } 830 - r: (#struct){ 831 - r1: (#struct){ 832 - a: (#struct){ 833 - k: (string){ "simple" } 834 - d: (#struct){ 835 - n: (string){ "c1" } 836 - } 837 - } 838 - } 839 - r2: (#struct){ 840 - a: (#struct){ 841 - k: (string){ "complex" } 842 - d: (#struct){ 843 - n: (string){ "s2" } 844 - r: (#struct){ 845 - r1: (#struct){ 846 - a: (#struct){ 847 - k: (string){ "simple" } 848 - d: (#struct){ 849 - n: (string){ "c1" } 850 - } 851 - } 852 - } 853 - r2: (#struct){ 854 - a: (#struct){ 855 - k: (string){ "complex" } 856 - d: (#struct){ 857 - n: (string){ "s3" } 858 - r: (#struct){ 859 - r1: (#struct){ 860 - a: (#struct){ 861 - k: (string){ "simple" } 862 - d: (#struct){ 863 - n: (string){ "c1" } 864 - } 865 - } 866 - } 867 - } 868 - } 869 - } 870 - } 871 - } 872 - } 873 - } 874 - } 875 - } 876 - } 877 - } 878 - } 879 - out: (#struct){ 880 - #p: (#struct){ 881 - k: (string){ "complex" } 882 - d: (#struct){ 883 - n: (string){ "s1" } 884 - r: (#struct){ 885 - r1: (#struct){ 886 - a: (#struct){ 887 - k: (string){ "simple" } 888 - d: (#struct){ 889 - n: (string){ "c1" } 890 - } 891 - } 892 - } 893 - r2: (#struct){ 894 - a: (#struct){ 895 - k: (string){ "complex" } 896 - d: (#struct){ 897 - n: (string){ "s2" } 898 - r: (#struct){ 899 - r1: (#struct){ 900 - a: (#struct){ 901 - k: (string){ "simple" } 902 - d: (#struct){ 903 - n: (string){ "c1" } 904 - } 905 - } 906 - } 907 - r2: (#struct){ 908 - a: (#struct){ 909 - k: (string){ "complex" } 910 - d: (#struct){ 911 - n: (string){ "s3" } 912 - r: (#struct){ 913 - r1: (#struct){ 914 - a: (#struct){ 915 - k: (string){ "simple" } 916 - d: (#struct){ 917 - n: (string){ "c1" } 918 - } 919 - } 920 - } 921 - } 922 - } 923 - } 924 - } 925 - } 926 - } 927 - } 928 - } 929 - } 930 - } 931 - } 932 - dict: (#struct){ 933 - r1: (#struct){ 934 - a: (#struct){ 935 - k: (string){ "simple" } 936 - d: (#struct){ 937 - n: (string){ "c1" } 938 - } 939 - } 940 - } 941 - r2_r1: (#struct){ 942 - a: (#struct){ 943 - k: (string){ "simple" } 944 - d: (#struct){ 945 - n: (string){ "c1" } 946 - } 947 - } 948 - } 949 - r2_r2_r1: (#struct){ 950 - a: (#struct){ 951 - k: (string){ "simple" } 952 - d: (#struct){ 953 - n: (string){ "c1" } 954 - } 955 - } 956 - } 957 - } 958 - let subs#1multi = (〈3;#sub〉 & { 959 - #p: 〈2;rd〉.a 960 - }) 961 - } 962 - } 963 208 -- out/compile -- 964 209 --- in.cue 965 210 {
+77 -250
cue/testdata/eval/incomplete.txtar
··· 1 - # Cannot convert to inline format: in.cue contains compile-time error expressions 2 - # (e.g., string arithmetic s+s, e5:<e5&s) which prevent the inline test runner 3 - # from compiling the source. Keep in golden-file format. 1 + # Tests incomplete-error reporting for various expressions: string arithmetic, 2 + # non-concrete bounds, self-referential bounds, mutual dependencies, and 3 + # undefined-field lookups. All produce [incomplete] errors except e2 which 4 + # succeeds because "bar" is concrete. issue1837 checks that incomplete errors 5 + # are correctly preferred over cycle errors in conditional comprehensions. 4 6 -- in.cue -- 5 7 s: string 6 8 7 - e1: s + s 8 - e2: >"bar" & s // okay 9 - e3: >s & "foo" // not okay 10 - e3b: >s 9 + e1: s + s @test(err, code=incomplete, 10 + suberr=(code=incomplete, contains="non-concrete value %v in operand to %s", args=[string, +], pos=[0:6, -2:4]), 11 + suberr=(code=incomplete, contains="non-concrete value %v in operand to %s", args=[string, +], pos=[0:6, -2:4]), 12 + ) 13 + e2: >"bar" & s @test(eq, >"bar") // okay: "bar" is concrete, result is a valid bound 14 + e3: >s & "foo" @test(err, code=incomplete, contains="non-concrete value s for bound >", pos=[0:7]) 15 + e3b: >s @test(err, code=incomplete, contains="non-concrete value s for bound >", pos=[0:7]) 11 16 12 - e4: >e1 & s 13 - e5: <e5 & s 17 + e4: >e1 & s @test(err, code=incomplete, pos=[-8:6, -10:4]) 18 + e5: <e5 & s @test(err, code=incomplete|cycle, pos=[0:6]) 14 19 15 20 E: { 16 - a: c - b 17 - b: c - a 18 - c: a+b & >=5 21 + a: c - b @test(err, code=incomplete, pos=[0:5, 2:5, 2:11]) 22 + b: c - a @test(err, code=incomplete, pos=[0:5, 1:5, 1:11]) 23 + c: a+b & >=5 @test(err, code=incomplete, pos=[-1:5, 0:5, 0:11]) 19 24 } 20 25 21 - a: int 22 - okay: (>10 & <a) + 3 26 + a: int @test(eq, int) 27 + okay: (>10 & <a) + 3 @test(err, code=incomplete, contains="non-concrete value a for bound <", pos=[0:15]) 23 28 24 29 // No output or "cycle error" when checking existence of non-existing fields; 25 30 // an incomplete error should be reported instead of a cycle error. ··· 27 32 issue1837: { 28 33 // x is properly recognized as erroneous and the "message" field is added 29 34 // with the value "a", instead of as a cycle error. 35 + 36 + // TODO(inline): use permute, but ensure comprehensions are permuted too first. 37 + // @test(permute) 30 38 p1: { 31 39 context: {} 32 - x: context.b // incomplete error 40 + x: context.b @test(err, code=incomplete, contains="undefined field: b", pos=[0:14]) 33 41 if x == _|_ { 34 42 message: "a" 35 43 } 44 + @test(eq, { 45 + context: {} 46 + x: _|_ 47 + message: "a" 48 + }) 36 49 } 37 50 p2: { 38 51 if x == _|_ { 39 52 message: "a" 40 53 } 41 - x: context.b // incomplete error 54 + x: context.b @test(err, code=incomplete, contains="undefined field: b", pos=[0:14]) 42 55 context: {} 56 + @test(eq, { 57 + message: "a" 58 + x: _|_ 59 + context: {} 60 + }) 43 61 } 44 62 p3: { 45 63 if x == _|_ { 46 64 message: "a" 47 65 } 48 66 context: {} 49 - x: context.b // incomplete error 67 + x: context.b @test(err, code=incomplete, contains="undefined field: b", pos=[0:14]) 68 + @test(eq, { 69 + message: "a" 70 + context: {} 71 + x: _|_ 72 + }) 50 73 } 51 74 } 52 75 -- out/eval/stats -- ··· 61 84 Disjuncts: 0 62 85 63 86 NumCloseIDs: 9 64 - -- out/eval -- 65 - (struct){ 66 - s: (string){ string } 67 - e1: (_|_){ 68 - // [incomplete] e1: non-concrete value string in operand to +: 69 - // ./in.cue:3:6 70 - // ./in.cue:1:4 71 - } 72 - e2: (string){ >"bar" } 73 - e3: (_|_){ 74 - // [incomplete] e3: non-concrete value s for bound >: 75 - // ./in.cue:5:7 76 - } 77 - e3b: (_|_){ 78 - // [incomplete] e3b: non-concrete value s for bound >: 79 - // ./in.cue:6:7 80 - } 81 - e4: (_|_){ 82 - // [incomplete] e1: non-concrete value string in operand to +: 83 - // ./in.cue:3:6 84 - // ./in.cue:1:4 85 - } 86 - e5: (_|_){ 87 - // [cycle] cycle error 88 - } 89 - E: (struct){ 90 - a: (_|_){ 91 - // [cycle] cycle error: 92 - // ./in.cue:12:5 93 - } 94 - b: (_|_){ 95 - // [cycle] cycle error: 96 - // ./in.cue:13:5 97 - } 98 - c: (_|_){ 99 - // [cycle] cycle error: 100 - // ./in.cue:12:5 101 - // cycle error: 102 - // ./in.cue:13:5 103 - } 104 - } 105 - a: (int){ int } 106 - okay: (_|_){ 107 - // [incomplete] non-concrete value a for bound <: 108 - // ./in.cue:18:15 109 - } 110 - issue1837: (struct){ 111 - p1: (struct){ 112 - context: (struct){ 113 - } 114 - x: (_|_){ 115 - // [incomplete] issue1837.p1.x: undefined field: b: 116 - // ./in.cue:25:14 117 - // ./in.cue:28:14 118 - } 119 - message: (string){ "a" } 120 - } 121 - p2: (struct){ 122 - message: (string){ "a" } 123 - x: (_|_){ 124 - // [incomplete] issue1837.p2.x: undefined field: b: 125 - // ./in.cue:34:14 126 - // ./in.cue:37:14 127 - } 128 - context: (struct){ 129 - } 130 - } 131 - p3: (struct){ 132 - message: (string){ "a" } 133 - context: (struct){ 134 - } 135 - x: (_|_){ 136 - // [incomplete] issue1837.p3.x: undefined field: b: 137 - // ./in.cue:42:14 138 - } 139 - } 140 - } 141 - } 142 - -- out/evalalpha -- 143 - (struct){ 144 - s: (string){ string } 145 - e1: (_|_){ 146 - // [incomplete] e1: non-concrete value string in operand to +: 147 - // ./in.cue:3:6 148 - // ./in.cue:1:4 149 - } 150 - e2: (string){ >"bar" } 151 - e3: (_|_){ 152 - // [incomplete] e3: non-concrete value s for bound >: 153 - // ./in.cue:5:7 154 - } 155 - e3b: (_|_){ 156 - // [incomplete] e3b: non-concrete value s for bound >: 157 - // ./in.cue:6:7 158 - } 159 - e4: (_|_){ 160 - // [incomplete] e1: non-concrete value string in operand to +: 161 - // ./in.cue:3:6 162 - // ./in.cue:1:4 163 - } 164 - e5: (_|_){ 165 - // [incomplete] e5: non-concrete value e5 for bound <: 166 - // ./in.cue:9:6 167 - } 168 - E: (struct){ 169 - a: (_|_){ 170 - // [incomplete] E.a: non-concrete value >=5 in operand to -: 171 - // ./in.cue:12:5 172 - // ./in.cue:14:5 173 - // ./in.cue:14:11 174 - // E.b: non-concrete value >=5 in operand to -: 175 - // ./in.cue:13:5 176 - // ./in.cue:14:5 177 - // ./in.cue:14:11 178 - } 179 - b: (_|_){ 180 - // [incomplete] E.b: non-concrete value >=5 in operand to -: 181 - // ./in.cue:13:5 182 - // ./in.cue:14:5 183 - // ./in.cue:14:11 184 - } 185 - c: (_|_){ 186 - // [incomplete] E.b: non-concrete value >=5 in operand to -: 187 - // ./in.cue:13:5 188 - // ./in.cue:14:5 189 - // ./in.cue:14:11 190 - } 191 - } 192 - a: (int){ int } 193 - okay: (_|_){ 194 - // [incomplete] non-concrete value a for bound <: 195 - // ./in.cue:18:15 196 - } 197 - issue1837: (struct){ 198 - p1: (struct){ 199 - context: (struct){ 200 - } 201 - x: (_|_){ 202 - // [incomplete] issue1837.p1.x: undefined field: b: 203 - // ./in.cue:28:14 204 - } 205 - message: (string){ "a" } 206 - } 207 - p2: (struct){ 208 - message: (string){ "a" } 209 - x: (_|_){ 210 - // [incomplete] issue1837.p2.x: undefined field: b: 211 - // ./in.cue:37:14 212 - } 213 - context: (struct){ 214 - } 215 - } 216 - p3: (struct){ 217 - message: (string){ "a" } 218 - context: (struct){ 219 - } 220 - x: (_|_){ 221 - // [incomplete] issue1837.p3.x: undefined field: b: 222 - // ./in.cue:45:14 223 - } 224 - } 225 - } 226 - } 227 - -- diff/-out/evalalpha<==>+out/eval -- 228 - diff old new 229 - --- old 230 - +++ new 231 - @@ -20,22 +20,31 @@ 232 - // ./in.cue:1:4 233 - } 234 - e5: (_|_){ 235 - - // [cycle] cycle error 236 - + // [incomplete] e5: non-concrete value e5 for bound <: 237 - + // ./in.cue:9:6 238 - } 239 - E: (struct){ 240 - a: (_|_){ 241 - - // [cycle] cycle error: 242 - - // ./in.cue:12:5 243 - + // [incomplete] E.a: non-concrete value >=5 in operand to -: 244 - + // ./in.cue:12:5 245 - + // ./in.cue:14:5 246 - + // ./in.cue:14:11 247 - + // E.b: non-concrete value >=5 in operand to -: 248 - + // ./in.cue:13:5 249 - + // ./in.cue:14:5 250 - + // ./in.cue:14:11 251 - } 252 - b: (_|_){ 253 - - // [cycle] cycle error: 254 - - // ./in.cue:13:5 255 - + // [incomplete] E.b: non-concrete value >=5 in operand to -: 256 - + // ./in.cue:13:5 257 - + // ./in.cue:14:5 258 - + // ./in.cue:14:11 259 - } 260 - c: (_|_){ 261 - - // [cycle] cycle error: 262 - - // ./in.cue:12:5 263 - - // cycle error: 264 - - // ./in.cue:13:5 265 - + // [incomplete] E.b: non-concrete value >=5 in operand to -: 266 - + // ./in.cue:13:5 267 - + // ./in.cue:14:5 268 - + // ./in.cue:14:11 269 - } 270 - } 271 - a: (int){ int } 272 - @@ -49,7 +58,6 @@ 273 - } 274 - x: (_|_){ 275 - // [incomplete] issue1837.p1.x: undefined field: b: 276 - - // ./in.cue:25:14 277 - // ./in.cue:28:14 278 - } 279 - message: (string){ "a" } 280 - @@ -58,7 +66,6 @@ 281 - message: (string){ "a" } 282 - x: (_|_){ 283 - // [incomplete] issue1837.p2.x: undefined field: b: 284 - - // ./in.cue:34:14 285 - // ./in.cue:37:14 286 - } 287 - context: (struct){ 288 - @@ -70,7 +77,7 @@ 289 - } 290 - x: (_|_){ 291 - // [incomplete] issue1837.p3.x: undefined field: b: 292 - - // ./in.cue:42:14 293 - + // ./in.cue:45:14 294 - } 295 - } 296 - } 87 + -- out/errors.txt -- 88 + [incomplete] e1: non-concrete value string in operand to +: 89 + ./in.cue:3:6 90 + ./in.cue:1:4 91 + [incomplete] e3: non-concrete value s for bound >: 92 + ./in.cue:8:7 93 + [incomplete] e3b: non-concrete value s for bound >: 94 + ./in.cue:9:7 95 + [incomplete] e1: non-concrete value string in operand to +: 96 + ./in.cue:3:6 97 + ./in.cue:1:4 98 + [incomplete] e5: non-concrete value e5 for bound <: 99 + ./in.cue:12:6 100 + [incomplete] E.a: non-concrete value >=5 in operand to -: 101 + ./in.cue:15:5 102 + ./in.cue:17:5 103 + ./in.cue:17:11 104 + E.b: non-concrete value >=5 in operand to -: 105 + ./in.cue:16:5 106 + ./in.cue:17:5 107 + ./in.cue:17:11 108 + [incomplete] E.b: non-concrete value >=5 in operand to -: 109 + ./in.cue:16:5 110 + ./in.cue:17:5 111 + ./in.cue:17:11 112 + [incomplete] E.b: non-concrete value >=5 in operand to -: 113 + ./in.cue:16:5 114 + ./in.cue:17:5 115 + ./in.cue:17:11 116 + [incomplete] non-concrete value a for bound <: 117 + ./in.cue:21:15 118 + [incomplete] issue1837.p1.x: undefined field: b: 119 + ./in.cue:34:14 120 + [incomplete] issue1837.p2.x: undefined field: b: 121 + ./in.cue:48:14 122 + [incomplete] issue1837.p3.x: undefined field: b: 123 + ./in.cue:61:14 297 124 -- out/compile -- 298 125 --- in.cue 299 126 {
+2
cue/testdata/eval/incompleteperm.txtar
··· 1 + #inlinetest:exclude source contains compile-time error expressions (abstract arithmetic, 2 + # bound comparisons) which prevent the inline runner from compiling the source. 1 3 // Issue #742 2 4 // Issue #405 3 5 -- in.cue --
+5 -5
cue/testdata/eval/issue1640.txtar
··· 6 6 -- a1.cue -- 7 7 package bug 8 8 9 - y: fact2.uc 10 - x: fact1.uc 9 + y: fact2.uc @test(eq, "foo") 10 + x: fact1.uc @test(eq, "foo") 11 11 -- a2.cue -- 12 12 package bug 13 13 14 - x: fact1.uc 15 - y: fact2.uc 14 + x: fact1.uc @test(eq, "foo") 15 + y: fact2.uc @test(eq, "foo") 16 16 -- x.cue -- 17 17 package bug 18 18 19 19 fact1: #MCS & {lc: fact2.lc} @test(eq, {lc: "foo", uc: "foo"}) @test(closed) 20 - fact2: #MCS & {lc: "foo"} @test(eq, {lc: "foo", uc: "foo"}) @test(closed) 20 + fact2: #MCS & {lc: "foo"} @test(eq, {lc: "foo", uc: "foo"}) @test(closed) 21 21 22 22 #MCS: #MultiCaseString @test(eq, {lc: string, uc: string}) @test(closed) @test(shareID=MCS) 23 23 #MultiCaseString: {
+8 -36
cue/testdata/export/issue2119.txtar
··· 1 - #todo:inline: skip — tests export format, not evaluator semantics 2 1 -- in.cue -- 3 2 import ( 4 3 "encoding/yaml" ··· 11 10 [R+""][0] 12 11 } 13 12 out: yaml.Marshal(x) 13 + @test(leq, {x: {d: ".*"}, out: string}) 14 14 } 15 15 16 16 original: { ··· 32 32 } 33 33 } 34 34 out: yaml.Marshal(rule) 35 + // TODO(inline): support multi-line strings. 36 + @test(leq, {out: string}) 35 37 } 38 + -- out/errors.txt -- 39 + [incomplete] original.#testableRegexp.#test.out: non-concrete value string in operand to +: 40 + ./in.cue:21:29 41 + ./in.cue:16:21 42 + ./in.cue:17:3 36 43 -- out/eval/stats -- 37 44 Leaks: 0 38 45 Freed: 31 ··· 45 52 Disjuncts: 0 46 53 47 54 NumCloseIDs: 14 48 - -- out/evalalpha -- 49 - (struct){ 50 - simplified: (struct){ 51 - x: (struct){ 52 - d: (string){ ".*" } 53 - } 54 - out: (string){ "d: .*\n" } 55 - } 56 - original: (struct){ 57 - #testableRegexp: (string){ 58 - string 59 - #test: (#struct){ 60 - in: (string){ string } 61 - out: (_|_){ 62 - // [incomplete] original.#testableRegexp.#test.out: non-concrete value string in operand to +: 63 - // ./in.cue:20:29 64 - // ./in.cue:15:21 65 - // ./in.cue:16:3 66 - } 67 - } 68 - } 69 - rule: (struct){ 70 - #patterns: (#struct){ 71 - bar: (string){ 72 - "(.*)" 73 - #test: (#struct){ 74 - in: (string){ "testcontent" } 75 - out: (string){ "testcontent" } 76 - } 77 - } 78 - } 79 - } 80 - out: (string){ "{}\n" } 81 - } 82 - } 83 55 -- out/compile -- 84 56 --- in.cue 85 57 {
+18 -61
cue/testdata/export/issue2244.txtar
··· 1 - #todo:inline: skip — tests export format, not evaluator semantics 2 1 -- in.cue -- 3 2 package x 4 3 ··· 32 31 m: #step & { 33 32 if: _#isReleaseTag 34 33 } 34 + @test(eq, { 35 + _#matchPattern$x: {_|_, #pattern: string} 36 + _#isReleaseTag$x: { 37 + "refs/tags/v" 38 + #pattern: "refs/tags/v*" 39 + } 40 + #step: {if: number | string} 41 + m: { 42 + if: { 43 + "refs/tags/v" 44 + #pattern: "refs/tags/v*" 45 + } 46 + } 47 + }) 35 48 -- out/eval/stats -- 36 49 Leaks: 6 37 50 Freed: 29 ··· 48 61 -- diff/explanation -- 49 62 New evaluator should ultimately disallow new definitions in closed structs 50 63 and not allow #pattern in #step 51 - -- out/evalalpha -- 52 - (struct){ 53 - _#matchPattern(:x): (_|_){ 54 - // [incomplete] error in call to strings.HasSuffix: non-concrete value string: 55 - // ./in.cue:11:6 56 - // ./in.cue:8:12 57 - #pattern: (string){ string } 58 - } 59 - _#isReleaseTag(:x): (string){ 60 - "refs/tags/v" 61 - #pattern: (string){ "refs/tags/v*" } 62 - let prefix#1 = (string){ "refs/tags/v" } 63 - } 64 - #step: (#struct){ 65 - if: ((string|number)){ |((number){ number }, (string){ string }) } 66 - } 67 - m: (#struct){ 68 - if: (string){ 69 - "refs/tags/v" 70 - #pattern: (string){ "refs/tags/v*" } 71 - let prefix#1 = (string){ "refs/tags/v" } 72 - } 73 - } 74 - } 75 - -- diff/-out/evalalpha<==>+out/eval -- 76 - diff old new 77 - --- old 78 - +++ new 79 - @@ -1,6 +1,6 @@ 80 - (struct){ 81 - _#matchPattern(:x): (_|_){ 82 - - // [incomplete] _#matchPattern: error in call to strings.HasSuffix: non-concrete value string: 83 - + // [incomplete] error in call to strings.HasSuffix: non-concrete value string: 84 - // ./in.cue:11:6 85 - // ./in.cue:8:12 86 - #pattern: (string){ string } 87 - -- out/eval -- 88 - (struct){ 89 - _#matchPattern(:x): (_|_){ 90 - // [incomplete] _#matchPattern: error in call to strings.HasSuffix: non-concrete value string: 91 - // ./in.cue:11:6 92 - // ./in.cue:8:12 93 - #pattern: (string){ string } 94 - } 95 - _#isReleaseTag(:x): (string){ 96 - "refs/tags/v" 97 - #pattern: (string){ "refs/tags/v*" } 98 - let prefix#1 = (string){ "refs/tags/v" } 99 - } 100 - #step: (#struct){ 101 - if: ((string|number)){ |((number){ number }, (string){ string }) } 102 - } 103 - m: (#struct){ 104 - if: (string){ 105 - "refs/tags/v" 106 - #pattern: (string){ "refs/tags/v*" } 107 - let prefix#1 = (string){ "refs/tags/v" } 108 - } 109 - } 110 - } 64 + -- out/errors.txt -- 65 + [incomplete] error in call to strings.HasSuffix: non-concrete value string: 66 + ./in.cue:11:6 67 + ./in.cue:8:12 111 68 -- out/compile -- 112 69 --- in.cue 113 70 {
+5 -10
cue/testdata/export/issue854.txtar
··· 1 - #todo:inline: skip — tests export format, not evaluator semantics 2 1 -- cue.mod/module.cue -- 3 2 module: "mod.test" 4 3 language: version: "v0.9.0" ··· 7 6 8 7 import "mod.test/b" 9 8 10 - theb: b.name 9 + theb: b.name @test(err, code=incomplete, path=b, contains="undefined field: %s", args=[c], pos=[b/b.cue:5:6]) 11 10 -- b/b.cue -- 12 11 package b 13 12 ··· 20 19 name: b.other 21 20 -- c/c.cue -- 22 21 package c 22 + -- out/errors.txt -- 23 + [incomplete] b: undefined field: c: 24 + ./b/b.cue:5:6 23 25 -- out/compile -- 24 26 --- a.cue 25 27 { ··· 36 38 Conjuncts: 8 37 39 Disjuncts: 0 38 40 39 - NumCloseIDs: 1 40 - -- out/evalalpha -- 41 - (struct){ 42 - theb: (_|_){ 43 - // [incomplete] b: undefined field: c: 44 - // ./b/b.cue:5:6 45 - } 46 - } 41 + NumCloseIDs: 1
+4 -4
cue/testdata/fulleval/029_Issue_#94.txtar
··· 27 27 } 28 28 -- out/errors.txt -- 29 29 [incomplete] select.opt: cannot reference optional field: opt: 30 - ./in.cue:14:15 30 + ./in.cue:11:15 31 31 [incomplete] index.opt: cannot reference optional field: opt: 32 - ./in.cue:21:15 32 + ./in.cue:18:15 33 33 [incomplete] index.#def: undefined field: "#def": 34 - ./in.cue:23:15 34 + ./in.cue:20:15 35 35 [incomplete] index._hidden: undefined field: "_hidden": 36 - ./in.cue:25:15 36 + ./in.cue:22:15 37 37 -- out/eval/stats -- 38 38 Leaks: 0 39 39 Freed: 22
+2 -2
cue/testdata/lists/020_list_compilefail.txtar
··· 1 - # The CUE source contains compile-time errors (invalid operands to *), 2 - # so inline @test() annotations are not possible. Keep golden sections. 1 + #inlinetest:exclude CUE source contains compile-time errors (invalid operands to *) 2 + # which prevent the inline runner from compiling the source. 3 3 #name: list arithmetic 4 4 #evalPartial 5 5 -- in.cue --
+1 -1
cue/testdata/references/alias_err.txtar
··· 1 - #todo:inline: compile-time alias errors prevent CUE source compilation; @test(err) requires successful compile 1 + #inlinetest:exclude compile-time alias errors prevent CUE source compilation; @test(err) requires successful compile 2 2 -- old.cue -- 3 3 // issue2527: self-referential alias in key `x=(x):` caused an "unreachable" 4 4 // panic (https://cuelang.org/issue/2527).
+2 -5
cue/testdata/references/letcycle.txtar
··· 1 - # Tests that mutually recursive let bindings produce "cyclic references in let 2 - # clause or alias" errors. Issue #1042: a 4-bit adder circuit expressed with 3 - # two mutually dependent let bindings (fulladders and carries) should be 4 - # detected as a cycle at compile time rather than causing a runtime panic. 1 + #inlinetest:exclude mutually recursive let bindings produce compile-time cycle errors 2 + # which prevent the inline runner from compiling the source. Issue #1042. 5 3 #expandLetExpr: true 6 - # So no @test because of compile-time errors. 7 4 -- in.cue -- 8 5 import "list" 9 6
+57 -15
cue/testdata/references/self.txtar
··· 1 1 Test various self reference cases. 2 - #todo:inline: hard — cycle semantics require @test(err, code=cycle) and careful scoping 3 2 -- in.cue -- 4 3 @experiment(aliasv2) 5 4 6 5 // Basic self usage - top level 7 - a: self.b 6 + a: self.b @test(eq, "hello") 8 7 b: "hello" 9 8 10 9 // Nested self usage - should refer to x struct 11 10 x: { 12 11 y: self.z 13 12 z: "world" 14 - } 13 + } @test(eq, {y: "world", z: "world"}) 15 14 16 15 // Shorthand notation - self should refer to foo struct 17 - foo: bar: self.baz 18 - foo: baz: "greeting" 16 + foo: bar: self.baz @test(eq, "greeting") 17 + foo: baz: "greeting" @test(eq, "greeting") // TODO(inline): reference marking does not work with "self" 19 18 20 19 // Multiple levels of nesting 21 20 nested: { ··· 23 22 field: self.value 24 23 value: "level1 value" 25 24 } 26 - } 25 + } @test(eq, { 26 + level1: { 27 + field: "level1 value" 28 + value: "level1 value" 29 + } 30 + }) 27 31 28 32 // Self in list context 29 33 listTest: { 30 34 items: [1, 2, self[0], self[1]] 31 35 first: 1 32 36 second: 2 33 - } 37 + } @test(eq, { 38 + items: [1, 2, 1, 2] 39 + first: 1 40 + second: 2 41 + }) 34 42 35 43 // Self with computed selectors 36 44 computed: { 37 45 key: "test" 38 46 value: self["key"] 39 - } 47 + } @test(eq, {key: "test", value: "test"}) 40 48 41 49 // Cyclic reference detection 42 - cycle: self.cycle 50 + cycle: self.cycle @test(eq, _) 43 51 44 52 -- list.cue -- 45 53 @experiment(aliasv2) ··· 47 55 48 56 #IntStrings: {list.Repeat([int, string], div(len(self), 2))} 49 57 listCheck: ok1: #IntStrings 50 - listCheck: ok1: [1, "foo", 2, "bar"] 58 + listCheck: ok1: [1, "foo", 2, "bar"] @test(eq, [1, "foo", 2, "bar"]) 51 59 52 60 listCheck: err: #IntStrings 53 - listCheck: err: [1, "foo", "bar", 2] 61 + listCheck: err: [1, "foo", "bar", 2] @test(err, code=eval, path=2, contains="conflicting values %s and %s (mismatched types %s and %s)", args=["bar", int, string, int], pos=[-5:14, -5:15, -5:28, -1:17, 0:28]) 54 62 55 63 -- withlet.cue -- 56 64 @experiment(aliasv2) ··· 62 70 bar: { 63 71 baz: X.foo 64 72 } 65 - } 73 + } @test(eq, {foo: 1, bar: {baz: 1}}) 66 74 -- validator.cue -- 67 75 @experiment(structcmp) 68 76 @experiment(aliasv2) 69 77 70 78 validator: { 71 - err1: {{{{== (self + 1)}}}} 79 + err1: {{{{== (self + 1)}}}} @test(err, code=eval, 80 + contains="invalid value %v (out of bound %s)", args=[2, ==3], 81 + pos=[0:12, 0:8, 4:8] 82 + ) 72 83 err1: 2 73 84 74 - err2: {== (self + 1)} 85 + err2: {== (self + 1)} @test(err, code=eval, 86 + contains="invalid value %v (out of bound %s)", args=[2, ==3], 87 + pos=[0:9, 0:8, 4:8] 88 + ) 75 89 err2: 2 76 90 } 77 91 78 92 cyclicErr: { 79 - err3: == (self + 1) 93 + err3: == (self + 1) @test(err, code=eval, 94 + contains="invalid operands %s and %s to '%s' (type %s and %s)", 95 + pos=[0:12, -1:12, 0:19] 96 + ) 80 97 err3: 4 81 98 } 82 99 ··· 215 232 c: 3 216 233 } 217 234 235 + -- out/errors.txt -- 236 + [eval] listCheck.err.2: conflicting values "bar" and int (mismatched types string and int): 237 + ./list.cue:4:14 238 + ./list.cue:4:15 239 + ./list.cue:4:28 240 + ./list.cue:8:17 241 + ./list.cue:9:28 242 + [eval] listCheck.err.3: conflicting values 2 and string (mismatched types int and string): 243 + ./list.cue:4:14 244 + ./list.cue:4:15 245 + ./list.cue:4:33 246 + ./list.cue:8:17 247 + ./list.cue:9:35 248 + [eval] validator.err1: invalid value 2 (out of bound ==3): 249 + ./validator.cue:5:12 250 + ./validator.cue:5:8 251 + ./validator.cue:9:8 252 + [eval] validator.err2: invalid value 2 (out of bound ==3): 253 + ./validator.cue:11:9 254 + ./validator.cue:11:8 255 + ./validator.cue:15:8 256 + [eval] cyclicErr.err3: invalid operands {err3:_|_(cyclicErr.err3: invalid operands value at path 'cyclicErr' and 1 to '+' (type struct and int))} and 1 to '+' (type struct and int): 257 + ./validator.cue:19:12 258 + ./validator.cue:18:12 259 + ./validator.cue:19:19 218 260 -- out/compile -- 219 261 --- in.cue 220 262 {
+4 -3
internal/cuetxtar/inline.go
··· 543 543 name string 544 544 strippedAST *ast.File // original parsed AST (attrs retained) 545 545 // hasTestAttrs is true when the file contained at least one @test attribute. 546 - // Files where this is false are treated as fixture files: they are still 547 - // compiled into the evaluated value (so references from other files work) 548 - // but their top-level fields are NOT required to carry @test directives. 546 + // Files where this is false are compiled into the evaluated value (so 547 + // cross-file references work) but their fields must still be reachable 548 + // (transitively) from tested fields via identifier references; unreachable 549 + // fields are reported as uncovered by checkFieldCoverage. 549 550 hasTestAttrs bool 550 551 } 551 552
+12
internal/cuetxtar/inline_attr.go
··· 600 600 return false 601 601 } 602 602 603 + // hasInlinetestExclude reports whether the archive comment contains a 604 + // "#inlinetest:exclude" line, meaning the archive is explicitly excluded from 605 + // the inline @test framework with a stated reason. 606 + func hasInlinetestExclude(a *txtar.Archive) bool { 607 + for line := range strings.SplitSeq(string(a.Comment), "\n") { 608 + if strings.HasPrefix(strings.TrimSpace(line), "#inlinetest:exclude") { 609 + return true 610 + } 611 + } 612 + return false 613 + } 614 + 603 615 // declsHaveTestAttrs recursively searches decls for any @test(...) attribute, 604 616 // descending into struct-valued fields and comprehension bodies at any depth. 605 617 func declsHaveTestAttrs(decls []ast.Decl) bool {
+5 -4
internal/cuetxtar/inline_coverage.go
··· 37 37 // ... }` ties items and results together: testing results implicitly 38 38 // exercises items. See coverage_comprehension.txtar for an example. 39 39 // 40 - // Files without any @test attribute are exempt (they are fixture files). 40 + // CUE files without any @test attribute (fixture files) are still included in 41 + // the coverage check: their fields must be reachable from tested fields via 42 + // identifier references. A fixture file whose top-level fields are all 43 + // referenced (transitively) by tested fields is fine; one with unreachable 44 + // fields is flagged, since those fields are never exercised. 41 45 // Archives with a file-level @test that covers the whole file are exempt too. 42 46 // Suppressing the check for a specific archive is possible via: 43 47 // ··· 119 123 compRefs []map[string]bool 120 124 ) 121 125 for _, cf := range r.cueFiles { 122 - if !cf.hasTestAttrs { 123 - continue 124 - } 125 126 parseDecls(cf.strippedAST.Decls, cf.name, &entries, allNames, aliasToField, letRefs, &compRefs) 126 127 } 127 128 if len(entries) == 0 {
+3 -3
internal/cuetxtar/testdata/inline/coverage_fixture.txtar
··· 1 - # Tests that files without any @test are treated as fixture files and are 2 - # exempt from field-coverage checks. The helper fields in fixture.cue do not 3 - # need @test directives even though they are referenced by test.cue. 1 + # Tests that fixture files (no @test) with fields reachable from tested fields 2 + # pass coverage checks without needing @test directives of their own. 3 + # base in fixture.cue is referenced by result in test.cue, so it is covered. 4 4 -- in/fixture.cue -- 5 5 package p 6 6
+16
internal/cuetxtar/testdata/inline/coverage_fixture_orphan.txtar
··· 1 + # Tests that a fixture file (no @test) with a field unreachable from any tested 2 + # field is flagged as uncovered. This catches test-case files that were added 3 + # to an inline archive without @test directives. 4 + -- in/fixture.cue -- 5 + package p 6 + 7 + orphan: 42 8 + -- in/test.cue -- 9 + package p 10 + 11 + a: 1 @test(eq, 1) 12 + -- out/run/errors.txt -- 13 + fixture.cue:3: field orphan is not covered: add a @test directive or reference it from a tested field 14 + -- out/status.txt -- 15 + update: identical to input 16 + force: identical to update
+9
internal/cuetxtar/txtar.go
··· 503 503 return 504 504 } 505 505 506 + // When inline mode is enabled, every archive that lacks @test 507 + // directives must carry a #inlinetest:exclude comment explaining 508 + // why it is excluded. This prevents new unconverted files from 509 + // being added silently. 510 + if x.Inline && !hasInlinetestExclude(a) { 511 + t.Errorf("archive has no @test directives and no #inlinetest:exclude comment;\n" + 512 + "\tadd @test directives or add '#inlinetest:exclude <reason>' to the archive comment") 513 + } 514 + 506 515 tc := &Test{ 507 516 T: t, 508 517 M: m,