...
1-- in.cue --
2self: {
3 // This is an incomplete error, as it may succeed when the user
4 // explicitly specifies a value for fail.a.b.
5 fail: {
6 a: {
7 if a.b == _|_ {
8 b: 1
9 }
10 }
11 }
12
13 // This is an incomplete error, as it may succeed when the user
14 // explicitly specifies a value for a.b.
15 isConcreteFail: t1:{
16 a: {
17 if a.b == _|_ {
18 b: 1
19 }
20 b: int
21 }
22 }
23
24 isConcreteFail: t2:{
25 a: {
26 if a.b == _|_ {
27 b: 1
28 }
29 b?: int
30 }
31 }
32
33 // This is an incomplete error, as it may succeed when the user
34 // explicitly specifies a value for a.b.
35 // TODO: new builtin semantics.
36 // if isconcrete(a.b) -->> cyclic error evaluating isconcrete.
37 // if isdefined(a.b) -->> evaluate to true as a.b is int, result is 1
38 // if !isdefined(a.b) -->> evaluate to false, a.b remains int
39 isNotConcrete: t1: {
40 a: {
41 if a.b != _|_ {
42 b: 1
43 }
44 b: int
45 }
46 }
47 isNotConcrete: t2: {
48 a: {
49 if a.b != _|_ {
50 b: 1
51 }
52 b?: int
53 }
54 }
55
56}
57
58-- mutual.cue --
59mutual: {
60 noConflicts: {
61 a: {if b.foo == _|_ {new: ""}}
62 b: {if a.bar == _|_ {new: ""}}
63 }
64
65 mutualCycleFail: {
66 b: {if a.bar == _|_ {foo: ""}}
67 a: {if b.foo == _|_ {bar: ""}}
68 }
69
70 brokenCycleSuccess: {
71 a: { if b.foo == _|_ { foo: "" } }
72 b: { if a.bar == _|_ { bar: "" } }
73 a: bar: ""
74 }
75
76 allowOneDirectionalDependency: {
77 p1: {
78 a: { if b.foo == _|_ { bar: "" } } // added
79 b: { if a.bar == _|_ { new: "" } } // not added
80 }
81 p2: {
82 a: { if b.foo == _|_ { new: "" } }
83 b: { if a.bar == _|_ { foo: "" } }
84 }
85 }
86
87 oneDirectionalBrokenConflictSuccess: p1: {
88 b: foo: ""
89 a: { if b.foo == _|_ { bar: "" } }
90 b: { if a.bar == _|_ { new: "" } }
91 }
92 oneDirectionalBrokenConflictSuccess: p2: {
93 a: { if b.foo == _|_ { bar: "" } }
94 b: foo: ""
95 b: { if a.bar == _|_ { new: "" } }
96 }
97 oneDirectionalBrokenConflictSuccess: p3: {
98 a: { if b.foo == _|_ { bar: "" } }
99 b: { if a.bar == _|_ { new: "" } }
100 b: foo: ""
101 }
102 oneDirectionalBrokenConflictSuccess: p4: {
103 b: foo: ""
104 b: { if a.bar == _|_ { new: "" } }
105 a: { if b.foo == _|_ { bar: "" } }
106 }
107 oneDirectionalBrokenConflictSuccess: p5: {
108 b: { if a.bar == _|_ { new: "" } }
109 b: foo: ""
110 a: { if b.foo == _|_ { bar: "" } }
111 }
112 oneDirectionalBrokenConflictSuccess: p6: {
113 b: { if a.bar == _|_ { new: "" } }
114 a: { if b.foo == _|_ { bar: "" } }
115 b: foo: ""
116 }
117}
118
119-- mutualsamestruct.cue --
120sameStruct: {
121 chainSuccess: a: {
122 raises?: {}
123 if raises == _|_ {
124 ret: a: 1
125 }
126 ret?: {}
127 if ret != _|_ {
128 foo: a: 1
129 }
130 }
131
132 chainSuccess: b: {
133 if ret != _|_ {
134 foo: a: 1
135 }
136 raises?: {}
137 if raises == _|_ {
138 ret: a: 1
139 }
140 ret?: {}
141 }
142
143 cycleFail: t1: p1: {
144 raises?: {}
145 if raises == _|_ {
146 ret: a: 1
147 }
148 ret?: {}
149 if ret != _|_ {
150 raises: a: 1
151 }
152 }
153
154 cycleFail: t1: p2: {
155 ret?: {}
156 if ret != _|_ {
157 raises: a: 1
158 }
159 raises?: {}
160 if raises == _|_ {
161 ret: a: 1
162 }
163 }
164
165 // This test should fail with a cycle error. Even though raises and ret are
166 // both known to be defined, comparison against bottom requires that the
167 // structs be recursively checked for errors. We disallow that here, because
168 // the structs mutually depend on each other.
169 // TODO: consider allowing a specific postCheck for determining if an arc
170 // is erroneous.
171 cycleFail: t2: p1: {
172 raises: {}
173 if raises == _|_ {
174 ret: a: 1
175 }
176 ret: {}
177 if ret != _|_ {
178 raises: a: 1
179 }
180 }
181
182 // Same as above test, but different order. It may be that the specific
183 // fields that are added are different for the two cases. This is fine as
184 // long as the parent fails, as that error is ultimately what represents
185 // the value as a whole.
186 cycleFail: t2: p2: {
187 ret: {}
188 if ret != _|_ {
189 raises: a: 1
190 }
191 raises: {}
192 if raises == _|_ {
193 ret: a: 1
194 }
195 }
196
197 // This test should fail similarly to the above tests. The fields ret and
198 // raises are not concrete, but may still become a struct and thus need
199 // to be recursively checked.
200 cycleFail: t3: p1: {
201 raises: _
202 if raises == _|_ {
203 ret: a: 1
204 }
205 ret: _
206 if ret != _|_ {
207 raises: a: 1
208 }
209 }
210
211 cycleFail: t3: p2: {
212 ret: _
213 if ret != _|_ {
214 raises: a: 1
215 }
216 raises: _
217 if raises == _|_ {
218 ret: a: 1
219 }
220 }
221
222 defCloseSuccess: {
223 #Example: {
224 raises?: {
225 runtime?: string
226 }
227
228 if raises == _|_ {
229 ret?: _
230 }
231 }
232
233 expr: #Example & {
234 ret: 2
235 }
236 }
237}
238
239-- nestedchain.cue --
240// Issue
241nestedChain: {
242 cycleFail: {
243 if #E.x != _|_ {
244 #E: y: true
245 }
246 if #E.y == _|_ {
247 #E: x: true
248 }
249 #E: [_]: bool
250 }
251
252 brokenCycleSuccess: {
253 if #E.x != _|_ {
254 #E: y: true
255 }
256 if #E.y == _|_ {
257 #E: x: true
258 }
259 #E: [_]: bool
260 #E: x: true
261 }
262
263 doubleAddfail: {
264 if #E.x == _|_ {
265 #E: y: true
266 }
267 if #E.y == _|_ {
268 #E: x: true
269 }
270 #E: [_]: bool
271 }
272
273 trippleSuccess: {
274 if #E.x != _|_ {
275 #E: y: true
276 }
277 if #E.y != _|_ {
278 z: true
279 }
280 #E: x: true
281 }
282}
283-- out/eval/stats --
284Leaks: 1
285Freed: 158
286Reused: 149
287Allocs: 10
288Retain: 73
289
290Unifications: 159
291Conjuncts: 169
292Disjuncts: 210
293-- out/evalalpha --
294(struct){
295 self: (struct){
296 fail: (struct){
297 a: (_|_){
298 // [incomplete] self.fail.a.b: cyclic reference to field b:
299 // ./in.cue:6:4
300 }
301 }
302 isConcreteFail: (struct){
303 t1: (struct){
304 a: (struct){
305 b: (int){ 1 }
306 }
307 }
308 t2: (struct){
309 a: (struct){
310 b?: (_|_){
311 // [incomplete] self.isConcreteFail.t2.a.b: cyclic reference to field b:
312 // ./in.cue:26:8
313 }
314 }
315 }
316 }
317 isNotConcrete: (struct){
318 t1: (struct){
319 a: (struct){
320 b: (int){ int }
321 }
322 }
323 t2: (struct){
324 a: (struct){
325 b?: (int){ int }
326 }
327 }
328 }
329 }
330 mutual: (struct){
331 noConflicts: (struct){
332 a: (struct){
333 new: (string){ "" }
334 }
335 b: (struct){
336 new: (string){ "" }
337 }
338 }
339 mutualCycleFail: (struct){
340 b: (_|_){
341 // [incomplete] mutual.mutualCycleFail.b.foo: cyclic reference to field foo:
342 // ./mutual.cue:8:7
343 }
344 a: (_|_){
345 // [incomplete] mutual.mutualCycleFail.a.bar: cyclic reference to field bar:
346 // ./mutual.cue:9:7
347 }
348 }
349 brokenCycleSuccess: (struct){
350 a: (struct){
351 foo: (string){ "" }
352 bar: (string){ "" }
353 }
354 b: (struct){
355 }
356 }
357 allowOneDirectionalDependency: (struct){
358 p1: (struct){
359 a: (struct){
360 bar: (string){ "" }
361 }
362 b: (struct){
363 }
364 }
365 p2: (struct){
366 a: (struct){
367 }
368 b: (struct){
369 foo: (string){ "" }
370 }
371 }
372 }
373 oneDirectionalBrokenConflictSuccess: (struct){
374 p1: (struct){
375 b: (struct){
376 foo: (string){ "" }
377 new: (string){ "" }
378 }
379 a: (struct){
380 }
381 }
382 p2: (struct){
383 a: (struct){
384 }
385 b: (struct){
386 foo: (string){ "" }
387 new: (string){ "" }
388 }
389 }
390 p3: (struct){
391 a: (struct){
392 }
393 b: (struct){
394 new: (string){ "" }
395 foo: (string){ "" }
396 }
397 }
398 p4: (struct){
399 b: (struct){
400 foo: (string){ "" }
401 new: (string){ "" }
402 }
403 a: (struct){
404 }
405 }
406 p5: (struct){
407 b: (struct){
408 new: (string){ "" }
409 foo: (string){ "" }
410 }
411 a: (struct){
412 }
413 }
414 p6: (struct){
415 b: (struct){
416 new: (string){ "" }
417 foo: (string){ "" }
418 }
419 a: (struct){
420 }
421 }
422 }
423 }
424 sameStruct: (struct){
425 chainSuccess: (struct){
426 a: (struct){
427 raises?: (struct){
428 }
429 ret: (struct){
430 a: (int){ 1 }
431 }
432 foo: (struct){
433 a: (int){ 1 }
434 }
435 }
436 b: (struct){
437 foo: (struct){
438 a: (int){ 1 }
439 }
440 raises?: (struct){
441 }
442 ret: (struct){
443 a: (int){ 1 }
444 }
445 }
446 }
447 cycleFail: (struct){
448 t1: (struct){
449 p1: (struct){
450 raises?: (struct){
451 a: (_|_){
452 // [incomplete] sameStruct.cycleFail.t1.p1.raises.a: cyclic reference to field raises:
453 // ./mutualsamestruct.cue:31:15
454 }
455 }
456 ret: (struct){
457 a: (int){ 1 }
458 }
459 }
460 p2: (struct){
461 ret?: (struct){
462 a: (_|_){
463 // [incomplete] sameStruct.cycleFail.t1.p2.ret.a: cyclic reference to field ret:
464 // ./mutualsamestruct.cue:42:12
465 }
466 }
467 raises?: (struct){
468 }
469 }
470 }
471 t2: (struct){
472 p1: (struct){
473 raises: (_|_){
474 // [cycle] sameStruct.cycleFail.t2.p1.raises: mutual dependency
475 a: (int){ 1 }
476 }
477 ret: (struct){
478 }
479 }
480 p2: (struct){
481 ret: (_|_){
482 // [cycle] sameStruct.cycleFail.t2.p2.ret: mutual dependency
483 }
484 raises: (struct){
485 a: (int){ 1 }
486 }
487 }
488 }
489 t3: (struct){
490 p1: (struct){
491 raises: (_|_){
492 // [cycle] sameStruct.cycleFail.t3.p1.raises: mutual dependency
493 a: (int){ 1 }
494 }
495 ret: (_){ _ }
496 }
497 p2: (struct){
498 ret: (_|_){
499 // [cycle] sameStruct.cycleFail.t3.p2.ret: mutual dependency
500 }
501 raises: (_){
502 _
503 a: (int){ 1 }
504 }
505 }
506 }
507 }
508 defCloseSuccess: (struct){
509 #Example: (#struct){
510 raises?: (#struct){
511 runtime?: (string){ string }
512 }
513 ret?: (_){ _ }
514 }
515 expr: (#struct){
516 ret: (int){ 2 }
517 raises?: (#struct){
518 runtime?: (string){ string }
519 }
520 }
521 }
522 }
523 nestedChain: (struct){
524 cycleFail: (_|_){
525 // [incomplete] nestedChain.cycleFail.#E.x: cyclic reference to field x:
526 // ./nestedchain.cue:7:3
527 #E: (#struct){
528 }
529 }
530 brokenCycleSuccess: (struct){
531 #E: (#struct){
532 y: (bool){ true }
533 x: (bool){ true }
534 }
535 }
536 doubleAddfail: (_|_){
537 // [incomplete] nestedChain.doubleAddfail.#E.y: cyclic reference to field y:
538 // ./nestedchain.cue:25:3
539 // nestedChain.doubleAddfail.#E.x: cyclic reference to field x:
540 // ./nestedchain.cue:28:3
541 #E: (#struct){
542 }
543 }
544 trippleSuccess: (struct){
545 #E: (#struct){
546 y: (bool){ true }
547 x: (bool){ true }
548 }
549 z: (bool){ true }
550 }
551 }
552}
553-- diff/-out/evalalpha<==>+out/eval --
554diff old new
555--- old
556+++ new
557@@ -2,34 +2,29 @@
558 self: (struct){
559 fail: (struct){
560 a: (_|_){
561- // [cycle] self.fail.a: cycle with field a.b:
562- // ./in.cue:6:7
563+ // [incomplete] self.fail.a.b: cyclic reference to field b:
564+ // ./in.cue:6:4
565 }
566 }
567 isConcreteFail: (struct){
568 t1: (struct){
569- a: (_|_){
570- // [cycle] cycle error
571- b: (_|_){
572- // [cycle] cycle error
573- }
574- }
575- }
576- t2: (struct){
577- a: (_|_){
578- // [cycle] self.isConcreteFail.t2.a: circular dependency in evaluation of conditionals: a.b changed after evaluation:
579- // ./in.cue:25:7
580+ a: (struct){
581 b: (int){ 1 }
582 }
583 }
584+ t2: (struct){
585+ a: (struct){
586+ b?: (_|_){
587+ // [incomplete] self.isConcreteFail.t2.a.b: cyclic reference to field b:
588+ // ./in.cue:26:8
589+ }
590+ }
591+ }
592 }
593 isNotConcrete: (struct){
594 t1: (struct){
595- a: (_|_){
596- // [cycle] cycle error
597- b: (_|_){
598- // [cycle] cycle error
599- }
600+ a: (struct){
601+ b: (int){ int }
602 }
603 }
604 t2: (struct){
605@@ -50,17 +45,12 @@
606 }
607 mutualCycleFail: (struct){
608 b: (_|_){
609- // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
610- // ./mutual.cue:9:10
611- foo: (string){ "" }
612- }
613- a: (_|_){
614- // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
615- // ./mutual.cue:9:10
616- bar*: (_|_){
617- // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
618- // ./mutual.cue:9:10
619- }
620+ // [incomplete] mutual.mutualCycleFail.b.foo: cyclic reference to field foo:
621+ // ./mutual.cue:8:7
622+ }
623+ a: (_|_){
624+ // [incomplete] mutual.mutualCycleFail.a.bar: cyclic reference to field bar:
625+ // ./mutual.cue:9:7
626 }
627 }
628 brokenCycleSuccess: (struct){
629@@ -163,62 +153,62 @@
630 }
631 cycleFail: (struct){
632 t1: (struct){
633- p1: (_|_){
634- // [cycle] sameStruct.cycleFail.t1.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
635- // ./mutualsamestruct.cue:26:6
636- raises: (struct){
637- a: (int){ 1 }
638- }
639- ret: (struct){
640- a: (int){ 1 }
641- }
642- }
643- p2: (_|_){
644- // [cycle] sameStruct.cycleFail.t1.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
645- // ./mutualsamestruct.cue:37:6
646- ret: (struct){
647- a: (int){ 1 }
648- }
649- raises?: (struct){
650- }
651- }
652- }
653- t2: (struct){
654- p1: (_|_){
655- // [cycle] sameStruct.cycleFail.t2.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
656- // ./mutualsamestruct.cue:54:6
657- raises: (struct){
658- a: (int){ 1 }
659- }
660- ret: (struct){
661- a: (int){ 1 }
662- }
663- }
664- p2: (_|_){
665- // [cycle] sameStruct.cycleFail.t2.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
666- // ./mutualsamestruct.cue:69:6
667- ret: (struct){
668- }
669- raises: (struct){
670+ p1: (struct){
671+ raises?: (struct){
672+ a: (_|_){
673+ // [incomplete] sameStruct.cycleFail.t1.p1.raises.a: cyclic reference to field raises:
674+ // ./mutualsamestruct.cue:31:15
675+ }
676+ }
677+ ret: (struct){
678+ a: (int){ 1 }
679+ }
680+ }
681+ p2: (struct){
682+ ret?: (struct){
683+ a: (_|_){
684+ // [incomplete] sameStruct.cycleFail.t1.p2.ret.a: cyclic reference to field ret:
685+ // ./mutualsamestruct.cue:42:12
686+ }
687+ }
688+ raises?: (struct){
689+ }
690+ }
691+ }
692+ t2: (struct){
693+ p1: (struct){
694+ raises: (_|_){
695+ // [cycle] sameStruct.cycleFail.t2.p1.raises: mutual dependency
696+ a: (int){ 1 }
697+ }
698+ ret: (struct){
699+ }
700+ }
701+ p2: (struct){
702+ ret: (_|_){
703+ // [cycle] sameStruct.cycleFail.t2.p2.ret: mutual dependency
704+ }
705+ raises: (struct){
706+ a: (int){ 1 }
707 }
708 }
709 }
710 t3: (struct){
711- p1: (_|_){
712- // [cycle] sameStruct.cycleFail.t3.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
713- // ./mutualsamestruct.cue:83:6
714- raises: (struct){
715- a: (int){ 1 }
716- }
717- ret: (struct){
718- a: (int){ 1 }
719- }
720- }
721- p2: (_|_){
722- // [cycle] sameStruct.cycleFail.t3.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
723- // ./mutualsamestruct.cue:94:6
724+ p1: (struct){
725+ raises: (_|_){
726+ // [cycle] sameStruct.cycleFail.t3.p1.raises: mutual dependency
727+ a: (int){ 1 }
728+ }
729 ret: (_){ _ }
730- raises: (_){ _ }
731+ }
732+ p2: (struct){
733+ ret: (_|_){
734+ // [cycle] sameStruct.cycleFail.t3.p2.ret: mutual dependency
735+ }
736+ raises: (_){
737+ _
738+ a: (int){ 1 }
739+ }
740 }
741 }
742 }
743@@ -230,20 +220,18 @@
744 ret?: (_){ _ }
745 }
746 expr: (#struct){
747- raises?: (#struct){
748- runtime?: (string){ string }
749- }
750 ret: (int){ 2 }
751+ raises?: (#struct){
752+ runtime?: (string){ string }
753+ }
754 }
755 }
756 }
757 nestedChain: (struct){
758 cycleFail: (_|_){
759- // [cycle] nestedChain.cycleFail: cycle with field #E.y:
760- // ./nestedchain.cue:7:6
761- #E: (_|_){
762- // [cycle] nestedChain.cycleFail: cycle with field #E.y:
763- // ./nestedchain.cue:7:6
764+ // [incomplete] nestedChain.cycleFail.#E.x: cyclic reference to field x:
765+ // ./nestedchain.cue:7:3
766+ #E: (#struct){
767 }
768 }
769 brokenCycleSuccess: (struct){
770@@ -253,12 +241,11 @@
771 }
772 }
773 doubleAddfail: (_|_){
774- // [cycle] nestedChain.doubleAddfail: cycle with field #E.y:
775- // ./nestedchain.cue:28:6
776- #E: (_|_){
777- // [cycle] nestedChain.doubleAddfail: cycle with field #E.y:
778- // ./nestedchain.cue:28:6
779- y: (bool){ true }
780+ // [incomplete] nestedChain.doubleAddfail.#E.y: cyclic reference to field y:
781+ // ./nestedchain.cue:25:3
782+ // nestedChain.doubleAddfail.#E.x: cyclic reference to field x:
783+ // ./nestedchain.cue:28:3
784+ #E: (#struct){
785 }
786 }
787 trippleSuccess: (struct){
788-- diff/explanation --
789self.isConcreteFail: t1: int value is not an error.
790self.isNotConcrete: t1: int value is not an error.
791-- diff/todo/p3 --
792sameStruct.cycleFail: Harmonize and improve cycle errors
793-- out/eval --
794(struct){
795 self: (struct){
796 fail: (struct){
797 a: (_|_){
798 // [cycle] self.fail.a: cycle with field a.b:
799 // ./in.cue:6:7
800 }
801 }
802 isConcreteFail: (struct){
803 t1: (struct){
804 a: (_|_){
805 // [cycle] cycle error
806 b: (_|_){
807 // [cycle] cycle error
808 }
809 }
810 }
811 t2: (struct){
812 a: (_|_){
813 // [cycle] self.isConcreteFail.t2.a: circular dependency in evaluation of conditionals: a.b changed after evaluation:
814 // ./in.cue:25:7
815 b: (int){ 1 }
816 }
817 }
818 }
819 isNotConcrete: (struct){
820 t1: (struct){
821 a: (_|_){
822 // [cycle] cycle error
823 b: (_|_){
824 // [cycle] cycle error
825 }
826 }
827 }
828 t2: (struct){
829 a: (struct){
830 b?: (int){ int }
831 }
832 }
833 }
834 }
835 mutual: (struct){
836 noConflicts: (struct){
837 a: (struct){
838 new: (string){ "" }
839 }
840 b: (struct){
841 new: (string){ "" }
842 }
843 }
844 mutualCycleFail: (struct){
845 b: (_|_){
846 // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
847 // ./mutual.cue:9:10
848 foo: (string){ "" }
849 }
850 a: (_|_){
851 // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
852 // ./mutual.cue:9:10
853 bar*: (_|_){
854 // [cycle] mutual.mutualCycleFail.a: cycle with field b.foo:
855 // ./mutual.cue:9:10
856 }
857 }
858 }
859 brokenCycleSuccess: (struct){
860 a: (struct){
861 foo: (string){ "" }
862 bar: (string){ "" }
863 }
864 b: (struct){
865 }
866 }
867 allowOneDirectionalDependency: (struct){
868 p1: (struct){
869 a: (struct){
870 bar: (string){ "" }
871 }
872 b: (struct){
873 }
874 }
875 p2: (struct){
876 a: (struct){
877 }
878 b: (struct){
879 foo: (string){ "" }
880 }
881 }
882 }
883 oneDirectionalBrokenConflictSuccess: (struct){
884 p1: (struct){
885 b: (struct){
886 foo: (string){ "" }
887 new: (string){ "" }
888 }
889 a: (struct){
890 }
891 }
892 p2: (struct){
893 a: (struct){
894 }
895 b: (struct){
896 foo: (string){ "" }
897 new: (string){ "" }
898 }
899 }
900 p3: (struct){
901 a: (struct){
902 }
903 b: (struct){
904 new: (string){ "" }
905 foo: (string){ "" }
906 }
907 }
908 p4: (struct){
909 b: (struct){
910 foo: (string){ "" }
911 new: (string){ "" }
912 }
913 a: (struct){
914 }
915 }
916 p5: (struct){
917 b: (struct){
918 new: (string){ "" }
919 foo: (string){ "" }
920 }
921 a: (struct){
922 }
923 }
924 p6: (struct){
925 b: (struct){
926 new: (string){ "" }
927 foo: (string){ "" }
928 }
929 a: (struct){
930 }
931 }
932 }
933 }
934 sameStruct: (struct){
935 chainSuccess: (struct){
936 a: (struct){
937 raises?: (struct){
938 }
939 ret: (struct){
940 a: (int){ 1 }
941 }
942 foo: (struct){
943 a: (int){ 1 }
944 }
945 }
946 b: (struct){
947 foo: (struct){
948 a: (int){ 1 }
949 }
950 raises?: (struct){
951 }
952 ret: (struct){
953 a: (int){ 1 }
954 }
955 }
956 }
957 cycleFail: (struct){
958 t1: (struct){
959 p1: (_|_){
960 // [cycle] sameStruct.cycleFail.t1.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
961 // ./mutualsamestruct.cue:26:6
962 raises: (struct){
963 a: (int){ 1 }
964 }
965 ret: (struct){
966 a: (int){ 1 }
967 }
968 }
969 p2: (_|_){
970 // [cycle] sameStruct.cycleFail.t1.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
971 // ./mutualsamestruct.cue:37:6
972 ret: (struct){
973 a: (int){ 1 }
974 }
975 raises?: (struct){
976 }
977 }
978 }
979 t2: (struct){
980 p1: (_|_){
981 // [cycle] sameStruct.cycleFail.t2.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
982 // ./mutualsamestruct.cue:54:6
983 raises: (struct){
984 a: (int){ 1 }
985 }
986 ret: (struct){
987 a: (int){ 1 }
988 }
989 }
990 p2: (_|_){
991 // [cycle] sameStruct.cycleFail.t2.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
992 // ./mutualsamestruct.cue:69:6
993 ret: (struct){
994 }
995 raises: (struct){
996 }
997 }
998 }
999 t3: (struct){
1000 p1: (_|_){
1001 // [cycle] sameStruct.cycleFail.t3.p1: circular dependency in evaluation of conditionals: raises changed after evaluation:
1002 // ./mutualsamestruct.cue:83:6
1003 raises: (struct){
1004 a: (int){ 1 }
1005 }
1006 ret: (struct){
1007 a: (int){ 1 }
1008 }
1009 }
1010 p2: (_|_){
1011 // [cycle] sameStruct.cycleFail.t3.p2: circular dependency in evaluation of conditionals: ret changed after evaluation:
1012 // ./mutualsamestruct.cue:94:6
1013 ret: (_){ _ }
1014 raises: (_){ _ }
1015 }
1016 }
1017 }
1018 defCloseSuccess: (struct){
1019 #Example: (#struct){
1020 raises?: (#struct){
1021 runtime?: (string){ string }
1022 }
1023 ret?: (_){ _ }
1024 }
1025 expr: (#struct){
1026 raises?: (#struct){
1027 runtime?: (string){ string }
1028 }
1029 ret: (int){ 2 }
1030 }
1031 }
1032 }
1033 nestedChain: (struct){
1034 cycleFail: (_|_){
1035 // [cycle] nestedChain.cycleFail: cycle with field #E.y:
1036 // ./nestedchain.cue:7:6
1037 #E: (_|_){
1038 // [cycle] nestedChain.cycleFail: cycle with field #E.y:
1039 // ./nestedchain.cue:7:6
1040 }
1041 }
1042 brokenCycleSuccess: (struct){
1043 #E: (#struct){
1044 y: (bool){ true }
1045 x: (bool){ true }
1046 }
1047 }
1048 doubleAddfail: (_|_){
1049 // [cycle] nestedChain.doubleAddfail: cycle with field #E.y:
1050 // ./nestedchain.cue:28:6
1051 #E: (_|_){
1052 // [cycle] nestedChain.doubleAddfail: cycle with field #E.y:
1053 // ./nestedchain.cue:28:6
1054 y: (bool){ true }
1055 }
1056 }
1057 trippleSuccess: (struct){
1058 #E: (#struct){
1059 y: (bool){ true }
1060 x: (bool){ true }
1061 }
1062 z: (bool){ true }
1063 }
1064 }
1065}
1066-- out/compile --
1067--- in.cue
1068{
1069 self: {
1070 fail: {
1071 a: {
1072 if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) {
1073 b: 1
1074 }
1075 }
1076 }
1077 isConcreteFail: {
1078 t1: {
1079 a: {
1080 if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) {
1081 b: 1
1082 }
1083 b: int
1084 }
1085 }
1086 }
1087 isConcreteFail: {
1088 t2: {
1089 a: {
1090 if (〈1;a〉.b == _|_(explicit error (_|_ literal) in source)) {
1091 b: 1
1092 }
1093 b?: int
1094 }
1095 }
1096 }
1097 isNotConcrete: {
1098 t1: {
1099 a: {
1100 if (〈1;a〉.b != _|_(explicit error (_|_ literal) in source)) {
1101 b: 1
1102 }
1103 b: int
1104 }
1105 }
1106 }
1107 isNotConcrete: {
1108 t2: {
1109 a: {
1110 if (〈1;a〉.b != _|_(explicit error (_|_ literal) in source)) {
1111 b: 1
1112 }
1113 b?: int
1114 }
1115 }
1116 }
1117 }
1118}
1119--- mutual.cue
1120{
1121 mutual: {
1122 noConflicts: {
1123 a: {
1124 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1125 new: ""
1126 }
1127 }
1128 b: {
1129 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1130 new: ""
1131 }
1132 }
1133 }
1134 mutualCycleFail: {
1135 b: {
1136 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1137 foo: ""
1138 }
1139 }
1140 a: {
1141 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1142 bar: ""
1143 }
1144 }
1145 }
1146 brokenCycleSuccess: {
1147 a: {
1148 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1149 foo: ""
1150 }
1151 }
1152 b: {
1153 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1154 bar: ""
1155 }
1156 }
1157 a: {
1158 bar: ""
1159 }
1160 }
1161 allowOneDirectionalDependency: {
1162 p1: {
1163 a: {
1164 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1165 bar: ""
1166 }
1167 }
1168 b: {
1169 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1170 new: ""
1171 }
1172 }
1173 }
1174 p2: {
1175 a: {
1176 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1177 new: ""
1178 }
1179 }
1180 b: {
1181 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1182 foo: ""
1183 }
1184 }
1185 }
1186 }
1187 oneDirectionalBrokenConflictSuccess: {
1188 p1: {
1189 b: {
1190 foo: ""
1191 }
1192 a: {
1193 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1194 bar: ""
1195 }
1196 }
1197 b: {
1198 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1199 new: ""
1200 }
1201 }
1202 }
1203 }
1204 oneDirectionalBrokenConflictSuccess: {
1205 p2: {
1206 a: {
1207 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1208 bar: ""
1209 }
1210 }
1211 b: {
1212 foo: ""
1213 }
1214 b: {
1215 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1216 new: ""
1217 }
1218 }
1219 }
1220 }
1221 oneDirectionalBrokenConflictSuccess: {
1222 p3: {
1223 a: {
1224 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1225 bar: ""
1226 }
1227 }
1228 b: {
1229 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1230 new: ""
1231 }
1232 }
1233 b: {
1234 foo: ""
1235 }
1236 }
1237 }
1238 oneDirectionalBrokenConflictSuccess: {
1239 p4: {
1240 b: {
1241 foo: ""
1242 }
1243 b: {
1244 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1245 new: ""
1246 }
1247 }
1248 a: {
1249 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1250 bar: ""
1251 }
1252 }
1253 }
1254 }
1255 oneDirectionalBrokenConflictSuccess: {
1256 p5: {
1257 b: {
1258 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1259 new: ""
1260 }
1261 }
1262 b: {
1263 foo: ""
1264 }
1265 a: {
1266 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1267 bar: ""
1268 }
1269 }
1270 }
1271 }
1272 oneDirectionalBrokenConflictSuccess: {
1273 p6: {
1274 b: {
1275 if (〈1;a〉.bar == _|_(explicit error (_|_ literal) in source)) {
1276 new: ""
1277 }
1278 }
1279 a: {
1280 if (〈1;b〉.foo == _|_(explicit error (_|_ literal) in source)) {
1281 bar: ""
1282 }
1283 }
1284 b: {
1285 foo: ""
1286 }
1287 }
1288 }
1289 }
1290}
1291--- mutualsamestruct.cue
1292{
1293 sameStruct: {
1294 chainSuccess: {
1295 a: {
1296 raises?: {}
1297 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1298 ret: {
1299 a: 1
1300 }
1301 }
1302 ret?: {}
1303 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
1304 foo: {
1305 a: 1
1306 }
1307 }
1308 }
1309 }
1310 chainSuccess: {
1311 b: {
1312 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
1313 foo: {
1314 a: 1
1315 }
1316 }
1317 raises?: {}
1318 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1319 ret: {
1320 a: 1
1321 }
1322 }
1323 ret?: {}
1324 }
1325 }
1326 cycleFail: {
1327 t1: {
1328 p1: {
1329 raises?: {}
1330 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1331 ret: {
1332 a: 1
1333 }
1334 }
1335 ret?: {}
1336 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
1337 raises: {
1338 a: 1
1339 }
1340 }
1341 }
1342 }
1343 }
1344 cycleFail: {
1345 t1: {
1346 p2: {
1347 ret?: {}
1348 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
1349 raises: {
1350 a: 1
1351 }
1352 }
1353 raises?: {}
1354 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1355 ret: {
1356 a: 1
1357 }
1358 }
1359 }
1360 }
1361 }
1362 cycleFail: {
1363 t2: {
1364 p1: {
1365 raises: {}
1366 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1367 ret: {
1368 a: 1
1369 }
1370 }
1371 ret: {}
1372 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
1373 raises: {
1374 a: 1
1375 }
1376 }
1377 }
1378 }
1379 }
1380 cycleFail: {
1381 t2: {
1382 p2: {
1383 ret: {}
1384 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
1385 raises: {
1386 a: 1
1387 }
1388 }
1389 raises: {}
1390 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1391 ret: {
1392 a: 1
1393 }
1394 }
1395 }
1396 }
1397 }
1398 cycleFail: {
1399 t3: {
1400 p1: {
1401 raises: _
1402 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1403 ret: {
1404 a: 1
1405 }
1406 }
1407 ret: _
1408 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
1409 raises: {
1410 a: 1
1411 }
1412 }
1413 }
1414 }
1415 }
1416 cycleFail: {
1417 t3: {
1418 p2: {
1419 ret: _
1420 if (〈0;ret〉 != _|_(explicit error (_|_ literal) in source)) {
1421 raises: {
1422 a: 1
1423 }
1424 }
1425 raises: _
1426 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1427 ret: {
1428 a: 1
1429 }
1430 }
1431 }
1432 }
1433 }
1434 defCloseSuccess: {
1435 #Example: {
1436 raises?: {
1437 runtime?: string
1438 }
1439 if (〈0;raises〉 == _|_(explicit error (_|_ literal) in source)) {
1440 ret?: _
1441 }
1442 }
1443 expr: (〈0;#Example〉 & {
1444 ret: 2
1445 })
1446 }
1447 }
1448}
1449--- nestedchain.cue
1450{
1451 nestedChain: {
1452 cycleFail: {
1453 if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) {
1454 #E: {
1455 y: true
1456 }
1457 }
1458 if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) {
1459 #E: {
1460 x: true
1461 }
1462 }
1463 #E: {
1464 [_]: bool
1465 }
1466 }
1467 brokenCycleSuccess: {
1468 if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) {
1469 #E: {
1470 y: true
1471 }
1472 }
1473 if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) {
1474 #E: {
1475 x: true
1476 }
1477 }
1478 #E: {
1479 [_]: bool
1480 }
1481 #E: {
1482 x: true
1483 }
1484 }
1485 doubleAddfail: {
1486 if (〈0;#E〉.x == _|_(explicit error (_|_ literal) in source)) {
1487 #E: {
1488 y: true
1489 }
1490 }
1491 if (〈0;#E〉.y == _|_(explicit error (_|_ literal) in source)) {
1492 #E: {
1493 x: true
1494 }
1495 }
1496 #E: {
1497 [_]: bool
1498 }
1499 }
1500 trippleSuccess: {
1501 if (〈0;#E〉.x != _|_(explicit error (_|_ literal) in source)) {
1502 #E: {
1503 y: true
1504 }
1505 }
1506 if (〈0;#E〉.y != _|_(explicit error (_|_ literal) in source)) {
1507 z: true
1508 }
1509 #E: {
1510 x: true
1511 }
1512 }
1513 }
1514}
View as plain text