cuelang.org/go@v0.10.1/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|struct)){ |(*(null){ null }, (#struct){ 72 tail: (null){ null } 73 }) } 74 } 75 } 76 circularFor: (_|_){ 77 // [eval] 78 #list: (_|_){ 79 // [eval] circularFor.#list: cannot range over tail != null (found bool, want list or struct): 80 // ./in.cue:12:12 81 tail: (null){ null } 82 } 83 } 84 userError: (_|_){ 85 // [incomplete] userError: non-concrete value string in operand to !=: 86 // ./in.cue:21:5 87 // ./in.cue:20:5 88 a: (string){ string } 89 } 90 intField: (_|_){ 91 // [eval] intField: integer fields not supported: 92 // ./in.cue:27:4 93 } 94 conflictRangingOverSelf: (_|_){ 95 // [eval] 96 x: (_|_){ 97 // [eval] 98 name: (string){ "name" } 99 age: (_|_){ 100 // [eval] conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 101 // ./in.cue:36:9 102 // ./in.cue:40:3 103 } 104 } 105 } 106 } 107 -- diff/-out/evalalpha<==>+out/eval -- 108 diff old new 109 --- old 110 +++ new 111 @@ -2,7 +2,6 @@ 112 conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 113 ./in.cue:36:9 114 ./in.cue:40:3 115 - ./in.cue:41:9 116 circularFor.#list: cannot range over tail != null (found bool, want list or struct): 117 ./in.cue:12:12 118 intField: integer fields not supported: 119 @@ -35,10 +34,6 @@ 120 intField: (_|_){ 121 // [eval] intField: integer fields not supported: 122 // ./in.cue:27:4 123 - 0: (struct){ 124 - } 125 - 1: (struct){ 126 - } 127 } 128 conflictRangingOverSelf: (_|_){ 129 // [eval] 130 @@ -49,7 +44,6 @@ 131 // [eval] conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 132 // ./in.cue:36:9 133 // ./in.cue:40:3 134 - // ./in.cue:41:9 135 } 136 } 137 } 138 -- diff/todo/p2 -- 139 Missing error message. 140 -- out/eval -- 141 Errors: 142 conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 143 ./in.cue:36:9 144 ./in.cue:40:3 145 ./in.cue:41:9 146 circularFor.#list: cannot range over tail != null (found bool, want list or struct): 147 ./in.cue:12:12 148 intField: integer fields not supported: 149 ./in.cue:27:4 150 151 Result: 152 (_|_){ 153 // [eval] 154 circularIf: (struct){ 155 #list: (#struct){ 156 tail: ((null|struct)){ |(*(null){ null }, (#struct){ 157 tail: (null){ null } 158 }) } 159 } 160 } 161 circularFor: (_|_){ 162 // [eval] 163 #list: (_|_){ 164 // [eval] circularFor.#list: cannot range over tail != null (found bool, want list or struct): 165 // ./in.cue:12:12 166 tail: (null){ null } 167 } 168 } 169 userError: (_|_){ 170 // [incomplete] userError: non-concrete value string in operand to !=: 171 // ./in.cue:21:5 172 // ./in.cue:20:5 173 a: (string){ string } 174 } 175 intField: (_|_){ 176 // [eval] intField: integer fields not supported: 177 // ./in.cue:27:4 178 0: (struct){ 179 } 180 1: (struct){ 181 } 182 } 183 conflictRangingOverSelf: (_|_){ 184 // [eval] 185 x: (_|_){ 186 // [eval] 187 name: (string){ "name" } 188 age: (_|_){ 189 // [eval] conflictRangingOverSelf.x.age: conflicting values int and "age" (mismatched types int and string): 190 // ./in.cue:36:9 191 // ./in.cue:40:3 192 // ./in.cue:41:9 193 } 194 } 195 } 196 } 197 -- out/compile -- 198 --- in.cue 199 { 200 circularIf: { 201 #list: { 202 tail: (〈1;#list〉|*null) 203 if (〈0;tail〉 != null) {} 204 } 205 } 206 circularFor: { 207 #list: { 208 tail: (〈1;#list〉|*null) 209 for _, x in (〈0;tail〉 != null) {} 210 } 211 } 212 userError: { 213 a: (string|*_|_(explicit error (_|_ literal) in source)) 214 if (〈0;a〉 != "") {} 215 } 216 intField: { 217 for i, _ in [ 218 1, 219 2, 220 ] { 221 〈1;i〉: {} 222 } 223 } 224 conflictRangingOverSelf: { 225 x: { 226 name: string 227 age: int 228 } 229 x: { 230 for k, _ in 〈1;x〉 { 231 〈1;k〉: 〈1;k〉 232 } 233 } 234 } 235 }