cuelang.org/go@v0.10.1/cue/testdata/definitions/037_closing_with_comprehensions.txtar (about) 1 # DO NOT EDIT; generated by go run testdata/gen.go 2 # 3 #name: closing with comprehensions 4 #evalPartial 5 -- in.cue -- 6 #A: {f1: int, f2: int} 7 8 for k, v in {f3: int} { 9 a: #A & {"\(k)": v} 10 } 11 12 #B: { 13 for k, v in {f1: int} { 14 "\(k)": v 15 } 16 } 17 18 #C: { 19 f1: _ 20 for k, v in {f1: int} { 21 "\(k)": v 22 } 23 } 24 25 #D: { 26 for k, v in {f1: int} { 27 "\(k)": v 28 } 29 ... 30 } 31 32 #E: #A & { 33 for k, v in {f3: int} { 34 "\(k)": v 35 } 36 } 37 -- out/def -- 38 #A: { 39 f1: int 40 f2: int 41 } 42 a: _|_ // field "f3" not allowed in closed struct 43 #B: { 44 f1: v 45 } 46 #C: { 47 f1: { 48 _ 49 v 50 ... 51 } 52 } 53 #D: { 54 f1: v 55 ... 56 } 57 #E: _|_ // field "f3" not allowed in closed struct 58 -- out/legacy-debug -- 59 <0>{#A: <1>C{f1: int, f2: int}, a: _|_(<2>.v:field "f3" not allowed in closed struct), #B: <3>C{f1: int}, #C: <4>C{f1: int}, #D: <5>{f1: int, ...}, #E: _|_(<6>.v:field "f3" not allowed in closed struct)} 60 -- out/compile -- 61 --- in.cue 62 { 63 #A: { 64 f1: int 65 f2: int 66 } 67 for k, v in { 68 f3: int 69 } { 70 a: (〈2;#A〉 & { 71 "\(〈2;k〉)": 〈2;v〉 72 }) 73 } 74 #B: { 75 for k, v in { 76 f1: int 77 } { 78 "\(〈1;k〉)": 〈1;v〉 79 } 80 } 81 #C: { 82 f1: _ 83 for k, v in { 84 f1: int 85 } { 86 "\(〈1;k〉)": 〈1;v〉 87 } 88 } 89 #D: { 90 for k, v in { 91 f1: int 92 } { 93 "\(〈1;k〉)": 〈1;v〉 94 } 95 ... 96 } 97 #E: (〈0;#A〉 & { 98 for k, v in { 99 f3: int 100 } { 101 "\(〈1;k〉)": 〈1;v〉 102 } 103 }) 104 } 105 -- out/eval/stats -- 106 Leaks: 10 107 Freed: 18 108 Reused: 15 109 Allocs: 13 110 Retain: 10 111 112 Unifications: 28 113 Conjuncts: 43 114 Disjuncts: 28 115 -- out/evalalpha -- 116 Errors: 117 a.f3: field not allowed: 118 ./in.cue:4:19 119 #E.f3: field not allowed: 120 ./in.cue:29:11 121 122 Result: 123 (_|_){ 124 // [eval] 125 #A: (#struct){ 126 f1: (int){ int } 127 f2: (int){ int } 128 } 129 a: (_|_){ 130 // [eval] 131 f1: (int){ int } 132 f2: (int){ int } 133 f3: (_|_){ 134 // [eval] a.f3: field not allowed: 135 // ./in.cue:4:19 136 } 137 } 138 #B: (#struct){ 139 f1: (int){ int } 140 } 141 #C: (#struct){ 142 f1: (int){ int } 143 } 144 #D: (#struct){ 145 f1: (int){ int } 146 } 147 #E: (_|_){ 148 // [eval] 149 f1: (int){ int } 150 f2: (int){ int } 151 f3: (_|_){ 152 // [eval] #E.f3: field not allowed: 153 // ./in.cue:29:11 154 } 155 } 156 } 157 -- diff/-out/evalalpha<==>+out/eval -- 158 diff old new 159 --- old 160 +++ new 161 @@ -1,15 +1,8 @@ 162 Errors: 163 -#E.f3: field not allowed: 164 - ./in.cue:1:5 165 - ./in.cue:27:5 166 - ./in.cue:27:10 167 - ./in.cue:28:2 168 - ./in.cue:29:3 169 a.f3: field not allowed: 170 - ./in.cue:1:5 171 - ./in.cue:3:1 172 - ./in.cue:4:5 173 - ./in.cue:4:11 174 + ./in.cue:4:19 175 +#E.f3: field not allowed: 176 + ./in.cue:29:11 177 178 Result: 179 (_|_){ 180 @@ -24,10 +17,7 @@ 181 f2: (int){ int } 182 f3: (_|_){ 183 // [eval] a.f3: field not allowed: 184 - // ./in.cue:1:5 185 - // ./in.cue:3:1 186 - // ./in.cue:4:5 187 - // ./in.cue:4:11 188 + // ./in.cue:4:19 189 } 190 } 191 #B: (#struct){ 192 @@ -45,11 +35,7 @@ 193 f2: (int){ int } 194 f3: (_|_){ 195 // [eval] #E.f3: field not allowed: 196 - // ./in.cue:1:5 197 - // ./in.cue:27:5 198 - // ./in.cue:27:10 199 - // ./in.cue:28:2 200 - // ./in.cue:29:3 201 + // ./in.cue:29:11 202 } 203 } 204 } 205 -- diff/todo/p2 -- 206 error positions 207 -- out/eval -- 208 Errors: 209 #E.f3: field not allowed: 210 ./in.cue:1:5 211 ./in.cue:27:5 212 ./in.cue:27:10 213 ./in.cue:28:2 214 ./in.cue:29:3 215 a.f3: field not allowed: 216 ./in.cue:1:5 217 ./in.cue:3:1 218 ./in.cue:4:5 219 ./in.cue:4:11 220 221 Result: 222 (_|_){ 223 // [eval] 224 #A: (#struct){ 225 f1: (int){ int } 226 f2: (int){ int } 227 } 228 a: (_|_){ 229 // [eval] 230 f1: (int){ int } 231 f2: (int){ int } 232 f3: (_|_){ 233 // [eval] a.f3: field not allowed: 234 // ./in.cue:1:5 235 // ./in.cue:3:1 236 // ./in.cue:4:5 237 // ./in.cue:4:11 238 } 239 } 240 #B: (#struct){ 241 f1: (int){ int } 242 } 243 #C: (#struct){ 244 f1: (int){ int } 245 } 246 #D: (#struct){ 247 f1: (int){ int } 248 } 249 #E: (_|_){ 250 // [eval] 251 f1: (int){ int } 252 f2: (int){ int } 253 f3: (_|_){ 254 // [eval] #E.f3: field not allowed: 255 // ./in.cue:1:5 256 // ./in.cue:27:5 257 // ./in.cue:27:10 258 // ./in.cue:28:2 259 // ./in.cue:29:3 260 } 261 } 262 }