this repo has no description
0
fork

Configure Feed

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

internal/cuetxtar: use structural_cycle code

Rename the structural cycle error code string from "structural cycle"
(with space) to "structural_cycle" (with underscore) to make it
easier to use in key=value attribute arguments without quoting.

This changes the line comment on StructuralCycleError and regenerates
the stringer output. (The error message text "structural cycle" is
unchanged.)

Update all @test(err, code=structural_cycle) annotations and all
golden-file sections that print "[structural_cycle]" prefixes.

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

+315 -256
+4 -4
cue/testdata/builtins/closed.txtar
··· 155 155 foo?: _schema 156 156 }) @test(shareID=S) 157 157 // TODO(inline): make work for hidden fields. 158 - // @test(err, at=_schema.foo, code="structural cycle") 158 + // @test(err, at=_schema.foo, code=structural_cycle) 159 159 // @test(shareID=S, at=x.foo.foo) 160 160 161 161 x: {_schema} ··· 166 166 foo?: _schema 167 167 }) 168 168 // TODO(inline): make work for hidden fields. 169 - // @test(err, at=foo, code="structural cycle") 169 + // @test(err, at=foo, code=structural_cycle) 170 170 x: {{_schema}} 171 171 x: foo: disallowed: 5 @test(err, code=eval, contains="field not allowed", pos=[0:10]) 172 172 } ··· 194 194 ./embed.cue:25:10 195 195 [eval] unified.t2.x.foo.disallowed: field not allowed: 196 196 ./embed.cue:29:10 197 - [structural cycle] nestedWithSelfReference.t1._schema.foo: structural cycle 197 + [structural_cycle] nestedWithSelfReference.t1._schema.foo: structural cycle 198 198 [eval] nestedWithSelfReference.t1.x.foo.disallowed: field not allowed: 199 199 ./embed.cue:40:10 200 - [structural cycle] nestedWithSelfReference.t2._schema.foo: structural cycle 200 + [structural_cycle] nestedWithSelfReference.t2._schema.foo: structural cycle 201 201 [eval] nestedWithSelfReference.t2.x.foo.disallowed: field not allowed: 202 202 ./embed.cue:49:10 203 203 [eval] b.x: field not allowed:
+2 -2
cue/testdata/compile/scope.txtar
··· 40 40 f: B @test(eq, {open: int}) 41 41 42 42 schema: { 43 - next: _schema_1 @test(err, code=structural cycle) 43 + next: _schema_1 @test(err, code=structural_cycle) 44 44 } 45 45 46 46 let _schema_1 = schema 47 47 -- out/errors.txt -- 48 - [structural cycle] schema.next: structural cycle 48 + [structural_cycle] schema.next: structural cycle 49 49 -- out/compile -- 50 50 --- in.cue 51 51 {
+3 -3
cue/testdata/comprehensions/pushdown.txtar
··· 209 209 sum: tail.sum 210 210 } 211 211 } 212 - @test(err, code="structural cycle", at="#list.tail", contains="structural cycle", pos=[]) 212 + @test(err, code=structural_cycle, at="#list.tail", contains="structural cycle", pos=[]) 213 213 } 214 214 215 215 ··· 1327 1327 [eval] fieldMismatch.a: cannot combine regular field "x" with 2: 1328 1328 ./in.cue:185:7 1329 1329 ./in.cue:183:3 1330 - [structural cycle] noStackOverflowStructCycle.#list.tail: structural cycle 1331 - [structural cycle] noStackOverflowStructCycle.list.tail: structural cycle 1330 + [structural_cycle] noStackOverflowStructCycle.#list.tail: structural cycle 1331 + [structural_cycle] noStackOverflowStructCycle.list.tail: structural cycle 1332 1332 [incomplete] provideIncompleteSuccess.t1.#a: incomplete bool: bool: 1333 1333 ./in.cue:220:7 1334 1334 [eval] provideIncompleteSuccess.t2.a.c.d: field not allowed:
+6 -6
cue/testdata/cycle/023_reentrance.txtar
··· 21 21 } 22 22 fib1: (fib & {n: 1}).out @test(eq, 1) // MAY NOT be an error 23 23 fib2: (fib & {n: 2}).out @test(eq, 1) // MAY be an error 24 - fib3: (fib & {n: 3}).out @test(err, code=structural cycle) // SHOULD be an error 25 - fib7: (fib & {n: 7}).out @test(err, code=structural cycle) // Error 26 - fib12: (fib & {n: 12}).out @test(err, code=structural cycle) // Error 24 + fib3: (fib & {n: 3}).out @test(err, code=structural_cycle) // SHOULD be an error 25 + fib7: (fib & {n: 7}).out @test(err, code=structural_cycle) // Error 26 + fib12: (fib & {n: 12}).out @test(err, code=structural_cycle) // Error 27 27 28 28 -- out/errors.txt -- 29 29 [incomplete] non-concrete value int in operand to >=: ··· 40 40 fib: non-concrete value int in operand to <: 41 41 ./in.cue:14:5 42 42 ./in.cue:9:5 43 - [structural cycle] structural cycle: 43 + [structural_cycle] structural cycle: 44 44 ./in.cue:12:9 45 45 structural cycle: 46 46 ./in.cue:12:38 47 - [structural cycle] structural cycle: 47 + [structural_cycle] structural cycle: 48 48 ./in.cue:12:9 49 49 structural cycle: 50 50 ./in.cue:12:38 51 - [structural cycle] structural cycle: 51 + [structural_cycle] structural cycle: 52 52 ./in.cue:12:9 53 53 structural cycle: 54 54 ./in.cue:12:38
+76 -53
cue/testdata/cycle/builtins.txtar
··· 581 581 #D: (#struct){ 582 582 b?: (int){ int } 583 583 a?: (_|_){ 584 - // [structural cycle] issue3634.reduced.#D.a: structural cycle 584 + // [structural_cycle] issue3634.reduced.#D.a: structural cycle 585 585 } 586 586 } 587 587 out: (int){ 1 } ··· 602 602 out: (string){ "- x\n" } 603 603 } 604 604 jsonCycle: (_|_){ 605 - // [structural cycle] 605 + // [structural_cycle] 606 606 t1: (_|_){ 607 - // [structural cycle] 607 + // [structural_cycle] 608 608 x: (_|_){ 609 - // [structural cycle] 609 + // [structural_cycle] 610 610 y: (_|_){ 611 - // [structural cycle] jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 611 + // [structural_cycle] jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 612 612 // ./jsoncycle.cue:4:8 613 613 // ./jsoncycle.cue:5:8 614 614 } ··· 846 846 } 847 847 } 848 848 yamlVal: (_|_){ 849 - // [structural cycle] 849 + // [structural_cycle] 850 850 t1: (_|_){ 851 - // [structural cycle] 851 + // [structural_cycle] 852 852 x: (_|_){ 853 - // [structural cycle] 853 + // [structural_cycle] 854 854 y: (_|_){ 855 - // [structural cycle] selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 855 + // [structural_cycle] selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 856 856 // ./yamlcycle.cue:24:8 857 857 // ./yamlcycle.cue:25:8 858 858 } 859 859 } 860 860 } 861 861 t2: (_|_){ 862 - // [structural cycle] 862 + // [structural_cycle] 863 863 x: (_|_){ 864 - // [structural cycle] 864 + // [structural_cycle] 865 865 y: (_|_){ 866 - // [structural cycle] selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 866 + // [structural_cycle] selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 867 867 // ./yamlcycle.cue:30:8 868 868 // ./yamlcycle.cue:31:8 869 869 // ./yamlcycle.cue:32:8 ··· 873 873 } 874 874 } 875 875 yamlFun: (_|_){ 876 - // [structural cycle] 876 + // [structural_cycle] 877 877 t1: (struct){ 878 878 x: (struct){ 879 879 y?: (bool){ true } 880 880 } 881 881 } 882 882 t2: (_|_){ 883 - // [structural cycle] 883 + // [structural_cycle] 884 884 z: (_|_){ 885 - // [structural cycle] 885 + // [structural_cycle] 886 886 y: (_|_){ 887 - // [structural cycle] selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 887 + // [structural_cycle] selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 888 888 // ./yamlcycle.cue:41:8 889 889 } 890 890 } 891 891 x: (_|_){ 892 - // [structural cycle] 892 + // [structural_cycle] 893 893 y: (_|_){ 894 - // [structural cycle] selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 894 + // [structural_cycle] selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 895 895 // ./yamlcycle.cue:41:8 896 896 } 897 897 } 898 898 } 899 899 } 900 900 yamlValidatePartial: (_|_){ 901 - // [structural cycle] 901 + // [structural_cycle] 902 902 x: (_|_){ 903 - // [structural cycle] 903 + // [structural_cycle] 904 904 y: (_|_){ 905 - // [structural cycle] selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 905 + // [structural_cycle] selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 906 906 // ./yamlcycle.cue:44:8 907 907 // ./yamlcycle.cue:45:8 908 908 } ··· 1151 1151 builtinCyclePerm0: (struct){ 1152 1152 X: (string){ "mod.test" } 1153 1153 Y: (struct){ 1154 - @@ -239,13 +279,31 @@ 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 + } 1155 1162 out: (int){ 1 } 1156 1163 } 1157 1164 } ··· 1170 1177 + out: (string){ "- x\n" } 1171 1178 + } 1172 1179 jsonCycle: (_|_){ 1173 - // [structural cycle] 1174 - t1: (_|_){ 1175 - // [structural cycle] 1176 - x: (_|_){ 1180 + - // [structural cycle] 1181 + - t1: (_|_){ 1182 + - // [structural cycle] 1183 + - x: (_|_){ 1177 1184 - // [structural cycle] jsonCycle.t1.x.y.y: structural cycle: 1178 1185 - // ./jsoncycle.cue:4:22 1179 - + // [structural cycle] 1186 + + // [structural_cycle] 1187 + + t1: (_|_){ 1188 + + // [structural_cycle] 1189 + + x: (_|_){ 1190 + + // [structural_cycle] 1180 1191 + y: (_|_){ 1181 - + // [structural cycle] jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 1192 + + // [structural_cycle] jsonCycle.t1.x.y: invalid value "{}" (does not satisfy encoding/json.Validate): structural cycle: 1182 1193 + // ./jsoncycle.cue:4:8 1183 1194 + // ./jsoncycle.cue:5:8 1184 1195 + } ··· 1288 1299 } 1289 1300 } 1290 1301 selfCycle: (_|_){ 1291 - @@ -446,19 +533,8 @@ 1302 + @@ -446,67 +533,71 @@ 1292 1303 } 1293 1304 } 1294 1305 } ··· 1310 1321 } 1311 1322 } 1312 1323 yamlVal: (_|_){ 1313 - @@ -466,25 +542,33 @@ 1314 - t1: (_|_){ 1315 - // [structural cycle] 1316 - x: (_|_){ 1324 + - // [structural cycle] 1325 + - t1: (_|_){ 1326 + - // [structural cycle] 1327 + - x: (_|_){ 1317 1328 - // [structural cycle] selfCycle.yamlVal.t1.x.y.y: structural cycle: 1318 1329 - // ./yamlcycle.cue:24:22 1319 1330 - } ··· 1323 1334 - x: (_|_){ 1324 1335 - // [structural cycle] selfCycle.yamlVal.t2.x.y.y: structural cycle: 1325 1336 - // ./yamlcycle.cue:32:22 1326 - + // [structural cycle] 1337 + + // [structural_cycle] 1338 + + t1: (_|_){ 1339 + + // [structural_cycle] 1340 + + x: (_|_){ 1341 + + // [structural_cycle] 1327 1342 + y: (_|_){ 1328 - + // [structural cycle] selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 1343 + + // [structural_cycle] selfCycle.yamlVal.t1.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 1329 1344 + // ./yamlcycle.cue:24:8 1330 1345 + // ./yamlcycle.cue:25:8 1331 1346 + } 1332 1347 + } 1333 1348 + } 1334 1349 + t2: (_|_){ 1335 - + // [structural cycle] 1350 + + // [structural_cycle] 1336 1351 + x: (_|_){ 1337 - + // [structural cycle] 1352 + + // [structural_cycle] 1338 1353 + y: (_|_){ 1339 - + // [structural cycle] selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 1354 + + // [structural_cycle] selfCycle.yamlVal.t2.x.y: invalid value "{}" (does not satisfy encoding/yaml.Validate): structural cycle: 1340 1355 + // ./yamlcycle.cue:30:8 1341 1356 + // ./yamlcycle.cue:31:8 1342 1357 + // ./yamlcycle.cue:32:8 ··· 1346 1361 } 1347 1362 } 1348 1363 yamlFun: (_|_){ 1349 - // [structural cycle] 1364 + - // [structural cycle] 1350 1365 - t1: (_|_){ 1351 1366 - // [structural cycle] 1352 1367 - x: (_|_){ 1353 1368 - // [structural cycle] selfCycle.yamlFun.t1.x.y.y: structural cycle: 1354 1369 - // ./yamlcycle.cue:36:29 1370 + - } 1371 + - } 1372 + - t2: (_|_){ 1373 + - // [structural cycle] 1374 + + // [structural_cycle] 1355 1375 + t1: (struct){ 1356 1376 + x: (struct){ 1357 1377 + y?: (bool){ true } 1358 - } 1359 - } 1360 - t2: (_|_){ 1361 - @@ -492,13 +576,16 @@ 1378 + + } 1379 + + } 1380 + + t2: (_|_){ 1381 + + // [structural_cycle] 1362 1382 z: (_|_){ 1363 - // [structural cycle] 1364 - y: (_|_){ 1383 + - // [structural cycle] 1384 + - y: (_|_){ 1365 1385 - // [structural cycle] selfCycle.yamlFun.t2.x.y.y: structural cycle: 1366 1386 - // ./yamlcycle.cue:41:28 1367 1387 - } ··· 1369 1389 - x: (_|_){ 1370 1390 - // [structural cycle] selfCycle.yamlFun.t2.x.y.y: structural cycle: 1371 1391 - // ./yamlcycle.cue:41:28 1372 - + // [structural cycle] selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 1392 + + // [structural_cycle] 1393 + + y: (_|_){ 1394 + + // [structural_cycle] selfCycle.yamlFun.t2.z.y: error in call to encoding/yaml.Validate: structural cycle: 1373 1395 + // ./yamlcycle.cue:41:8 1374 1396 + } 1375 1397 + } 1376 1398 + x: (_|_){ 1377 - + // [structural cycle] 1399 + + // [structural_cycle] 1378 1400 + y: (_|_){ 1379 - + // [structural cycle] selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 1401 + + // [structural_cycle] selfCycle.yamlFun.t2.x.y: error in call to encoding/yaml.Validate: structural cycle: 1380 1402 + // ./yamlcycle.cue:41:8 1381 1403 + } 1382 1404 } 1383 1405 } 1384 1406 } 1385 - @@ -505,8 +592,12 @@ 1386 1407 yamlValidatePartial: (_|_){ 1387 - // [structural cycle] 1388 - x: (_|_){ 1408 + - // [structural cycle] 1409 + - x: (_|_){ 1389 1410 - // [structural cycle] selfCycle.yamlValidatePartial.x.y.y: structural cycle: 1390 1411 - // ./yamlcycle.cue:44:29 1391 - + // [structural cycle] 1412 + + // [structural_cycle] 1413 + + x: (_|_){ 1414 + + // [structural_cycle] 1392 1415 + y: (_|_){ 1393 - + // [structural cycle] selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 1416 + + // [structural_cycle] selfCycle.yamlValidatePartial.x.y: invalid value "{}" (does not satisfy encoding/yaml.ValidatePartial): structural cycle: 1394 1417 + // ./yamlcycle.cue:44:8 1395 1418 + // ./yamlcycle.cue:45:8 1396 1419 + }
+25 -25
cue/testdata/cycle/constraints.txtar
··· 134 134 noCancelSelfInvoke: t1: { 135 135 y: [string]: b: y 136 136 x: y 137 - x: c: x @test(err, at=b.b, code=structural cycle) @test(err, at=c, code=structural cycle) 138 - @test(err, code=structural cycle) 137 + x: c: x @test(err, at=b.b, code=structural_cycle) @test(err, at=c, code=structural_cycle) 138 + @test(err, code=structural_cycle) 139 139 } 140 140 141 141 ··· 150 150 a: #T @test(shareID=T) 151 151 #T: { 152 152 [string]: #T 153 - b: {} @test(err, at=b, code=structural cycle) 153 + b: {} @test(err, at=b, code=structural_cycle) 154 154 } @test(shareID=T) 155 155 } 156 156 ··· 159 159 a: X 160 160 } 161 161 b: #T 162 - b: c: {} @test(err, at=a, code=structural cycle) 162 + b: c: {} @test(err, at=a, code=structural_cycle) 163 163 } 164 164 165 165 selfTriggerCycle: long1: { ··· 168 168 // triggered. 169 169 a: [string]: b: a // -> record conjunct from pattern per field. 170 170 a: c: b: c: b: c: {} // -> track if any of the fields is not a cycle. 171 - @test(err, at=a.c.b.c.b.c.b, code=structural cycle) 171 + @test(err, at=a.c.b.c.b.c.b, code=structural_cycle) 172 172 } 173 173 174 174 // TODO: see comment at selfTriggerCycle.t1 ··· 180 180 a: [string]: link: #T 181 181 a: b: {} 182 182 } 183 - @test(err, at=#T.a.b.link, code=structural cycle) 184 - @test(err, at=a.a.b.link, code=structural cycle) 185 - @test(err, at=a.a.one.link.a.b.link, code=structural cycle) 186 - @test(err, at=a.a.one.link.a.two.link, code=structural cycle) 183 + @test(err, at=#T.a.b.link, code=structural_cycle) 184 + @test(err, at=a.a.b.link, code=structural_cycle) 185 + @test(err, at=a.a.one.link.a.b.link, code=structural_cycle) 186 + @test(err, at=a.a.one.link.a.two.link, code=structural_cycle) 187 187 } 188 188 189 189 mutuallyTriggeringCycle: t1: { ··· 193 193 y: [string]: b: y 194 194 x: y 195 195 x: c: y 196 - @test(err, at=x.c.b.b.b.b.b, code=structural cycle) 196 + @test(err, at=x.c.b.b.b.b.b, code=structural_cycle) 197 197 } 198 198 -- ring.cue -- 199 199 brokenRing: t1: { ··· 204 204 p1: { 205 205 D: a?: T 206 206 T: b: D 207 - @test(err, code=structural cycle) 207 + @test(err, code=structural_cycle) 208 208 // @test(debug) 209 209 } 210 210 p2: { ··· 215 215 @test(eq, { 216 216 T: { 217 217 b: { 218 - a?: _|_ @test(err, code=structural cycle, contains="structural cycle", pos=[]) 218 + a?: _|_ @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 219 219 } 220 220 } 221 221 D: { 222 - a?: _|_ @test(err, code=structural cycle, contains="structural cycle", pos=[]) 222 + a?: _|_ @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 223 223 } 224 224 }) 225 225 } ··· 240 240 cyclicRing: t1: { 241 241 D: a: T 242 242 T: b: D 243 - @test(err, at=T.b, code=structural cycle) 244 - @test(err, at=D.a.b, code=structural cycle) 243 + @test(err, at=T.b, code=structural_cycle) 244 + @test(err, at=D.a.b, code=structural_cycle) 245 245 // TODO(inline): fix shareID here. 246 246 // @test(shareID=T, at=D.a) 247 247 // @test(shareID=T, at=T) ··· 289 289 }) 290 290 } 291 291 -- out/errors.txt -- 292 - [structural cycle] noCancelSelfInvoke.t1.x.c.b.b: structural cycle 293 - [structural cycle] noCancelSelfInvoke.t1.x.c.c: structural cycle 294 - [structural cycle] selfTriggerCycle.t1.#T.b.b: structural cycle 295 - [structural cycle] selfTriggerCycle.t2.b.c.a: structural cycle 296 - [structural cycle] selfTriggerCycle.long1.a.c.b.c.b.c.b: structural cycle 297 - [structural cycle] selfTriggerCycle.issue1503.#T.a.b.link: structural cycle 298 - [structural cycle] mutuallyTriggeringCycle.t1.x.c.b.b.b.b.b: structural cycle 299 - [structural cycle] brokenRing.t1.p1.T.b: structural cycle 300 - [structural cycle] brokenRing.t1.p2.D.a: structural cycle 301 - [structural cycle] cyclicRing.t1.T.b: structural cycle 292 + [structural_cycle] noCancelSelfInvoke.t1.x.c.b.b: structural cycle 293 + [structural_cycle] noCancelSelfInvoke.t1.x.c.c: structural cycle 294 + [structural_cycle] selfTriggerCycle.t1.#T.b.b: structural cycle 295 + [structural_cycle] selfTriggerCycle.t2.b.c.a: structural cycle 296 + [structural_cycle] selfTriggerCycle.long1.a.c.b.c.b.c.b: structural cycle 297 + [structural_cycle] selfTriggerCycle.issue1503.#T.a.b.link: structural cycle 298 + [structural_cycle] mutuallyTriggeringCycle.t1.x.c.b.b.b.b.b: structural cycle 299 + [structural_cycle] brokenRing.t1.p1.T.b: structural cycle 300 + [structural_cycle] brokenRing.t1.p2.D.a: structural cycle 301 + [structural_cycle] cyclicRing.t1.T.b: structural cycle 302 302 -- out/todo.txt -- 303 303 v2/v3 differences: structural cycle detection depth differs slightly, resulting in 304 304 different error path locations (e.g. noCancelSelfInvoke.t1.x.c.b.b in v3 vs
+13 -3
cue/testdata/cycle/disjunction.txtar
··· 82 82 (_|_){ 83 83 // [eval] 84 84 cycle: (_|_){ 85 - // [structural cycle] 85 + // [structural_cycle] 86 86 a: (_|_){ 87 - // [structural cycle] cycle.a: structural cycle 87 + // [structural_cycle] cycle.a: structural cycle 88 88 } 89 89 } 90 90 r1a: (int){ int } ··· 162 162 diff old new 163 163 --- old 164 164 +++ new 165 - @@ -1,14 +1,14 @@ 165 + @@ -1,22 +1,22 @@ 166 166 Errors: 167 167 cycle.a: structural cycle 168 168 issue3042.data: 2 errors in empty disjunction: ··· 185 185 186 186 Result: 187 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 } 188 198 @@ -76,14 +76,14 @@ 189 199 }) } 190 200 data: (_|_){
+21 -21
cue/testdata/cycle/evaluate.txtar
··· 36 36 let X = a 37 37 c: X 38 38 } 39 - @test(err, code=structural cycle, path=a.c, contains="structural cycle", pos=[]) 39 + @test(err, code=structural_cycle, path=a.c, contains="structural cycle", pos=[]) 40 40 } 41 41 42 42 // Cycles should also be detected in evaluation paths that descend into ··· 53 53 (struct){ 54 54 a: (struct){ 55 55 let X#4 = (_|_){ 56 - // [structural cycle] letCycleFail.t2.a.X: structural cycle 56 + // [structural_cycle] letCycleFail.t2.a.X: structural cycle 57 57 } 58 58 x: (struct){ 59 59 y: (string){ "" } ··· 83 83 forCycle: { 84 84 #A: a: #B // TODO(errors): Correct error position, or at all. 85 85 #B: or([for x in #A { b: x }]) 86 - @test(err, code=structural cycle, path=#B.b, contains="structural cycle", pos=[]) 86 + @test(err, code=structural_cycle, path=#B.b, contains="structural cycle", pos=[]) 87 87 } 88 88 89 89 letCycleWithAnd: { ··· 97 97 a: b 98 98 b: close({d: c}) 99 99 c: a 100 - @test(err, code=structural cycle, path=c, contains="structural cycle", pos=[]) 100 + @test(err, code=structural_cycle, path=c, contains="structural cycle", pos=[]) 101 101 } 102 102 103 103 structCycle: { 104 104 a: b 105 105 b: and([{d: c}]) 106 106 c: a 107 - @test(err, code=structural cycle, path=c, contains="structural cycle", pos=[]) 107 + @test(err, code=structural_cycle, path=c, contains="structural cycle", pos=[]) 108 108 } 109 109 110 110 embedCycle: { ··· 118 118 a: b 119 119 b: list.Concat([[c], [c]]) 120 120 c: a 121 - @test(err, code=structural cycle, path=b, contains="error in call to %s", args=[list.Concat], pos=[2:5]) 121 + @test(err, code=structural_cycle, path=b, contains="error in call to %s", args=[list.Concat], pos=[2:5]) 122 122 } 123 123 124 124 listMulCycle: { 125 125 a: b 126 126 b: list.Repeat([{a: b: c}], 3) 127 127 c: a 128 - @test(err, code=structural cycle, path=b, contains="error in call to %s", args=[list.Repeat], pos=[2:5]) 128 + @test(err, code=structural_cycle, path=b, contains="error in call to %s", args=[list.Repeat], pos=[2:5]) 129 129 } 130 130 131 131 // consult the correct closeness info in the face of it being passed down ··· 144 144 if X { 145 145 } 146 146 } 147 - @test(err, code=structural cycle, path=a.X, contains="structural cycle", pos=[]) 147 + @test(err, code=structural_cycle, path=a.X, contains="structural cycle", pos=[]) 148 148 } 149 149 -- self.cue -- 150 150 issue3978: { ··· 155 155 @test(eq, {a: {}}) 156 156 } 157 157 -- out/errors.txt -- 158 - [structural cycle] letCycleFail.t1.a.c: structural cycle 158 + [structural_cycle] letCycleFail.t1.a.c: structural cycle 159 159 [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 160 160 ./in.cue:74:9 161 161 [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 162 162 ./in.cue:74:9 163 163 [eval] disjunctionCycle.b: cannot use 1 (type int) as list in argument 1 to and: 164 164 ./in.cue:74:9 165 - [structural cycle] forCycle.#B.b: structural cycle 166 - [structural cycle] closeCycle.c: structural cycle 167 - [structural cycle] closeCycle.c: structural cycle 168 - [structural cycle] structCycle.c: structural cycle 169 - [structural cycle] structCycle.c: structural cycle 170 - [structural cycle] listAddCycle.b: error in call to list.Concat: structural cycle: 165 + [structural_cycle] forCycle.#B.b: structural cycle 166 + [structural_cycle] closeCycle.c: structural cycle 167 + [structural_cycle] closeCycle.c: structural cycle 168 + [structural_cycle] structCycle.c: structural cycle 169 + [structural_cycle] structCycle.c: structural cycle 170 + [structural_cycle] listAddCycle.b: error in call to list.Concat: structural cycle: 171 171 ./in.cue:118:5 172 - [structural cycle] listAddCycle.b: error in call to list.Concat: structural cycle: 172 + [structural_cycle] listAddCycle.b: error in call to list.Concat: structural cycle: 173 173 ./in.cue:118:5 174 - [structural cycle] listAddCycle.c: structural cycle: 174 + [structural_cycle] listAddCycle.c: structural cycle: 175 175 ./in.cue:118:5 176 - [structural cycle] listMulCycle.b: error in call to list.Repeat: structural cycle: 176 + [structural_cycle] listMulCycle.b: error in call to list.Repeat: structural cycle: 177 177 ./in.cue:125:5 178 - [structural cycle] listMulCycle.b: error in call to list.Repeat: structural cycle: 178 + [structural_cycle] listMulCycle.b: error in call to list.Repeat: structural cycle: 179 179 ./in.cue:125:5 180 - [structural cycle] listMulCycle.c: structural cycle: 180 + [structural_cycle] listMulCycle.c: structural cycle: 181 181 ./in.cue:125:5 182 182 [eval] closeFail.x.b: field not allowed: 183 183 ./in.cue:133:6 184 184 ./in.cue:136:5 185 - [structural cycle] printCycle.a.X: structural cycle 185 + [structural_cycle] printCycle.a.X: structural cycle 186 186 -- out/todo.txt -- 187 187 embedCycle: error in v2 (structural cycle) but success in v3 (close({c}) not truly structural cycle). 188 188 closeCycle/structCycle: different error paths reported in v2 vs v3.
+14 -14
cue/testdata/cycle/inline.txtar
··· 4 4 inline: small: { 5 5 f: { 6 6 n: int 7 - out: (f & {"n": n - 1}).out @test(err, code=structural cycle, contains="structural cycle", pos=[0:9]) 7 + out: (f & {"n": n - 1}).out @test(err, code=structural_cycle, contains="structural cycle", pos=[0:9]) 8 8 } 9 9 } 10 10 11 11 inline: medium: { 12 - f2: (f & {n: 2}).out @test(err, code=structural cycle, contains="structural cycle", pos=[1:24]) 12 + f2: (f & {n: 2}).out @test(err, code=structural_cycle, contains="structural cycle", pos=[1:24]) 13 13 fRec: {nn: int, out: (f & {n: nn}).out} 14 - @test(err, at=fRec.out, code=structural cycle, contains="structural cycle", pos=[6:9]) 14 + @test(err, at=fRec.out, code=structural_cycle, contains="structural cycle", pos=[6:9]) 15 15 f: { 16 16 n: int 17 - out: (fRec & {nn: n - 1}).out @test(err, code=structural cycle, contains="structural cycle", pos=[0:9]) 17 + out: (fRec & {nn: n - 1}).out @test(err, code=structural_cycle, contains="structural cycle", pos=[0:9]) 18 18 } 19 19 } 20 20 21 21 inline: patterns: { 22 22 f: n: (f & {n: {}}).n 23 - f: n: {} @test(err, code=structural cycle, contains="structural cycle", pos=[-1:9]) 23 + f: n: {} @test(err, code=structural_cycle, contains="structural cycle", pos=[-1:9]) 24 24 [string]: {n: {}} 25 25 f: [string]: {} 26 26 f: {} ··· 93 93 a: _a.output 94 94 _a: X & {input: root} 95 95 } 96 - @test(err, code=structural cycle, at=root._a.input._a.input, contains="structural cycle", pos=[]) 96 + @test(err, code=structural_cycle, at=root._a.input._a.input, contains="structural cycle", pos=[]) 97 97 } 98 98 expanded2: noCycle: { 99 99 X: { ··· 141 141 others: _others.output 142 142 _others: #lookup & {input: root} 143 143 } 144 - @test(err, code=structural cycle, at=root._others.input._others.input, contains="structural cycle", pos=[]) 144 + @test(err, code=structural_cycle, at=root._others.input._others.input, contains="structural cycle", pos=[]) 145 145 } 146 146 issue3731: full: { 147 147 #Workspace: { ··· 215 215 }) 216 216 } 217 217 -- out/errors.txt -- 218 - [structural cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle 219 - [structural cycle] issue3731.expanded.root._others.input._others.input: structural cycle 220 - [structural cycle] structural cycle: 218 + [structural_cycle] expanded1.hasCycle.root._a.input._a.input: structural cycle 219 + [structural_cycle] issue3731.expanded.root._others.input._others.input: structural cycle 220 + [structural_cycle] structural cycle: 221 221 ./x.cue:6:9 222 - [structural cycle] structural cycle: 222 + [structural_cycle] structural cycle: 223 223 ./x.cue:12:24 224 - [structural cycle] structural cycle: 224 + [structural_cycle] structural cycle: 225 225 ./x.cue:16:9 226 - [structural cycle] structural cycle: 226 + [structural_cycle] structural cycle: 227 227 ./x.cue:16:9 228 - [structural cycle] structural cycle: 228 + [structural_cycle] structural cycle: 229 229 ./x.cue:21:9 230 230 [incomplete] inline.acrossFields.fail1.f.out: non-concrete value number in operand to +: 231 231 ./x.cue:31:8
+2 -2
cue/testdata/cycle/inline_non_recursive.txtar
··· 118 118 } 119 119 first: t2: { 120 120 x: { a: b: x }.a 121 - @test(err, code=structural cycle) 121 + @test(err, code=structural_cycle) 122 122 } 123 123 second: { 124 124 { t: x }.t.y ··· 164 164 ./in.cue:83:7 165 165 [incomplete] a10.i: undefined field: out: 166 166 ./in.cue:88:28 167 - [structural cycle] issue3182.first.t2.x.b: structural cycle 167 + [structural_cycle] issue3182.first.t2.x.b: structural cycle 168 168 [incomplete] select.indirect.#Job: invalid value {opt:_} (does not satisfy matchN): 0 matched, expected 1: 169 169 ./select.cue:13:8 170 170 ./select.cue:13:15
+4 -4
cue/testdata/cycle/issue2526.txtar
··· 23 23 24 24 Result: 25 25 (_|_){ 26 - // [structural cycle] 26 + // [structural_cycle] 27 27 x: (_|_){ 28 - // [structural cycle] 28 + // [structural_cycle] 29 29 y: (_|_){ 30 - // [structural cycle] x.y: structural cycle 30 + // [structural_cycle] x.y: structural cycle 31 31 } 32 32 } 33 33 y: (_|_){ 34 - // [structural cycle] x.y: structural cycle 34 + // [structural_cycle] x.y: structural cycle 35 35 } 36 36 }
+4 -4
cue/testdata/cycle/issue306.txtar
··· 23 23 24 24 Result: 25 25 (_|_){ 26 - // [structural cycle] 26 + // [structural_cycle] 27 27 a: (int){ 12 } 28 28 #Controller: (_|_){ 29 - // [structural cycle] 29 + // [structural_cycle] 30 30 settings: (_|_){ 31 - // [structural cycle] 31 + // [structural_cycle] 32 32 controller: (_|_){ 33 - // [structural cycle] #Controller.settings.controller: structural cycle 33 + // [structural_cycle] #Controller.settings.controller: structural cycle 34 34 } 35 35 } 36 36 }
+23 -23
cue/testdata/cycle/issue4210.txtar
··· 28 28 29 29 Result: 30 30 (_|_){ 31 - // [structural cycle] 31 + // [structural_cycle] 32 32 t1: (_|_){ 33 - // [structural cycle] 33 + // [structural_cycle] 34 34 a: (_|_){ 35 - // [structural cycle] 35 + // [structural_cycle] 36 36 b: (_|_){ 37 - // [structural cycle] 37 + // [structural_cycle] 38 38 c: (_|_){ 39 - // [structural cycle] 39 + // [structural_cycle] 40 40 c: (_|_){ 41 - // [structural cycle] t1.a.b.c.c: structural cycle 41 + // [structural_cycle] t1.a.b.c.c: structural cycle 42 42 } 43 43 } 44 44 } 45 45 } 46 46 } 47 47 t2: (_|_){ 48 - // [structural cycle] 48 + // [structural_cycle] 49 49 a: (_|_){ 50 - // [structural cycle] 50 + // [structural_cycle] 51 51 b: (_|_){ 52 - // [structural cycle] 52 + // [structural_cycle] 53 53 c: (_|_){ 54 - // [structural cycle] 54 + // [structural_cycle] 55 55 c: (_|_){ 56 - // [structural cycle] t2.a.b.c.c: structural cycle 56 + // [structural_cycle] t2.a.b.c.c: structural cycle 57 57 } 58 58 } 59 59 } 60 60 } 61 61 } 62 62 t3: (_|_){ 63 - // [structural cycle] 63 + // [structural_cycle] 64 64 a: (_|_){ 65 - // [structural cycle] 65 + // [structural_cycle] 66 66 b: (_|_){ 67 - // [structural cycle] 67 + // [structural_cycle] 68 68 c: (_|_){ 69 - // [structural cycle] 69 + // [structural_cycle] 70 70 d: (_|_){ 71 - // [structural cycle] 71 + // [structural_cycle] 72 72 d: (_|_){ 73 - // [structural cycle] t3.a.b.c.d.d: structural cycle 73 + // [structural_cycle] t3.a.b.c.d.d: structural cycle 74 74 } 75 75 } 76 76 } ··· 78 78 } 79 79 } 80 80 t4: (_|_){ 81 - // [structural cycle] 81 + // [structural_cycle] 82 82 x: (_|_){ 83 - // [structural cycle] 83 + // [structural_cycle] 84 84 y: (_|_){ 85 - // [structural cycle] 85 + // [structural_cycle] 86 86 z: (_|_){ 87 - // [structural cycle] 87 + // [structural_cycle] 88 88 z: (_|_){ 89 - // [structural cycle] t4.x.y.z.z: structural cycle 89 + // [structural_cycle] t4.x.y.z.z: structural cycle 90 90 } 91 91 } 92 92 } 93 93 } 94 94 a: (_|_){ 95 - // [structural cycle] t4.x.y.z.z: structural cycle 95 + // [structural_cycle] t4.x.y.z.z: structural cycle 96 96 } 97 97 } 98 98 }
+1 -1
cue/testdata/cycle/issue4228.txtar
··· 152 152 (_|_){ 153 153 // [eval] 154 154 let _globalScope#1 = (_|_){ 155 - // [structural cycle] _globalScope: structural cycle 155 + // [structural_cycle] _globalScope: structural cycle 156 156 } 157 157 #export: (#struct){ 158 158 #entries: (list){
+30 -4
cue/testdata/cycle/issue502.txtar
··· 216 216 z: (#struct){ 217 217 x: (#struct){ 218 218 y?: (_|_){ 219 - // [structural cycle] 219 + // [structural_cycle] 220 220 V: (_){ _ } 221 221 z: (_|_){ 222 - // [structural cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle 222 + // [structural_cycle] reduced.t1.#T.x.y.z.x.y.z: structural cycle 223 223 } 224 224 } 225 225 } ··· 246 246 z: (#struct){ 247 247 x: (#struct){ 248 248 y?: (_|_){ 249 - // [structural cycle] 249 + // [structural_cycle] 250 250 V: (_){ _ } 251 251 z: (_|_){ 252 - // [structural cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle 252 + // [structural_cycle] reduced.t1.a.x.y.z.x.y.z.x.y.z: structural cycle 253 253 } 254 254 } 255 255 } ··· 267 267 diff old new 268 268 --- old 269 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 + } 270 283 @@ -170,7 +170,7 @@ 271 284 a: (#struct){ 272 285 x: (#struct){ ··· 276 289 x: (struct){ 277 290 y: (struct){ 278 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 + } 279 305 -- out/eval -- 280 306 (struct){ 281 307 #T: (#struct){
+4 -4
cue/testdata/cycle/self.txtar
··· 16 16 listConcat: error1: { 17 17 a: ["1", "2"] 18 18 a: list.Concat([a, ["3"]]) 19 - @test(err, code=structural cycle, path=a, contains="error in call to %s", args=[list.Concat], pos=[2:5]) 19 + @test(err, code=structural_cycle, path=a, contains="error in call to %s", args=[list.Concat], pos=[2:5]) 20 20 } 21 21 22 22 listConcat: error2: { 23 23 a: list.Concat([["3"], a]) 24 24 a: ["1", "2"] 25 - @test(err, code=structural cycle, path=a, contains="error in call to %s", args=[list.Concat], pos=[1:5]) 25 + @test(err, code=structural_cycle, path=a, contains="error in call to %s", args=[list.Concat], pos=[1:5]) 26 26 } 27 27 28 28 selfEmbed: ok1: { ··· 363 363 [eval] expr.error2.a: conflicting values 4 and 3: 364 364 ./in.cue:11:5 365 365 ./in.cue:12:5 366 - [structural cycle] listConcat.error1.a: error in call to list.Concat: structural cycle: 366 + [structural_cycle] listConcat.error1.a: error in call to list.Concat: structural cycle: 367 367 ./in.cue:17:5 368 - [structural cycle] listConcat.error2.a: error in call to list.Concat: structural cycle: 368 + [structural_cycle] listConcat.error2.a: error in call to list.Concat: structural cycle: 369 369 ./in.cue:22:5 370 370 -- out/todo.txt -- 371 371 listConcat.error1/error2.a: v2 shows list elements inside structural cycle error, v3 shows proper error message.
+76 -76
cue/testdata/cycle/structural.txtar
··· 3 3 4 4 a1: { 5 5 f: [f] 6 - @test(err, code=structural cycle, path=f.0, contains="structural cycle", pos=[]) 6 + @test(err, code=structural_cycle, path=f.0, contains="structural cycle", pos=[]) 7 7 } 8 8 9 9 a2: { ··· 13 13 14 14 a3: { 15 15 f: {g: f} 16 - @test(err, code=structural cycle, path=f.g, contains="structural cycle", pos=[]) 16 + @test(err, code=structural_cycle, path=f.g, contains="structural cycle", pos=[]) 17 17 } 18 18 19 19 a4: { ··· 82 82 [y] 83 83 } 84 84 } 85 - @test(err, code=structural cycle, path=x.y.0, contains="structural cycle", pos=[]) 85 + @test(err, code=structural_cycle, path=x.y.0, contains="structural cycle", pos=[]) 86 86 } 87 87 88 88 // This reports a structural cycle at b4.cond2.b, because the value it refers ··· 100 100 } 101 101 } 102 102 b: x.y & { _z: false, [1] } 103 - @test(err, code=structural cycle, path=x.y.0, contains="structural cycle", pos=[]) 103 + @test(err, code=structural_cycle, path=x.y.0, contains="structural cycle", pos=[]) 104 104 } 105 105 106 106 b5: { ··· 246 246 if tail != null { 247 247 sum: tail.sum 248 248 } 249 - } @test(err, code=structural cycle, path=tail, contains="structural cycle", pos=[]) 249 + } @test(err, code=structural_cycle, path=tail, contains="structural cycle", pos=[]) 250 250 251 - list1: #list @test(err, code=structural cycle, path=b12b.#list.tail, contains="structural cycle", pos=[]) 251 + list1: #list @test(err, code=structural_cycle, path=b12b.#list.tail, contains="structural cycle", pos=[]) 252 252 list1: { 253 253 tail: { 254 254 tail: { ··· 260 260 // Issue #587 261 261 b13: { 262 262 root: a: [for x in root {x}] 263 - @test(err, code=structural cycle, path=root.a.0.0, contains="structural cycle", pos=[]) 263 + @test(err, code=structural_cycle, path=root.a.0.0, contains="structural cycle", pos=[]) 264 264 } 265 265 266 266 // Issue #587 ··· 276 276 277 277 b: [for x in root {x}] 278 278 } 279 - @test(err, code=structural cycle, path=root.b.1.1, contains="structural cycle", pos=[]) 279 + @test(err, code=structural_cycle, path=root.b.1.1, contains="structural cycle", pos=[]) 280 280 } 281 281 282 282 // This is okay ··· 316 316 a: one: link: a: two: {} 317 317 } 318 318 @test(eq, {one: {link: {a: {two: {}}}}}, at=a.a) 319 - @test(err, code=structural cycle, path=#T.a.b.link, contains="structural cycle", pos=[]) 319 + @test(err, code=structural_cycle, path=#T.a.b.link, contains="structural cycle", pos=[]) 320 320 } 321 321 322 322 // Issue #502 -- or added later. ··· 328 328 #U: { 329 329 #S 330 330 #T: a: b: {} 331 - } @test(err, code=structural cycle, path=#T.a.b.link, contains="structural cycle", pos=[]) 331 + } @test(err, code=structural_cycle, path=#T.a.b.link, contains="structural cycle", pos=[]) 332 332 333 333 a: #U.#T & { 334 334 a: one: link: a: two: {} 335 - } @test(err, code=structural cycle, path=p3.#U.#T.a.b.link, contains="structural cycle", pos=[]) 335 + } @test(err, code=structural_cycle, path=p3.#U.#T.a.b.link, contains="structural cycle", pos=[]) 336 336 } 337 337 338 338 // Issue #502 -- unused bulk constraints are not cyclic ··· 360 360 a: #T & { 361 361 a: [{link: a: [{}]}] 362 362 } 363 - @test(err, code=structural cycle, path=#T.a.0.link, contains="structural cycle", pos=[]) 363 + @test(err, code=structural_cycle, path=#T.a.0.link, contains="structural cycle", pos=[]) 364 364 @test(eq, [{link: {a: [{}]}}], at=a.a) 365 365 } 366 366 ··· 373 373 #U: { 374 374 #S 375 375 #T: a: [{}] 376 - } @test(err, code=structural cycle, path=#T.a.0.link, contains="structural cycle", pos=[]) 376 + } @test(err, code=structural_cycle, path=#T.a.0.link, contains="structural cycle", pos=[]) 377 377 378 378 a: #U.#T & { 379 379 a: [{link: a: [{}]}] 380 - } @test(err, code=structural cycle, path=p6.#U.#T.a.0.link, contains="structural cycle", pos=[]) 380 + } @test(err, code=structural_cycle, path=p6.#U.#T.a.0.link, contains="structural cycle", pos=[]) 381 381 } 382 382 383 383 c1: { ··· 385 385 b: {} 386 386 c: a & b 387 387 } 388 - @test(err, code=structural cycle, path=a.c.c, contains="structural cycle", pos=[]) 388 + @test(err, code=structural_cycle, path=a.c.c, contains="structural cycle", pos=[]) 389 389 } 390 390 391 391 // indirection 392 392 d1: { 393 393 a: b: c: d: {h: int, t: r} 394 - @test(err, at=a.b.c.d.t, code=structural cycle, path=d1.r, contains="structural cycle", pos=[]) 394 + @test(err, at=a.b.c.d.t, code=structural_cycle, path=d1.r, contains="structural cycle", pos=[]) 395 395 396 - r: a.b @test(err, code=structural cycle, contains="structural cycle", pos=[]) 396 + r: a.b @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 397 397 398 398 x: a.b.c 399 399 ··· 416 416 i: int | *1 417 417 } 418 418 x: config & {i: 0} 419 - @test(err, at=x.indirect, code=structural cycle, contains="structural cycle", pos=[]) 420 - @test(err, at=x.a.b.c, code=structural cycle, contains="structural cycle", pos=[]) 419 + @test(err, at=x.indirect, code=structural_cycle, contains="structural cycle", pos=[]) 420 + @test(err, at=x.a.b.c, code=structural_cycle, contains="structural cycle", pos=[]) 421 421 @test(eq, at=config, { 422 422 a: {b: {c: null}} 423 423 indirect: null ··· 449 449 t2: { 450 450 Foo: ref: Foo 451 451 Foo: {...} 452 - @test(err, code=structural cycle, at=Foo.ref, contains="structural cycle", pos=[]) 452 + @test(err, code=structural_cycle, at=Foo.ref, contains="structural cycle", pos=[]) 453 453 } 454 454 } 455 455 ··· 460 460 patternFail: issue2374: { 461 461 r=[string]: {b: r} 462 462 a: {r: 0} 463 - @test(err, code=structural cycle, at=a.b, contains="structural cycle", pos=[]) 463 + @test(err, code=structural_cycle, at=a.b, contains="structural cycle", pos=[]) 464 464 } 465 465 466 466 shortPathFail: comprehension: { ··· 475 475 withLetFail: { 476 476 schema: next: _schema_1 477 477 let _schema_1 = schema 478 - @test(err, code=structural cycle, at=schema.next, contains="structural cycle", pos=[]) 478 + @test(err, code=structural_cycle, at=schema.next, contains="structural cycle", pos=[]) 479 479 } 480 480 481 481 // Issue #3310: `list.Sum` called with a comprehension iterating over the ··· 489 489 sprite: 1.00 490 490 491 491 total: list.Sum([for _, v in issue3310 {v}]) 492 - @test(err, code=structural cycle, at=total, contains="error in call to %s", args=[list.Sum], pos=[5:9]) 492 + @test(err, code=structural_cycle, at=total, contains="error in call to %s", args=[list.Sum], pos=[5:9]) 493 493 } 494 494 495 495 listOptOK: { ··· 501 501 @test(eq, { 502 502 list: { 503 503 head: int 504 - tail?: _|_ @test(err, code=structural cycle, contains="list.tail: structural cycle", pos=[]) 504 + tail?: _|_ @test(err, code=structural_cycle, contains="list.tail: structural cycle", pos=[]) 505 505 } 506 506 a: { 507 507 head: 3 ··· 509 509 head: 2 510 510 tail?: { 511 511 head: int 512 - tail?: _|_ @test(err, code=structural cycle, contains="list.tail: structural cycle", pos=[]) 512 + tail?: _|_ @test(err, code=structural_cycle, contains="list.tail: structural cycle", pos=[]) 513 513 } 514 514 } 515 515 } ··· 526 526 #B: { 527 527 A: #A 528 528 } 529 - @test(err, code="structural cycle", 529 + @test(err, code=structural_cycle, 530 530 hint="the comment says this should succeed since the optional field breaks the cycle, but it still errors in both v2 and v3") 531 531 @test(eq:todo, { 532 532 #A: {B?: _ @test(ignore)} ··· 541 541 542 542 b: c: b 543 543 b: b 544 - @test(err, code=structural cycle, at=a.c, contains="structural cycle", pos=[]) 545 - @test(err, code=structural cycle, at=b.c, contains="structural cycle", pos=[]) 544 + @test(err, code=structural_cycle, at=a.c, contains="structural cycle", pos=[]) 545 + @test(err, code=structural_cycle, at=b.c, contains="structural cycle", pos=[]) 546 546 } 547 547 548 548 e2: { ··· 551 551 552 552 b: c: b 553 553 b: {b} 554 - @test(err, code=structural cycle, at=a.c, contains="structural cycle", pos=[]) 555 - @test(err, code=structural cycle, at=b.c, contains="structural cycle", pos=[]) 554 + @test(err, code=structural_cycle, at=a.c, contains="structural cycle", pos=[]) 555 + @test(err, code=structural_cycle, at=b.c, contains="structural cycle", pos=[]) 556 556 } 557 557 558 558 e3: { 559 559 a: [a] @test(err, code=eval, contains="conflicting values %s and %s (mismatched types %s and %s)", args=[[a], {c:a}, list, struct], pos=[0:5, 1:5]) 560 - a: c: a @test(err, code=structural cycle, contains="structural cycle", pos=[]) 560 + a: c: a @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 561 561 562 562 b: [b] @test(err, code=eval, contains="conflicting values %s and %s (mismatched types %s and %s)", args=[[b], {c:b}, list, struct], pos=[0:5, 1:5]) 563 563 b: c: b ··· 703 703 g: f 704 704 } 705 705 z: x & y 706 - @test(err, code=structural cycle, path=z.g, contains="structural cycle", pos=[]) 706 + @test(err, code=structural_cycle, path=z.g, contains="structural cycle", pos=[]) 707 707 } 708 708 709 709 // Cross references. Here there is no cycle, but the repeated instantiations ··· 834 834 // TODO(eval): notice the difference, not a huge deal, but still. 835 835 resolveToAncestor: { 836 836 t1: X: { 837 - a: b.a @test(eq, _) @test(err:todo, code=structural cycle) 838 - b: X @test(err, code=structural cycle, contains="structural cycle", pos=[]) 837 + a: b.a @test(eq, _) @test(err:todo, code=structural_cycle) 838 + b: X @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 839 839 } 840 840 t2: X: { 841 - b: X @test(err, code=structural cycle, contains="structural cycle", pos=[]) 842 - a: b.a @test(err, code=structural cycle, path=resolveToAncestor.t2.X.b, contains="structural cycle", pos=[]) 841 + b: X @test(err, code=structural_cycle, contains="structural cycle", pos=[]) 842 + a: b.a @test(err, code=structural_cycle, path=resolveToAncestor.t2.X.b, contains="structural cycle", pos=[]) 843 843 } 844 844 } 845 845 -- out/errors.txt -- 846 - [structural cycle] resolveToAncestor.t1.X.b: structural cycle 847 - [structural cycle] resolveToAncestor.t2.X.b: structural cycle 848 - [structural cycle] resolveToAncestor.t2.X.b: structural cycle 849 - [structural cycle] a1.f.0: structural cycle 850 - [structural cycle] a3.f.g: structural cycle 846 + [structural_cycle] resolveToAncestor.t1.X.b: structural cycle 847 + [structural_cycle] resolveToAncestor.t2.X.b: structural cycle 848 + [structural_cycle] resolveToAncestor.t2.X.b: structural cycle 849 + [structural_cycle] a1.f.0: structural cycle 850 + [structural_cycle] a3.f.g: structural cycle 851 851 [eval] b4.b.0: conflicting values 1 and [y] (mismatched types int and list): 852 852 ./in.cue:69:5 853 853 ./in.cue:69:12 854 854 ./in.cue:70:8 855 855 ./in.cue:70:9 856 - [structural cycle] b4.x.y.0: structural cycle 857 - [structural cycle] b4.cond1.x.y.0: structural cycle 858 - [structural cycle] b4.cond2.x.y.0: structural cycle 859 - [structural cycle] b4.cond2.x.y.0: structural cycle 856 + [structural_cycle] b4.x.y.0: structural cycle 857 + [structural_cycle] b4.cond1.x.y.0: structural cycle 858 + [structural_cycle] b4.cond2.x.y.0: structural cycle 859 + [structural_cycle] b4.cond2.x.y.0: structural cycle 860 860 [eval] b6.b.a.0: conflicting values 1 and [1] (mismatched types int and list): 861 861 ./in.cue:112:5 862 862 ./in.cue:112:13 863 863 ./in.cue:112:14 864 864 ./in.cue:113:9 865 - [structural cycle] b6.x.a.0: structural cycle 865 + [structural_cycle] b6.x.a.0: structural cycle 866 866 [eval] b7.b.0.0: conflicting values 1 and [a] (mismatched types int and list): 867 867 ./in.cue:119:5 868 868 ./in.cue:119:11 869 869 ./in.cue:120:5 870 870 ./in.cue:120:6 871 - [structural cycle] b7.a.0: structural cycle 872 - [structural cycle] b12b.#list.tail: structural cycle 873 - [structural cycle] b12b.#list.tail: structural cycle 874 - [structural cycle] b13.root.a.0.0: structural cycle 875 - [structural cycle] b14.root.b.1.1: structural cycle 876 - [structural cycle] p2.#T.a.b.link: structural cycle 877 - [structural cycle] p3.#U.#T.a.b.link: structural cycle 878 - [structural cycle] p3.#U.#T.a.b.link: structural cycle 879 - [structural cycle] p5.#T.a.0.link: structural cycle 880 - [structural cycle] p6.#U.#T.a.0.link: structural cycle 881 - [structural cycle] p6.#U.#T.a.0.link: structural cycle 882 - [structural cycle] c1.a.c.c: structural cycle 883 - [structural cycle] d1.r: structural cycle 884 - [structural cycle] d1.r: structural cycle 885 - [structural cycle] d1.r: structural cycle 886 - [structural cycle] d2.a.b.c.d.t: structural cycle 887 - [structural cycle] d3.x.indirect: structural cycle 888 - [structural cycle] d3.x.indirect: structural cycle 889 - [structural cycle] shortPathFail.elipsis.t2.Foo.ref: structural cycle 890 - [structural cycle] patternFail.issue2374.a.b: structural cycle 891 - [structural cycle] withLetFail.schema.next: structural cycle 892 - [structural cycle] fieldsSumInfinite.issue3310.total: error in call to list.Sum: error in call to list.Sum: structural cycle: 871 + [structural_cycle] b7.a.0: structural cycle 872 + [structural_cycle] b12b.#list.tail: structural cycle 873 + [structural_cycle] b12b.#list.tail: structural cycle 874 + [structural_cycle] b13.root.a.0.0: structural cycle 875 + [structural_cycle] b14.root.b.1.1: structural cycle 876 + [structural_cycle] p2.#T.a.b.link: structural cycle 877 + [structural_cycle] p3.#U.#T.a.b.link: structural cycle 878 + [structural_cycle] p3.#U.#T.a.b.link: structural cycle 879 + [structural_cycle] p5.#T.a.0.link: structural cycle 880 + [structural_cycle] p6.#U.#T.a.0.link: structural cycle 881 + [structural_cycle] p6.#U.#T.a.0.link: structural cycle 882 + [structural_cycle] c1.a.c.c: structural cycle 883 + [structural_cycle] d1.r: structural cycle 884 + [structural_cycle] d1.r: structural cycle 885 + [structural_cycle] d1.r: structural cycle 886 + [structural_cycle] d2.a.b.c.d.t: structural cycle 887 + [structural_cycle] d3.x.indirect: structural cycle 888 + [structural_cycle] d3.x.indirect: structural cycle 889 + [structural_cycle] shortPathFail.elipsis.t2.Foo.ref: structural cycle 890 + [structural_cycle] patternFail.issue2374.a.b: structural cycle 891 + [structural_cycle] withLetFail.schema.next: structural cycle 892 + [structural_cycle] fieldsSumInfinite.issue3310.total: error in call to list.Sum: error in call to list.Sum: structural cycle: 893 893 ./in.cue:490:9 894 - [structural cycle] listOptOK.list.tail: structural cycle 895 - [structural cycle] issue2545.#B.A: structural cycle 896 - [structural cycle] e1.a.c: structural cycle 897 - [structural cycle] e1.b.c: structural cycle 898 - [structural cycle] e2.a.c: structural cycle 899 - [structural cycle] e2.b.c: structural cycle 894 + [structural_cycle] listOptOK.list.tail: structural cycle 895 + [structural_cycle] issue2545.#B.A: structural cycle 896 + [structural_cycle] e1.a.c: structural cycle 897 + [structural_cycle] e1.b.c: structural cycle 898 + [structural_cycle] e2.a.c: structural cycle 899 + [structural_cycle] e2.b.c: structural cycle 900 900 [eval] e3.a: conflicting values [a] and {c:a} (mismatched types list and struct): 901 901 ./in.cue:558:5 902 902 ./in.cue:559:5 ··· 945 945 ./in.cue:599:11 946 946 nestedList.v2e.y.0.0: incompatible list lengths (1 and 2): 947 947 ./in.cue:599:6 948 - [structural cycle] z1.z.g: structural cycle 949 - [structural cycle] z1.z.g: structural cycle 948 + [structural_cycle] z1.z.g: structural cycle 949 + [structural_cycle] z1.z.g: structural cycle 950 950 [incomplete] crossRefNoCycle.t5.T.y: undefined field: x: 951 951 ./in.cue:785:8 952 952 -- out/todo.txt --
+4 -4
cue/testdata/eval/sharing.txtar
··· 200 200 Y: { 201 201 x: #X & Y 202 202 } 203 - @test(err, code=structural cycle, path=Y.x.x, contains="structural cycle", pos=[]) 203 + @test(err, code=structural_cycle, path=Y.x.x, contains="structural cycle", pos=[]) 204 204 } 205 205 shareCycle: t2: { 206 206 #X: int ··· 216 216 Y: { 217 217 x: Y & #X 218 218 } 219 - @test(err, code=structural cycle, at=Y.x.x, contains="structural cycle", pos=[]) 219 + @test(err, code=structural_cycle, at=Y.x.x, contains="structural cycle", pos=[]) 220 220 } 221 221 -- acrossdisjunction.cue -- 222 222 import "list" ··· 375 375 [incomplete] issue3903.noshare.foo.result: invalid interpolation: non-concrete value string (type string): 376 376 ./let.cue:58:11 377 377 ./let.cue:57:17 378 - [structural cycle] shareCycle.t1.Y.x.x: structural cycle 378 + [structural_cycle] shareCycle.t1.Y.x.x: structural cycle 379 379 [eval] shareCycle.t2.Y.x: conflicting values int and {x:(#X & Y)} (mismatched types int and struct): 380 380 ./sharecycle.cue:9:6 381 381 ./sharecycle.cue:10:5 382 382 ./sharecycle.cue:11:6 383 383 ./sharecycle.cue:11:11 384 - [structural cycle] shareCycle.t3.Y.x.x: structural cycle 384 + [structural_cycle] shareCycle.t3.Y.x.x: structural cycle 385 385 -- out/eval/stats -- 386 386 Leaks: 7 387 387 Freed: 229
+1 -1
cue/testdata/references/self.txtar
··· 199 199 } 200 200 withLet: (struct){ 201 201 let X#1 = (_|_){ 202 - // [structural cycle] withLet.X: structural cycle 202 + // [structural_cycle] withLet.X: structural cycle 203 203 } 204 204 foo: (int){ 1 } 205 205 bar: (struct){
+1 -1
internal/core/adt/errorcode_string.go
··· 16 16 _ = x[CycleError-5] 17 17 } 18 18 19 - const _ErrorCode_name = "evaluseruserstructural cycleincompletecycle" 19 + const _ErrorCode_name = "evaluseruserstructural_cycleincompletecycle" 20 20 21 21 var _ErrorCode_index = [...]uint8{0, 4, 8, 12, 28, 38, 43} 22 22
+1 -1
internal/core/adt/errors.go
··· 63 63 // cycles are permanent errors, but they are not passed up recursively, 64 64 // as a unification of a value with a structural cycle with one that 65 65 // doesn't may still give a useful result. 66 - StructuralCycleError // structural cycle 66 + StructuralCycleError // structural_cycle 67 67 68 68 // IncompleteError means an evaluation could not complete because of 69 69 // insufficient information that may still be added later.