cuelang.org/go@v0.13.0/cue/testdata/comprehensions/errors.txtar (about) 1 -- in.cue -- 2 circularIf: { 3 #list: { 4 tail: #list | *null 5 if tail != null { 6 } 7 } 8 } 9 10 circularFor: { 11 #list: { 12 tail: #list | *null 13 for x in tail != null { 14 } 15 } 16 } 17 18 // Print a bit more sensible error message than "empty disjunction" here. 19 // Issue #465 20 userError: { 21 a: string | *_|_ 22 if a != "" { 23 } 24 } 25 26 intField: { 27 for i, _ in [1, 2] { 28 (i): { 29 } 30 } 31 } 32 33 // Issue #2403 34 conflictRangingOverSelf: { 35 x: { 36 name: string 37 age: int 38 } 39 40 x: { 41 for k, _ in x { 42 (k): k 43 } 44 } 45 } 46 -- out/eval/stats -- 47 Leaks: 1 48 Freed: 28 49 Reused: 22 50 Allocs: 7 51 Retain: 1 52 53 Unifications: 19 54 Conjuncts: 40 55 Disjuncts: 29 56 -- out/evalalpha -- 57 Errors: 58 conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 59 ./in.cue:36:9 60 ./in.cue:40:3 61 circularFor.#list: cannot range over tail != null (found bool, want list or struct): 62 ./in.cue:12:12 63 intField: integer fields not supported: 64 ./in.cue:27:4 65 66 Result: 67 (_|_){ 68 // [eval] 69 circularIf: (struct){ 70 #list: (#struct){ 71 tail: (null){ null } 72 } 73 } 74 circularFor: (_|_){ 75 // [eval] 76 #list: (_|_){ 77 // [eval] circularFor.#list: cannot range over tail != null (found bool, want list or struct): 78 // ./in.cue:12:12 79 tail: (null){ null } 80 } 81 } 82 userError: (_|_){ 83 // [incomplete] userError: non-concrete value string in operand to !=: 84 // ./in.cue:21:5 85 // ./in.cue:20:5 86 a: (string){ string } 87 } 88 intField: (_|_){ 89 // [eval] intField: integer fields not supported: 90 // ./in.cue:27:4 91 } 92 conflictRangingOverSelf: (_|_){ 93 // [eval] 94 x: (_|_){ 95 // [eval] 96 name: (string){ "name" } 97 age: (_|_){ 98 // [eval] conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 99 // ./in.cue:36:9 100 // ./in.cue:40:3 101 } 102 } 103 } 104 } 105 -- diff/-out/evalalpha<==>+out/eval -- 106 diff old new 107 --- old 108 +++ new 109 @@ -2,7 +2,6 @@ 110 conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 111 ./in.cue:36:9 112 ./in.cue:40:3 113 - ./in.cue:41:9 114 circularFor.#list: cannot range over tail != null (found bool, want list or struct): 115 ./in.cue:12:12 116 intField: integer fields not supported: 117 @@ -13,9 +12,7 @@ 118 // [eval] 119 circularIf: (struct){ 120 #list: (#struct){ 121 - tail: ((null|struct)){ |(*(null){ null }, (#struct){ 122 - tail: (null){ null } 123 - }) } 124 + tail: (null){ null } 125 } 126 } 127 circularFor: (_|_){ 128 @@ -35,10 +32,6 @@ 129 intField: (_|_){ 130 // [eval] intField: integer fields not supported: 131 // ./in.cue:27:4 132 - 0: (struct){ 133 - } 134 - 1: (struct){ 135 - } 136 } 137 conflictRangingOverSelf: (_|_){ 138 // [eval] 139 @@ -49,7 +42,6 @@ 140 // [eval] conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 141 // ./in.cue:36:9 142 // ./in.cue:40:3 143 - // ./in.cue:41:9 144 } 145 } 146 } 147 -- diff/todo/p2 -- 148 Missing error message. 149 -- out/eval -- 150 Errors: 151 conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 152 ./in.cue:36:9 153 ./in.cue:40:3 154 ./in.cue:41:9 155 circularFor.#list: cannot range over tail != null (found bool, want list or struct): 156 ./in.cue:12:12 157 intField: integer fields not supported: 158 ./in.cue:27:4 159 160 Result: 161 (_|_){ 162 // [eval] 163 circularIf: (struct){ 164 #list: (#struct){ 165 tail: ((null|struct)){ |(*(null){ null }, (#struct){ 166 tail: (null){ null } 167 }) } 168 } 169 } 170 circularFor: (_|_){ 171 // [eval] 172 #list: (_|_){ 173 // [eval] circularFor.#list: cannot range over tail != null (found bool, want list or struct): 174 // ./in.cue:12:12 175 tail: (null){ null } 176 } 177 } 178 userError: (_|_){ 179 // [incomplete] userError: non-concrete value string in operand to !=: 180 // ./in.cue:21:5 181 // ./in.cue:20:5 182 a: (string){ string } 183 } 184 intField: (_|_){ 185 // [eval] intField: integer fields not supported: 186 // ./in.cue:27:4 187 0: (struct){ 188 } 189 1: (struct){ 190 } 191 } 192 conflictRangingOverSelf: (_|_){ 193 // [eval] 194 x: (_|_){ 195 // [eval] 196 name: (string){ "name" } 197 age: (_|_){ 198 // [eval] conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 199 // ./in.cue:36:9 200 // ./in.cue:40:3 201 // ./in.cue:41:9 202 } 203 } 204 } 205 } 206 -- out/compile -- 207 --- in.cue 208 { 209 circularIf: { 210 #list: { 211 tail: (〈1;#list〉|*null) 212 if (〈0;tail〉 != null) {} 213 } 214 } 215 circularFor: { 216 #list: { 217 tail: (〈1;#list〉|*null) 218 for _, x in (〈0;tail〉 != null) {} 219 } 220 } 221 userError: { 222 a: (string|*_|_(explicit error (_|_ literal) in source)) 223 if (〈0;a〉 != "") {} 224 } 225 intField: { 226 for i, _ in [ 227 1, 228 2, 229 ] { 230 〈1;i〉: {} 231 } 232 } 233 conflictRangingOverSelf: { 234 x: { 235 name: string 236 age: int 237 } 238 x: { 239 for k, _ in 〈1;x〉 { 240 〈1;k〉: 〈1;k〉 241 } 242 } 243 } 244 }