github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/testdata/compile/scope.txtar (about) 1 -- in.cue -- 2 a: { 3 {{ 4 b 5 c 6 d: b 7 e: c 8 }} 9 c: {} 10 } 11 b: { 12 13 } 14 s: "foo" 15 c: s 16 17 // s is technically in a new struct here so it will have a one higher count than 18 // the one before. 19 d: [s]: 3 20 21 e: {} 22 e & {// Is this allowed? Probably not as per comprehension rule (ref fixes.) 23 e: {} 24 } 25 26 {X=["foo"]: b: X | null} 27 {[Y="bar"]: b: Y} 28 29 let B = {open: int} 30 f: B 31 32 schema: { 33 next: _schema_1 34 } 35 36 let _schema_1 = schema 37 -- out/compile -- 38 --- in.cue 39 { 40 a: { 41 { 42 { 43 〈3;b〉 44 〈2;c〉 45 d: 〈3;b〉 46 e: 〈2;c〉 47 } 48 } 49 c: {} 50 } 51 b: {} 52 s: "foo" 53 c: 〈0;s〉 54 d: { 55 [〈1;s〉]: 3 56 } 57 e: {} 58 (〈0;e〉 & { 59 e: {} 60 }) 61 { 62 ["foo"]: { 63 b: (〈1;(〈1;-〉)〉|null) 64 } 65 } 66 { 67 ["bar"]: { 68 b: 〈1;-〉 69 } 70 } 71 f: 〈0;let B〉 72 schema: { 73 next: 〈1;let _schema_1〉 74 } 75 } 76 -- out/eval -- 77 Errors: 78 schema.next: structural cycle 79 80 Result: 81 (_|_){ 82 // [structural cycle] 83 e: (struct){ 84 } 85 a: (struct){ 86 d: (struct){ 87 } 88 e: (struct){ 89 } 90 c: (struct){ 91 } 92 } 93 b: (struct){ 94 } 95 s: (string){ "foo" } 96 c: (string){ "foo" } 97 d: (struct){ 98 } 99 f: (struct){ 100 open: (int){ int } 101 } 102 schema: (_|_){ 103 // [structural cycle] 104 next: (_|_){ 105 // [structural cycle] schema.next: structural cycle 106 } 107 } 108 }