cuelang.org/go@v0.13.0/cue/testdata/fulleval/011_field_comprehensions_with_templates.txtar (about) 1 #name: field comprehensions with templates 2 #evalFull 3 -- in.cue -- 4 num: 1 5 a: { 6 if num < 5 { 7 [A=string]: [B=string]: { 8 name: A 9 kind: B 10 } 11 } 12 } 13 a: b: c: d: "bar" 14 -- out/def -- 15 num: 1 16 a: { 17 {[A=string]: { 18 [B=string]: { 19 name: A, kind: B 20 } 21 }} 22 b: { 23 {[B=string]: { 24 name: "b", kind: B 25 }} 26 c: { 27 name: "b" 28 kind: "c" 29 d: "bar" 30 } 31 } 32 } 33 -- out/export -- 34 num: 1 35 a: { 36 b: { 37 c: { 38 name: "b" 39 kind: "c" 40 d: "bar" 41 } 42 } 43 } 44 -- out/yaml -- 45 num: 1 46 a: 47 b: 48 c: 49 name: b 50 kind: c 51 d: bar 52 -- out/json -- 53 {"num":1,"a":{"b":{"c":{"name":"b","kind":"c","d":"bar"}}}} 54 -- out/legacy-debug -- 55 <0>{num: 1, a: <1>{[]: <2>(A: string)-><3>{[]: <4>(B: string)-><5>{name: <2>.A, kind: <4>.B}, }, b: <6>{[]: <7>(B: string)-><8>{name: <9>.A, kind: <7>.B}, c: <10>{name: "b", kind: "c", d: "bar"}}}} 56 -- out/compile -- 57 --- in.cue 58 { 59 num: 1 60 a: { 61 if (〈1;num〉 < 5) { 62 [string]: { 63 [string]: { 64 name: 〈2;-〉 65 kind: 〈1;-〉 66 } 67 } 68 } 69 } 70 a: { 71 b: { 72 c: { 73 d: "bar" 74 } 75 } 76 } 77 } 78 -- out/eval/stats -- 79 Leaks: 0 80 Freed: 8 81 Reused: 3 82 Allocs: 5 83 Retain: 0 84 85 Unifications: 8 86 Conjuncts: 12 87 Disjuncts: 8 88 -- out/eval -- 89 (struct){ 90 num: (int){ 1 } 91 a: (struct){ 92 b: (struct){ 93 c: (struct){ 94 d: (string){ "bar" } 95 name: (string){ "b" } 96 kind: (string){ "c" } 97 } 98 } 99 } 100 }