github.com/solo-io/cue@v0.4.7/cue/testdata/resolve/029_non-closed_definition_carries_over_closedness_to_enclosed_template.txtar (about) 1 # DO NOT EDIT; generated by go run testdata/gen.go 2 # 3 #name: non-closed definition carries over closedness to enclosed template 4 #evalPartial 5 -- in.cue -- 6 #S: { 7 [string]: {a: int} 8 } 9 a: #S & { 10 v: {b: int} 11 } 12 #Q: { 13 [string]: {a: int} | {b: int} 14 } 15 b: #Q & { 16 w: {c: int} 17 } 18 #R: { 19 [string]: [{a: int}, {b: int}] 20 } 21 c: #R & { 22 w: [{d: int}, ...] 23 } 24 -- out/def -- 25 #S: { 26 [string]: { 27 a: int 28 } 29 } 30 a: #S & { 31 v: { 32 b: int 33 } 34 } 35 b: #Q & { 36 w: { 37 c: int 38 } 39 } 40 #Q: { 41 [string]: { 42 a: int 43 } | { 44 b: int 45 } 46 } 47 c: #R & { 48 w: [{ 49 d: int 50 }, ...] 51 } 52 #R: { 53 [string]: [{ 54 a: int 55 }, { 56 b: int 57 }] 58 } 59 -- out/legacy-debug -- 60 <0>{#S: <1>{[]: <2>(_: string)-><3>C{a: int}, }, a: <4>{[]: <5>(_: string)-><6>C{a: int}, v: _|_(int:field "b" not allowed in closed struct)}, b: <7>{[]: <8>(_: string)->(<9>C{a: int} | <10>C{b: int}), w: _|_(int:empty disjunction: field "c" not allowed in closed struct)}, #Q: <11>{[]: <12>(_: string)->(<13>C{a: int} | <14>C{b: int}), }, c: <15>{[]: <16>(_: string)->[<17>C{a: int},<18>C{b: int}], w: [_|_(int:field "d" not allowed in closed struct),<19>C{b: int}]}, #R: <20>{[]: <21>(_: string)->[<22>C{a: int},<23>C{b: int}], }} 61 -- out/compile -- 62 --- in.cue 63 { 64 #S: { 65 [string]: { 66 a: int 67 } 68 } 69 a: (〈0;#S〉 & { 70 v: { 71 b: int 72 } 73 }) 74 #Q: { 75 [string]: ({ 76 a: int 77 }|{ 78 b: int 79 }) 80 } 81 b: (〈0;#Q〉 & { 82 w: { 83 c: int 84 } 85 }) 86 #R: { 87 [string]: [ 88 { 89 a: int 90 }, 91 { 92 b: int 93 }, 94 ] 95 } 96 c: (〈0;#R〉 & { 97 w: [ 98 { 99 d: int 100 }, 101 ..., 102 ] 103 }) 104 } 105 -- out/eval -- 106 Errors: 107 a.v: field not allowed: b: 108 ./in.cue:2:12 109 ./in.cue:4:4 110 ./in.cue:5:6 111 b.w: 1 errors in empty disjunction: 112 b.w: field not allowed: c: 113 ./in.cue:8:12 114 ./in.cue:10:4 115 ./in.cue:11:6 116 c.w.0: field not allowed: d: 117 ./in.cue:14:12 118 ./in.cue:14:13 119 ./in.cue:16:4 120 ./in.cue:17:7 121 122 Result: 123 (_|_){ 124 // [eval] 125 #S: (#struct){ 126 } 127 a: (_|_){ 128 // [eval] 129 v: (_|_){ 130 // [eval] 131 b: (_|_){ 132 // [eval] a.v: field not allowed: b: 133 // ./in.cue:2:12 134 // ./in.cue:4:4 135 // ./in.cue:5:6 136 } 137 a: (int){ int } 138 } 139 } 140 #Q: (#struct){ 141 } 142 b: (_|_){ 143 // [eval] 144 w: (_|_){ 145 // [eval] b.w: 1 errors in empty disjunction: 146 // b.w: field not allowed: c: 147 // ./in.cue:8:12 148 // ./in.cue:10:4 149 // ./in.cue:11:6 150 c: (_|_){ 151 // [eval] b.w: field not allowed: c: 152 // ./in.cue:8:12 153 // ./in.cue:8:23 154 // ./in.cue:10:4 155 // ./in.cue:11:6 156 } 157 b: (int){ int } 158 } 159 } 160 #R: (#struct){ 161 } 162 c: (_|_){ 163 // [eval] 164 w: (_|_){ 165 // [eval] 166 0: (_|_){ 167 // [eval] 168 d: (_|_){ 169 // [eval] c.w.0: field not allowed: d: 170 // ./in.cue:14:12 171 // ./in.cue:14:13 172 // ./in.cue:16:4 173 // ./in.cue:17:7 174 } 175 a: (int){ int } 176 } 177 1: (#struct){ 178 b: (int){ int } 179 } 180 } 181 } 182 }