this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal/core/adt: record more error positions

Method: replace `ctx.Str(x)` arguments to formatting
with `x` and let the error methods do the conversion.
This gives access to position information as well, which
can then be added to the errors.

This has the additional benefit that this will allow lazy
expansion of error printing down the road.

Note that in some cases we now drop the "main"
position as it would result in too much redundancy.
In tests this manifests itself as a slight change of
the column position.

Fixes #905
Closes #129

Issue #52

Change-Id: I044cf34b9718f05553139974c6c166d2630568e6
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9446
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>

+241 -96
+4
cue/testdata/basicrewrite/001_regexp.txtar
··· 74 74 ./in.cue:11:5 75 75 e1: cannot use 1 (type int) as type (string|bytes): 76 76 ./in.cue:20:5 77 + ./in.cue:20:14 77 78 e2: cannot use true (type bool) as type (string|bytes): 78 79 ./in.cue:21:5 80 + ./in.cue:21:14 79 81 80 82 Result: 81 83 (_|_){ ··· 99 101 e1: (_|_){ 100 102 // [eval] e1: cannot use 1 (type int) as type (string|bytes): 101 103 // ./in.cue:20:5 104 + // ./in.cue:20:14 102 105 } 103 106 e2: (_|_){ 104 107 // [eval] e2: cannot use true (type bool) as type (string|bytes): 105 108 // ./in.cue:21:5 109 + // ./in.cue:21:14 106 110 } 107 111 e3: (_|_){ 108 112 // [eval] e3: conflicting values !="a" and <5 (mismatched types string and number):
+10
cue/testdata/basicrewrite/002_arithmetic.txtar
··· 109 109 ./in.cue:16:9 110 110 e0: invalid operands 2 and "a" to '+' (type int and string): 111 111 ./in.cue:23:5 112 + ./in.cue:23:9 112 113 e5: invalid operands 1.0 and 2 to 'div' (type float and int): 113 114 ./in.cue:29:5 115 + ./in.cue:29:13 114 116 e6: invalid operands 2 and 2.0 to 'rem' (type int and float): 115 117 ./in.cue:30:5 118 + ./in.cue:30:11 116 119 e7: invalid operands 2 and 2.0 to 'quo' (type int and float): 117 120 ./in.cue:31:5 121 + ./in.cue:31:11 118 122 e8: invalid operands 1.0 and 1 to 'mod' (type float and int): 119 123 ./in.cue:32:5 124 + ./in.cue:32:13 120 125 121 126 Result: 122 127 (_|_){ ··· 160 165 e0: (_|_){ 161 166 // [eval] e0: invalid operands 2 and "a" to '+' (type int and string): 162 167 // ./in.cue:23:5 168 + // ./in.cue:23:9 163 169 } 164 170 e5: (_|_){ 165 171 // [eval] e5: invalid operands 1.0 and 2 to 'div' (type float and int): 166 172 // ./in.cue:29:5 173 + // ./in.cue:29:13 167 174 } 168 175 e6: (_|_){ 169 176 // [eval] e6: invalid operands 2 and 2.0 to 'rem' (type int and float): 170 177 // ./in.cue:30:5 178 + // ./in.cue:30:11 171 179 } 172 180 e7: (_|_){ 173 181 // [eval] e7: invalid operands 2 and 2.0 to 'quo' (type int and float): 174 182 // ./in.cue:31:5 183 + // ./in.cue:31:11 175 184 } 176 185 e8: (_|_){ 177 186 // [eval] e8: invalid operands 1.0 and 1 to 'mod' (type float and int): 178 187 // ./in.cue:32:5 188 + // ./in.cue:32:13 179 189 } 180 190 }
+16
cue/testdata/basicrewrite/003_integer-specific_arithmetic.txtar
··· 89 89 Errors: 90 90 qe1: invalid operands 2.0 and 1 to 'quo' (type float and int): 91 91 ./in.cue:5:6 92 + ./in.cue:5:14 92 93 qe2: invalid operands 2 and 1.0 to 'quo' (type int and float): 93 94 ./in.cue:6:6 95 + ./in.cue:6:12 94 96 re1: invalid operands 2.0 and 1 to 'rem' (type float and int): 95 97 ./in.cue:12:6 98 + ./in.cue:12:14 96 99 re2: invalid operands 2 and 1.0 to 'rem' (type int and float): 97 100 ./in.cue:13:6 101 + ./in.cue:13:12 98 102 de1: invalid operands 2.0 and 1 to 'div' (type float and int): 99 103 ./in.cue:19:6 104 + ./in.cue:19:14 100 105 de2: invalid operands 2 and 1.0 to 'div' (type int and float): 101 106 ./in.cue:20:6 107 + ./in.cue:20:12 102 108 me1: invalid operands 2.0 and 1 to 'mod' (type float and int): 103 109 ./in.cue:26:6 110 + ./in.cue:26:14 104 111 me2: invalid operands 2 and 1.0 to 'mod' (type int and float): 105 112 ./in.cue:27:6 113 + ./in.cue:27:12 106 114 107 115 Result: 108 116 (_|_){ ··· 114 122 qe1: (_|_){ 115 123 // [eval] qe1: invalid operands 2.0 and 1 to 'quo' (type float and int): 116 124 // ./in.cue:5:6 125 + // ./in.cue:5:14 117 126 } 118 127 qe2: (_|_){ 119 128 // [eval] qe2: invalid operands 2 and 1.0 to 'quo' (type int and float): 120 129 // ./in.cue:6:6 130 + // ./in.cue:6:12 121 131 } 122 132 r1: (int){ 1 } 123 133 r2: (int){ 1 } ··· 126 136 re1: (_|_){ 127 137 // [eval] re1: invalid operands 2.0 and 1 to 'rem' (type float and int): 128 138 // ./in.cue:12:6 139 + // ./in.cue:12:14 129 140 } 130 141 re2: (_|_){ 131 142 // [eval] re2: invalid operands 2 and 1.0 to 'rem' (type int and float): 132 143 // ./in.cue:13:6 144 + // ./in.cue:13:12 133 145 } 134 146 d1: (int){ 2 } 135 147 d2: (int){ -2 } ··· 138 150 de1: (_|_){ 139 151 // [eval] de1: invalid operands 2.0 and 1 to 'div' (type float and int): 140 152 // ./in.cue:19:6 153 + // ./in.cue:19:14 141 154 } 142 155 de2: (_|_){ 143 156 // [eval] de2: invalid operands 2 and 1.0 to 'div' (type int and float): 144 157 // ./in.cue:20:6 158 + // ./in.cue:20:12 145 159 } 146 160 m1: (int){ 1 } 147 161 m2: (int){ 1 } ··· 150 164 me1: (_|_){ 151 165 // [eval] me1: invalid operands 2.0 and 1 to 'mod' (type float and int): 152 166 // ./in.cue:26:6 167 + // ./in.cue:26:14 153 168 } 154 169 me2: (_|_){ 155 170 // [eval] me2: invalid operands 2 and 1.0 to 'mod' (type int and float): 156 171 // ./in.cue:27:6 172 + // ./in.cue:27:12 157 173 } 158 174 }
+4
cue/testdata/basicrewrite/007_strings_and_bytes.txtar
··· 43 43 Errors: 44 44 e0: invalid operands "a" and '' to '+' (type string and bytes): 45 45 ./in.cue:10:5 46 + ./in.cue:10:11 46 47 e1: invalid operands 'b' and "c" to '+' (type bytes and string): 47 48 ./in.cue:11:5 49 + ./in.cue:11:11 48 50 49 51 Result: 50 52 (_|_){ ··· 58 60 e0: (_|_){ 59 61 // [eval] e0: invalid operands "a" and '' to '+' (type string and bytes): 60 62 // ./in.cue:10:5 63 + // ./in.cue:10:11 61 64 } 62 65 e1: (_|_){ 63 66 // [eval] e1: invalid operands 'b' and "c" to '+' (type bytes and string): 64 67 // ./in.cue:11:5 68 + // ./in.cue:11:11 65 69 } 66 70 }
+2
cue/testdata/basicrewrite/010_lists.txtar
··· 83 83 ./in.cue:5:12 84 84 e3: invalid index -1 (index must be non-negative): 85 85 ./in.cue:6:8 86 + ./in.cue:6:12 86 87 e4.3: invalid value 8 (out of bound <=5): 87 88 ./in.cue:7:24 88 89 ./in.cue:7:41 ··· 116 117 e3: (_|_){ 117 118 // [eval] e3: invalid index -1 (index must be non-negative): 118 119 // ./in.cue:6:8 120 + // ./in.cue:6:12 119 121 } 120 122 e4: (_|_){ 121 123 // [eval]
+3 -3
cue/testdata/basicrewrite/015_types.txtar
··· 39 39 } 40 40 -- out/eval -- 41 41 Errors: 42 + b: invalid operand int ('!' requires concrete value): 43 + ./in.cue:7:6 42 44 e: conflicting values int and string (mismatched types int and string): 43 45 ./in.cue:5:5 44 46 ./in.cue:5:11 45 47 e2: conflicting values 1 and string (mismatched types int and string): 46 48 ./in.cue:6:5 47 49 ./in.cue:6:9 48 - b: invalid operand int ('!' requires concrete value): 49 - ./in.cue:7:5 50 50 p: invalid operation +true (+ bool): 51 51 ./in.cue:8:5 52 52 m: invalid operation -false (- bool): ··· 71 71 } 72 72 b: (_|_){ 73 73 // [eval] b: invalid operand int ('!' requires concrete value): 74 - // ./in.cue:7:5 74 + // ./in.cue:7:6 75 75 } 76 76 p: (_|_){ 77 77 // [eval] p: invalid operation +true (+ bool):
+2
cue/testdata/basicrewrite/016_comparison.txtar
··· 40 40 Errors: 41 41 err: invalid operands 2 and "s" to '==' (type int and string): 42 42 ./in.cue:9:6 43 + ./in.cue:9:11 43 44 44 45 Result: 45 46 (_|_){ ··· 54 55 err: (_|_){ 55 56 // [eval] err: invalid operands 2 and "s" to '==' (type int and string): 56 57 // ./in.cue:9:6 58 + // ./in.cue:9:11 57 59 } 58 60 }
+2
cue/testdata/builtins/all.txtar
··· 22 22 Errors: 23 23 fatalArg.x: invalid operands "eee" and 'eee' to '+' (type string and bytes): 24 24 ./in.cue:3:12 25 + ./in.cue:3:20 25 26 0.a: undefined field c: 26 27 ./in.cue:9:20 27 28 ··· 33 34 x: (_|_){ 34 35 // [eval] fatalArg.x: invalid operands "eee" and 'eee' to '+' (type string and bytes): 35 36 // ./in.cue:3:12 37 + // ./in.cue:3:20 36 38 } 37 39 } 38 40 fatalChild: (_|_){
+9
cue/testdata/builtins/incomplete.txtar
··· 95 95 ./in.cue:77:8 96 96 badListError.x: invalid operands 2 and "foo" to '+' (type int and string): 97 97 ./in.cue:83:8 98 + ./in.cue:84:8 98 99 99 100 Result: 100 101 (_|_){ ··· 194 195 transformed: (_|_){ 195 196 // [incomplete] incompleteArgStringList.#a.transformed: non-concrete value string in operand to +: 196 197 // ./in.cue:58:22 198 + // ./in.cue:57:9 197 199 } 198 200 joined: (_|_){ 199 201 // [incomplete] 0: non-concrete value string in operand to +: 200 202 // ./in.cue:58:22 203 + // ./in.cue:57:9 201 204 } 202 205 } 203 206 } ··· 216 219 x: (_|_){ 217 220 // [incomplete] incompleteListError.x: non-concrete value _ in operand to +: 218 221 // ./in.cue:70:8 222 + // ./in.cue:71:5 219 223 } 220 224 y: (_){ _ } 221 225 decimal: (_|_){ 222 226 // [incomplete] incompleteListError.x: non-concrete value _ in operand to +: 223 227 // ./in.cue:70:8 228 + // ./in.cue:71:5 224 229 } 225 230 str: (_|_){ 226 231 // [incomplete] incompleteListError.x: non-concrete value _ in operand to +: 227 232 // ./in.cue:70:8 233 + // ./in.cue:71:5 228 234 } 229 235 } 230 236 badListType: (_|_){ ··· 244 250 x: (_|_){ 245 251 // [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string): 246 252 // ./in.cue:83:8 253 + // ./in.cue:84:8 247 254 } 248 255 y: (string){ "foo" } 249 256 decimal: (_|_){ 250 257 // [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string): 251 258 // ./in.cue:83:8 259 + // ./in.cue:84:8 252 260 } 253 261 str: (_|_){ 254 262 // [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string): 255 263 // ./in.cue:83:8 264 + // ./in.cue:84:8 256 265 } 257 266 } 258 267 }
+8 -2
cue/testdata/builtins/issue299.txtar
··· 5 5 x: ["x","x"] 6 6 -- out/eval -- 7 7 Errors: 8 - x: invalid value ["x","x"] (does not satisfy list.UniqueItems) 8 + x: invalid value ["x","x"] (does not satisfy list.UniqueItems): 9 + ./in.cue:2:1 10 + ./in.cue:3:1 11 + ./in.cue:4:1 9 12 10 13 Result: 11 14 (_|_){ 12 15 // [eval] 13 16 x: (_|_){ 14 - // [eval] x: invalid value ["x","x"] (does not satisfy list.UniqueItems) 17 + // [eval] x: invalid value ["x","x"] (does not satisfy list.UniqueItems): 18 + // ./in.cue:2:1 19 + // ./in.cue:3:1 20 + // ./in.cue:4:1 15 21 0: (string){ "x" } 16 22 1: (string){ "x" } 17 23 }
+4
cue/testdata/builtins/validators.txtar
··· 125 125 kv: (_|_){ 126 126 // [incomplete] incompleteError2.MyType.kv: invalid value {} (does not satisfy struct.MinFields(1)): len(fields) < MinFields(1) (0 < 1): 127 127 // ./in.cue:22:17 128 + // ./in.cue:21:13 129 + // ./in.cue:22:13 128 130 // ./in.cue:22:34 129 131 } 130 132 } ··· 148 150 kv: (_|_){ 149 151 // [incomplete] violation.#MyType.kv: invalid value {} (does not satisfy struct.MinFields(1)): len(fields) < MinFields(1) (0 < 1): 150 152 // ./in.cue:49:17 153 + // ./in.cue:48:13 154 + // ./in.cue:49:13 151 155 // ./in.cue:49:34 152 156 } 153 157 }
+1
cue/testdata/comprehensions/errors.txtar
··· 48 48 userError: (_|_){ 49 49 // [incomplete] userError: non-concrete value string in operand to !=: 50 50 // ./in.cue:21:8 51 + // ./in.cue:20:5 51 52 a: (string){ string } 52 53 } 53 54 }
+2
cue/testdata/comprehensions/iferror.txtar
··· 114 114 Errors: 115 115 wrongConcreteType: cannot use 2 (type int) as type bool: 116 116 ./in.cue:4:2 117 + ./in.cue:1:9 117 118 wrongType: cannot use int (type int) as type bool: 118 119 ./in.cue:10:2 119 120 ··· 127 128 wrongConcreteType: (_|_){ 128 129 // [eval] wrongConcreteType: cannot use 2 (type int) as type bool: 129 130 // ./in.cue:4:2 131 + // ./in.cue:1:9 130 132 } 131 133 wrongType: (_|_){ 132 134 // [eval] wrongType: cannot use int (type int) as type bool:
+6
cue/testdata/cycle/023_reentrance.txtar
··· 91 91 out: (_|_){ 92 92 // [incomplete] non-concrete value int in operand to >=: 93 93 // ./in.cue:7:5 94 + // ./in.cue:3:32 95 + // ./in.cue:5:2 94 96 // non-concrete value int in operand to <: 95 97 // ./in.cue:10:5 98 + // ./in.cue:3:32 99 + // ./in.cue:5:2 96 100 } 97 101 } 98 102 fib: (_|_){ 99 103 // [incomplete] fib: non-concrete value int in operand to >=: 100 104 // ./in.cue:7:5 105 + // ./in.cue:5:2 101 106 // fib: non-concrete value int in operand to <: 102 107 // ./in.cue:10:5 108 + // ./in.cue:5:2 103 109 n: (int){ int } 104 110 } 105 111 fib2: (int){ 1 }
+26
cue/testdata/disjunctions/elimination.txtar
··· 264 264 a: (_|_){ 265 265 // [incomplete] nestedNonMonotonic.incomplete.a.n1.p1.x.a: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2): 266 266 // ./in.cue:84:13 267 + // ./in.cue:84:10 267 268 // ./in.cue:84:30 269 + // ./in.cue:85:10 268 270 c: (int){ 1 } 269 271 } 270 272 }, (null){ null }) } ··· 274 276 a: (_|_){ 275 277 // [incomplete] nestedNonMonotonic.incomplete.a.n1.p2.x.a: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2): 276 278 // ./in.cue:90:13 279 + // ./in.cue:89:10 280 + // ./in.cue:90:10 277 281 // ./in.cue:90:30 278 282 c: (int){ 1 } 279 283 } ··· 287 291 b: (_|_){ 288 292 // [incomplete] nestedNonMonotonic.incomplete.a.n2.p1.x.a.b: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2): 289 293 // ./in.cue:94:16 294 + // ./in.cue:94:13 290 295 // ./in.cue:94:33 296 + // ./in.cue:95:13 291 297 c: (int){ 1 } 292 298 } 293 299 } ··· 299 305 b: (_|_){ 300 306 // [incomplete] nestedNonMonotonic.incomplete.a.n2.p2.x.a.b: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2): 301 307 // ./in.cue:100:16 308 + // ./in.cue:99:13 309 + // ./in.cue:100:13 302 310 // ./in.cue:100:33 303 311 c: (int){ 1 } 304 312 } ··· 314 322 a: (_|_){ 315 323 // [incomplete] nestedNonMonotonic.incomplete.b.n1.p1.x.a: invalid value {c:1,d:1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): 316 324 // ./in.cue:105:13 325 + // ./in.cue:105:10 317 326 // ./in.cue:105:30 327 + // ./in.cue:106:10 328 + // ./in.cue:107:10 318 329 c: (int){ 1 } 319 330 d: (int){ 1 } 320 331 } ··· 325 336 a: (_|_){ 326 337 // [incomplete] nestedNonMonotonic.incomplete.b.n1.p2.x.a: invalid value {c:1,d:1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): 327 338 // ./in.cue:112:13 339 + // ./in.cue:111:10 340 + // ./in.cue:112:10 328 341 // ./in.cue:112:30 342 + // ./in.cue:113:10 329 343 c: (int){ 1 } 330 344 d: (int){ 1 } 331 345 } ··· 336 350 a: (_|_){ 337 351 // [incomplete] nestedNonMonotonic.incomplete.b.n1.p3.x.a: invalid value {c:1,d:1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): 338 352 // ./in.cue:119:13 353 + // ./in.cue:117:10 354 + // ./in.cue:118:10 355 + // ./in.cue:119:10 339 356 // ./in.cue:119:30 340 357 c: (int){ 1 } 341 358 d: (int){ 1 } ··· 350 367 b: (_|_){ 351 368 // [incomplete] nestedNonMonotonic.incomplete.b.n2.p1.x.a.b: invalid value {c:1,d:1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): 352 369 // ./in.cue:137:16 370 + // ./in.cue:123:13 371 + // ./in.cue:124:13 372 + // ./in.cue:125:13 373 + // ./in.cue:129:13 374 + // ./in.cue:130:13 375 + // ./in.cue:131:13 376 + // ./in.cue:135:13 377 + // ./in.cue:136:13 378 + // ./in.cue:137:13 353 379 // ./in.cue:137:33 354 380 c: (int){ 1 } 355 381 d: (int){ 1 }
+1
cue/testdata/disjunctions/errors.txtar
··· 126 126 explicitDefaultError: (_|_){ 127 127 // [incomplete] explicitDefaultError: non-concrete value string in operand to !=: 128 128 // ./in.cue:30:8 129 + // ./in.cue:28:5 129 130 a: (string){ string } 130 131 } 131 132 }
+6 -6
cue/testdata/eval/bounds.txtar
··· 119 119 basic5: (bytes){ bytes } 120 120 bne1: (_|_){ 121 121 // [incomplete] simplifyExpr.bne1: non-concrete value s for bound !=: 122 - // ./in.cue:55:11 122 + // ./in.cue:55:14 123 123 } 124 124 bne2: (_|_){ 125 125 // [incomplete] simplifyExpr.bne2: non-concrete value n for bound !=: 126 - // ./in.cue:56:11 126 + // ./in.cue:56:14 127 127 } 128 128 bne3: (_|_){ 129 129 // [incomplete] simplifyExpr.bne3: non-concrete value n for bound !=: 130 - // ./in.cue:57:11 130 + // ./in.cue:57:14 131 131 } 132 132 bne4: (_|_){ 133 133 // [incomplete] simplifyExpr.bne4: non-concrete value i for bound !=: 134 - // ./in.cue:58:11 134 + // ./in.cue:58:14 135 135 } 136 136 bne5: (_|_){ 137 137 // [incomplete] simplifyExpr.bne5: non-concrete value b for bound !=: 138 - // ./in.cue:59:11 138 + // ./in.cue:59:14 139 139 } 140 140 e1: (_|_){ 141 141 // [incomplete] simplifyExpr.e1: non-concrete value =~"foo" for bound <: 142 - // ./in.cue:61:9 142 + // ./in.cue:61:11 143 143 } 144 144 e2: (_|_){ 145 145 // [eval] simplifyExpr.e2: cannot use null for bound >:
+3
cue/testdata/eval/incomplete.txtar
··· 24 24 e1: (_|_){ 25 25 // [incomplete] e1: non-concrete value string in operand to +: 26 26 // ./in.cue:3:5 27 + // ./in.cue:1:1 27 28 } 28 29 e2: (string){ >"bar" } 29 30 e3: (string){ "foo" } ··· 31 32 e4: (_|_){ 32 33 // [incomplete] e1: non-concrete value string in operand to +: 33 34 // ./in.cue:3:5 35 + // ./in.cue:1:1 34 36 } 35 37 e5: (_|_){ 36 38 // [cycle] cycle error ··· 55 57 okay: (_|_){ 56 58 // [incomplete] okay: non-concrete value >10 & int in operand to +: 57 59 // ./in.cue:18:7 60 + // ./in.cue:18:8 58 61 } 59 62 } 60 63 -- out/compile --
+1
cue/testdata/eval/resolve_basic.txtar
··· 18 18 y: (_|_){ 19 19 // [incomplete] d.y: non-concrete value _ in operand to +: 20 20 // ./in.cue:5:6 21 + // ./in.cue:4:3 21 22 } 22 23 } 23 24 e: (struct){
+1
cue/testdata/eval/selectors.txtar
··· 25 25 y: (_|_){ 26 26 // [incomplete] d.y: non-concrete value _ in operand to +: 27 27 // ./in.cue:5:6 28 + // ./in.cue:4:3 28 29 } 29 30 } 30 31 e: (struct){
+1
cue/testdata/fulleval/005_conditional_field.txtar
··· 63 63 d: (_|_){ 64 64 // [incomplete] d: non-concrete value int in operand to >: 65 65 // ./in.cue:14:5 66 + // ./in.cue:13:2 66 67 a: (int){ int } 67 68 } 68 69 a: (string){ "foo" }
+1
cue/testdata/fulleval/018_recursive_evaluation_within_list.txtar
··· 88 88 d: (_|_){ 89 89 // [incomplete] b1.d: non-concrete value string in operand to +: 90 90 // ./in.cue:10:5 91 + // ./in.cue:11:2 91 92 } 92 93 c: (string){ string } 93 94 }
+2
cue/testdata/fulleval/020_complex_interaction_of_groundness.txtar
··· 74 74 s: (_|_){ 75 75 // [incomplete] a.b.c.s: non-concrete value string in operand to +: 76 76 // ./in.cue:4:34 77 + // ./in.cue:4:20 78 + // ./in.cue:5:10 77 79 } 78 80 } 79 81 }
+14
cue/testdata/fulleval/021_complex_groundness_2.txtar
··· 85 85 s: (_|_){ 86 86 // [incomplete] f1.res.s: non-concrete value string in operand to +: 87 87 // ./in.cue:5:25 88 + // ./in.cue:3:31 89 + // ./in.cue:5:11 90 + // ./in.cue:6:20 91 + // ./in.cue:7:10 88 92 // f1.res.s: non-concrete value string in operand to +: 89 93 // ./in.cue:6:34 94 + // ./in.cue:3:31 95 + // ./in.cue:5:11 96 + // ./in.cue:6:20 97 + // ./in.cue:7:10 90 98 } 91 99 } 92 100 } ··· 97 105 s: (_|_){ 98 106 // [incomplete] a.b.c.s: non-concrete value string in operand to +: 99 107 // ./in.cue:5:25 108 + // ./in.cue:5:11 109 + // ./in.cue:6:20 110 + // ./in.cue:7:10 100 111 // a.b.c.s: non-concrete value string in operand to +: 101 112 // ./in.cue:6:34 113 + // ./in.cue:5:11 114 + // ./in.cue:6:20 115 + // ./in.cue:7:10 102 116 } 103 117 } 104 118 }
+4
cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar
··· 65 65 n4: (_|_){ 66 66 // [incomplete] n4: non-concrete value <4 in operand to +: 67 67 // ./in.cue:6:5 68 + // ./in.cue:18:6 68 69 } 69 70 n5: (_|_){ 70 71 // [incomplete] n5: non-concrete value <4 in operand to -: 71 72 // ./in.cue:7:5 73 + // ./in.cue:18:6 72 74 } 73 75 n6: (_|_){ 74 76 // [incomplete] n6: non-concrete value <4 in operand to *: 75 77 // ./in.cue:8:5 78 + // ./in.cue:18:6 76 79 } 77 80 n7: (_|_){ 78 81 // [incomplete] n7: non-concrete value <4 in operand to /: 79 82 // ./in.cue:9:5 83 + // ./in.cue:18:6 80 84 } 81 85 b1: (_|_){ 82 86 // [incomplete] b1: operand is of '!' not concrete (was bool):
+2
cue/testdata/references/incomplete.txtar
··· 34 34 Errors: 35 35 incompleteIndex.a: invalid index top (invalid type _): 36 36 ./in.cue:29:8 37 + ./in.cue:29:12 37 38 38 39 Result: 39 40 (_|_){ ··· 78 79 a: (_|_){ 79 80 // [eval] incompleteIndex.a: invalid index top (invalid type _): 80 81 // ./in.cue:29:8 82 + // ./in.cue:29:12 81 83 } 82 84 } 83 85 }
+8
cue/testdata/references/index.txtar
··· 43 43 ./in.cue:17:20 44 44 booleanIndex: invalid index true (invalid type bool): 45 45 ./in.cue:18:15 46 + ./in.cue:18:18 46 47 indexOutOfBounds3: invalid list index 4 (out of bounds): 47 48 ./in.cue:19:30 48 49 negativeIndex: invalid index -1 (index must be non-negative): 49 50 ./in.cue:20:16 51 + ./in.cue:20:26 50 52 varIndexTooLarge.a: index out of range [3] with length 3: 51 53 ./in.cue:24:18 52 54 varNegativeIndex.a: index n out of range [-1]: 53 55 ./in.cue:29:8 56 + ./in.cue:28:8 57 + ./in.cue:29:18 54 58 55 59 Result: 56 60 (_|_){ ··· 87 91 booleanIndex: (_|_){ 88 92 // [eval] booleanIndex: invalid index true (invalid type bool): 89 93 // ./in.cue:18:15 94 + // ./in.cue:18:18 90 95 } 91 96 indexOutOfBounds3: (_|_){ 92 97 // [eval] indexOutOfBounds3: invalid list index 4 (out of bounds): ··· 95 100 negativeIndex: (_|_){ 96 101 // [eval] negativeIndex: invalid index -1 (index must be non-negative): 97 102 // ./in.cue:20:16 103 + // ./in.cue:20:26 98 104 } 99 105 varIndexTooLarge: (_|_){ 100 106 // [eval] ··· 110 116 a: (_|_){ 111 117 // [eval] varNegativeIndex.a: index n out of range [-1]: 112 118 // ./in.cue:29:8 119 + // ./in.cue:28:8 120 + // ./in.cue:29:18 113 121 } 114 122 } 115 123 }
+6
cue/testdata/resolve/016_index.txtar
··· 103 103 ./in.cue:7:5 104 104 e3: invalid index true (invalid type bool): 105 105 ./in.cue:8:5 106 + ./in.cue:8:8 106 107 e4: index out of range [3] with length 3: 107 108 ./in.cue:9:15 108 109 e5: invalid index -1 (index must be non-negative): 109 110 ./in.cue:10:5 111 + ./in.cue:10:15 110 112 e6: invalid list index 1 (out of bounds): 111 113 ./in.cue:11:16 112 114 e7: index out of range [3] with length 3: 113 115 ./in.cue:12:15 114 116 e8: invalid index -1 (index must be non-negative): 115 117 ./in.cue:13:5 118 + ./in.cue:13:15 116 119 e9: invalid list index 1 (out of bounds): 117 120 ./in.cue:14:16 118 121 ··· 142 145 e3: (_|_){ 143 146 // [eval] e3: invalid index true (invalid type bool): 144 147 // ./in.cue:8:5 148 + // ./in.cue:8:8 145 149 } 146 150 e4: (_|_){ 147 151 // [eval] e4: index out of range [3] with length 3: ··· 150 154 e5: (_|_){ 151 155 // [eval] e5: invalid index -1 (index must be non-negative): 152 156 // ./in.cue:10:5 157 + // ./in.cue:10:15 153 158 } 154 159 e6: (_|_){ 155 160 // [eval] e6: invalid list index 1 (out of bounds): ··· 162 167 e8: (_|_){ 163 168 // [eval] e8: invalid index -1 (index must be non-negative): 164 169 // ./in.cue:13:5 170 + // ./in.cue:13:15 165 171 } 166 172 e9: (_|_){ 167 173 // [eval] e9: invalid list index 1 (out of bounds):
+4
cue/testdata/resolve/018_slice.txtar
··· 65 65 ./in.cue:7:5 66 66 e6: cannot use "" (type string) as type int in slice index: 67 67 ./in.cue:8:5 68 + ./in.cue:8:9 68 69 e7: cannot use "9" (type string) as type int in slice index: 69 70 ./in.cue:9:5 71 + ./in.cue:9:10 70 72 71 73 Result: 72 74 (_|_){ ··· 98 100 e6: (_|_){ 99 101 // [eval] e6: cannot use "" (type string) as type int in slice index: 100 102 // ./in.cue:8:5 103 + // ./in.cue:8:9 101 104 } 102 105 e7: (_|_){ 103 106 // [eval] e7: cannot use "9" (type string) as type int in slice index: 104 107 // ./in.cue:9:5 108 + // ./in.cue:9:10 105 109 } 106 110 }
+3
cue/testdata/resolve/024_structs.txtar
··· 55 55 d: (_|_){ 56 56 // [incomplete] t.d: non-concrete value number in operand to *: 57 57 // ./in.cue:3:19 58 + // ./in.cue:3:5 58 59 } 59 60 } 60 61 ti: (struct){ ··· 62 63 d: (_|_){ 63 64 // [incomplete] ti.d: non-concrete value int in operand to *: 64 65 // ./in.cue:3:19 66 + // ./in.cue:3:5 67 + // ./in.cue:4:10 65 68 } 66 69 } 67 70 }
+5
cue/testdata/resolve/039_reference_to_root.txtar
··· 87 87 d: (_|_){ 88 88 // [incomplete] c.d: non-concrete value int in operand to +: 89 89 // ./in.cue:4:5 90 + // ./in.cue:1:5 90 91 } 91 92 } 92 93 x: (struct){ ··· 94 95 c: (_|_){ 95 96 // [incomplete] x.c: non-concrete value int in operand to +: 96 97 // ./in.cue:8:5 98 + // ./in.cue:7:2 97 99 } 98 100 } 99 101 y: (struct){ ··· 105 107 c: (_|_){ 106 108 // [incomplete] v.c: non-concrete value int in operand to +: 107 109 // ./in.cue:16:5 110 + // ./in.cue:15:2 108 111 } 109 112 } 110 113 w: (struct){ ··· 112 115 c: (_|_){ 113 116 // [incomplete] w.c: non-concrete value int in operand to +: 114 117 // ./in.cue:16:5 118 + // ./in.cue:15:2 115 119 } 116 120 } 117 121 wp: (struct){ ··· 119 123 c: (_|_){ 120 124 // [incomplete] wp.c: non-concrete value int in operand to +: 121 125 // ./in.cue:16:5 126 + // ./in.cue:15:2 122 127 } 123 128 } 124 129 }
+2
cue/testdata/scalars/embed.txtar
··· 166 166 out: (_|_){ 167 167 // [incomplete] outPattern.sum.out: non-concrete value int in operand to +: 168 168 // ./in.cue:44:14 169 + // ./in.cue:45:9 169 170 } 170 171 #a: (int){ int } 171 172 #b: (int){ int } ··· 180 181 sum: (_|_){ 181 182 // [incomplete] arithmetic.sum: non-concrete value int in operand to +: 182 183 // ./in.cue:53:9 184 + // ./in.cue:54:9 183 185 #a: (int){ int } 184 186 #b: (int){ int } 185 187 }
+1 -1
internal/core/adt/adt.go
··· 54 54 default: 55 55 // Unknown type. 56 56 v = ctx.NewErrf( 57 - "could not evaluate expression %s of type %T", ctx.Str(c.Expr()), c) 57 + "could not evaluate expression %s of type %T", c.Expr(), c) 58 58 } 59 59 60 60 return ToVertex(v)
+3 -3
internal/core/adt/binop.go
··· 31 31 if left.Concreteness() > Concrete { 32 32 return &Bottom{ 33 33 Code: IncompleteError, 34 - Err: c.Newf(msg, c.Str(left), op), 34 + Err: c.Newf(msg, left, op), 35 35 } 36 36 } 37 37 if right.Concreteness() > Concrete { 38 38 return &Bottom{ 39 39 Code: IncompleteError, 40 - Err: c.Newf(msg, c.Str(right), op), 40 + Err: c.Newf(msg, right, op), 41 41 } 42 42 } 43 43 ··· 290 290 } 291 291 292 292 return c.NewErrf("invalid operands %s and %s to '%s' (type %s and %s)", 293 - c.Str(left), c.Str(right), op, left.Kind(), right.Kind()) 293 + left, right, op, left.Kind(), right.Kind()) 294 294 } 295 295 296 296 func cmpTonode(c *OpContext, op Op, r int) Value {
+19 -36
internal/core/adt/context.go
··· 26 26 27 27 "cuelang.org/go/cue/ast" 28 28 "cuelang.org/go/cue/errors" 29 - "cuelang.org/go/cue/format" 30 29 "cuelang.org/go/cue/token" 31 30 ) 32 31 ··· 274 273 275 274 func (c *OpContext) concreteIsPossible(op Op, x Expr) bool { 276 275 if !AssertConcreteIsPossible(op, x) { 277 - c.AddErrf("invalid operand %s ('%s' requires concrete value)", 278 - c.Str(x), op) 276 + // No need to take position of expression. 277 + c.AddErr(c.NewPosf(token.NoPos, 278 + "invalid operand %s ('%s' requires concrete value)", x, op)) 279 279 return false 280 280 } 281 281 return true ··· 306 306 } 307 307 308 308 func (c *OpContext) addErrf(code ErrorCode, pos token.Pos, msg string, args ...interface{}) { 309 - for i, a := range args { 310 - switch x := a.(type) { 311 - case Node: 312 - args[i] = c.Str(x) 313 - case ast.Node: 314 - b, _ := format.Node(x) 315 - args[i] = string(b) 316 - case Feature: 317 - args[i] = x.SelectorString(c.Runtime) 318 - } 319 - } 320 - 321 309 err := c.NewPosf(pos, msg, args...) 322 310 c.addErr(code, err) 323 311 } ··· 453 441 // msg is used to mention the context in which an error occurred, if any. 454 442 func (c *OpContext) Concrete(env *Environment, x Expr, msg interface{}) (result Value, complete bool) { 455 443 456 - v, complete := c.Evaluate(env, x) 444 + w, complete := c.Evaluate(env, x) 457 445 458 - v, ok := c.getDefault(v) 446 + w, ok := c.getDefault(w) 459 447 if !ok { 460 - return v, false 448 + return w, false 461 449 } 462 - v = Unwrap(v) 450 + v := Unwrap(w) 463 451 464 452 if !IsConcrete(v) { 465 453 complete = false 466 - b := c.NewErrf("non-concrete value %v in operand to %s", c.Str(v), msg) 454 + b := c.NewErrf("non-concrete value %v in operand to %s", w, msg) 467 455 b.Code = IncompleteError 468 456 v = b 469 457 } ··· 504 492 505 493 if d.NumDefaults != 1 { 506 494 c.addErrf(IncompleteError, c.pos(), 507 - "unresolved disjunction %s (type %s)", c.Str(d), d.Kind()) 495 + "unresolved disjunction %s (type %s)", d, d.Kind()) 508 496 return nil, false 509 497 } 510 498 return c.getDefault(d.Values[0]) ··· 752 740 } 753 741 754 742 case nil: 755 - // c.addErrf(IncompleteError, pos, "incomplete value %s", c.Str(x)) 743 + // c.addErrf(IncompleteError, pos, "incomplete value %s", x) 756 744 // return nil 757 745 758 746 case *Bottom: ··· 847 835 return 848 836 } 849 837 if !IsConcrete(v) && v.Kind()&k != 0 { 850 - c.addErrf(IncompleteError, pos(v), 851 - "incomplete %s value '%s'", k, c.Str(v)) 838 + c.addErrf(IncompleteError, pos(v), "incomplete %s value '%s'", k, v) 852 839 } else { 853 - c.AddErrf("cannot use %s (type %s) as type %s", c.Str(v), v.Kind(), k) 840 + c.AddErrf("cannot use %s (type %s) as type %s", v, v.Kind(), k) 854 841 } 855 842 } 856 843 ··· 864 851 } 865 852 if !IsConcrete(v) && v.Kind()&k != 0 { 866 853 c.addErrf(IncompleteError, pos(v), 867 - "incomplete %s value '%s' in as", k, c.Str(v), as) 854 + "incomplete %s value '%s' in as", k, v, as) 868 855 } else { 869 - c.AddErrf("cannot use %s (type %s) as type %s in %v", 870 - c.Str(v), v.Kind(), k, as) 856 + c.AddErrf("cannot use %s (type %s) as type %s in %v", v, v.Kind(), k, as) 871 857 } 872 858 } 873 859 ··· 912 898 switch orig.(type) { 913 899 case *ForClause: 914 900 c.addErrf(IncompleteError, pos(x), 915 - "cannot range over %s (incomplete)", 916 - c.Str(x)) 901 + "cannot range over %s (incomplete)", x) 917 902 default: 918 903 c.addErrf(IncompleteError, pos(x), 919 - "%s undefined (%s is incomplete)", c.Str(orig), c.Str(x)) 904 + "%s undefined (%s is incomplete)", orig, x) 920 905 } 921 906 return emptyNode 922 907 ··· 937 922 switch orig.(type) { 938 923 case *ForClause: 939 924 c.addErrf(IncompleteError, pos(x), 940 - "cannot range over %s (incomplete type %s)", 941 - c.Str(x), kind) 925 + "cannot range over %s (incomplete type %s)", x, kind) 942 926 default: 943 927 c.addErrf(IncompleteError, pos(x), 944 - "%s undefined as %s is incomplete (type %s)", 945 - c.Str(orig), c.Str(x), kind) 928 + "%s undefined as %s is incomplete (type %s)", orig, x, kind) 946 929 } 947 930 return emptyNode 948 931 ··· 1108 1091 1109 1092 default: 1110 1093 c.addErrf(IncompleteError, c.pos(), 1111 - "non-concrete value %s (type %s)", c.Str(v), v.Kind()) 1094 + "non-concrete value %s (type %s)", v, v.Kind()) 1112 1095 } 1113 1096 return "" 1114 1097 }
+26 -7
internal/core/adt/errors.go
··· 34 34 import ( 35 35 "cuelang.org/go/cue/ast" 36 36 "cuelang.org/go/cue/errors" 37 + cueformat "cuelang.org/go/cue/format" 37 38 "cuelang.org/go/cue/token" 38 39 ) 39 40 ··· 260 261 return c.NewPosf(c.pos(), format, args...) 261 262 } 262 263 264 + func appendNodePositions(a []token.Pos, n Node) []token.Pos { 265 + if p := pos(n); p != token.NoPos { 266 + a = append(a, p) 267 + } else if v, ok := n.(*Vertex); ok { 268 + for _, c := range v.Conjuncts { 269 + a = appendNodePositions(a, c.x) 270 + } 271 + } 272 + return a 273 + } 274 + 263 275 func (c *OpContext) NewPosf(p token.Pos, format string, args ...interface{}) *ValueError { 264 276 var a []token.Pos 265 277 if len(c.positions) > 0 { 266 278 a = make([]token.Pos, 0, len(c.positions)) 267 279 for _, n := range c.positions { 268 - if p := pos(n); p != token.NoPos { 280 + a = appendNodePositions(a, n) 281 + } 282 + } 283 + for i, arg := range args { 284 + switch x := arg.(type) { 285 + case Node: 286 + a = appendNodePositions(a, x) 287 + args[i] = c.Str(x) 288 + case ast.Node: 289 + b, _ := cueformat.Node(x) 290 + if p := x.Pos(); p != token.NoPos { 269 291 a = append(a, p) 270 - } else if v, ok := n.(*Vertex); ok { 271 - for _, c := range v.Conjuncts { 272 - if p := pos(c.x); p != token.NoPos { 273 - a = append(a, p) 274 - } 275 - } 276 292 } 293 + args[i] = string(b) 294 + case Feature: 295 + args[i] = x.SelectorString(c.Runtime) 277 296 } 278 297 } 279 298 return &ValueError{
+3 -4
internal/core/adt/eval.go
··· 974 974 975 975 var err *ValueError 976 976 if k1 == k2 { 977 - err = ctx.NewPosf(token.NoPos, 978 - "conflicting values %s and %s", ctx.Str(v1), ctx.Str(v2)) 977 + err = ctx.NewPosf(token.NoPos, "conflicting values %s and %s", v1, v2) 979 978 } else { 980 979 err = ctx.NewPosf(token.NoPos, 981 980 "conflicting values %s and %s (mismatched types %s and %s)", 982 - ctx.Str(v1), ctx.Str(v2), k1, k2) 981 + v1, v2, k1, k2) 983 982 } 984 983 985 984 err.AddPosition(v1) ··· 1005 1004 } else { 1006 1005 n.addErr(ctx.Newf( 1007 1006 "conflicting value %s (mismatched types %s and %s)", 1008 - ctx.Str(v), n.kind, k)) 1007 + v, n.kind, k)) 1009 1008 } 1010 1009 } 1011 1010
+14 -19
internal/core/adt/expr.go
··· 477 477 mask |= NullKind 478 478 } 479 479 if k&mask != 0 { 480 - ctx.addErrf(IncompleteError, ctx.pos(), 481 - "non-concrete value %s for bound %s", ctx.Str(x.Expr), x.Op) 480 + ctx.addErrf(IncompleteError, token.NoPos, // TODO(errors): use ctx.pos()? 481 + "non-concrete value %s for bound %s", x.Expr, x.Op) 482 482 return nil 483 483 } 484 484 err := ctx.NewPosf(pos(x.Expr), 485 - "invalid value %s (type %s) for bound %s", 486 - ctx.Str(v), k, x.Op) 485 + "invalid value %s (type %s) for bound %s", v, k, x.Op) 487 486 return &Bottom{Err: err} 488 487 } 489 488 ··· 565 564 } 566 565 if v.Concreteness() > Concrete { 567 566 // TODO(errors): analyze dependencies of x.Expr to get positions. 568 - ctx.addErrf(IncompleteError, ctx.pos(), 569 - "non-concrete value %s for bound %s", ctx.Str(x.Expr), x.Op) 567 + ctx.addErrf(IncompleteError, token.NoPos, // TODO(errors): use ctx.pos()? 568 + "non-concrete value %s for bound %s", x.Expr, x.Op) 570 569 return nil 571 570 } 572 571 return &BoundValue{x.Src, x.Op, v} ··· 616 615 } 617 616 // TODO(errors): use "invalid value %v (not an %s)" if x is a 618 617 // predeclared identifier such as `int`. 619 - err := c.Newf("invalid value %v (out of bound %s)", 620 - c.Str(y), c.Str(x)) 618 + err := c.Newf("invalid value %v (out of bound %s)", y, x) 621 619 err.AddPosition(y) 622 620 return &Bottom{Src: c.src, Err: err, Code: EvalError} 623 621 ··· 934 932 935 933 switch v := v.(type) { 936 934 case nil: 937 - c.addErrf(IncompleteError, c.pos(), 938 - "non-concrete slice subject %s", c.Str(x.X)) 935 + c.addErrf(IncompleteError, c.pos(), "non-concrete slice subject %s", x.X) 939 936 return nil 940 937 case *Vertex: 941 938 if !v.IsList() { ··· 997 994 if isError(v) { 998 995 return v 999 996 } 1000 - return c.NewErrf("cannot slice %v (type %s)", c.Str(v), v.Kind()) 997 + return c.NewErrf("cannot slice %v (type %s)", v, v.Kind()) 1001 998 } 1002 999 1003 1000 // An Interpolation is a string interpolation. ··· 1097 1094 } 1098 1095 if k&expectedKind != BottomKind { 1099 1096 c.addErrf(IncompleteError, pos(x.X), 1100 - "operand %s of '%s' not concrete (was %s)", c.Str(x.X), op, k) 1097 + "operand %s of '%s' not concrete (was %s)", x.X, op, k) 1101 1098 return nil 1102 1099 } 1103 - return c.NewErrf("invalid operation %s (%s %s)", c.Str(x), op, k) 1100 + return c.NewErrf("invalid operation %s (%s %s)", x, op, k) 1104 1101 } 1105 1102 1106 1103 // BinaryExpr is a binary expression. ··· 1244 1241 // value to be called with zero arguments. 1245 1242 switch { 1246 1243 case f.Src != nil: 1247 - c.addErrf(0, pos(x.Fun), 1248 - "cannot call previously called validator %s", c.Str(x.Fun)) 1244 + c.AddErrf("cannot call previously called validator %s", x.Fun) 1249 1245 1250 1246 case f.Builtin.IsValidator(len(x.Args)): 1251 1247 v := *f ··· 1257 1253 } 1258 1254 1259 1255 default: 1260 - c.addErrf(0, pos(x.Fun), "cannot call non-function %s (type %s)", 1261 - c.Str(x.Fun), kind(fun)) 1256 + c.AddErrf("cannot call non-function %s (type %s)", x.Fun, kind(fun)) 1262 1257 return nil 1263 1258 } 1264 1259 args := []Value{} ··· 1269 1264 // There SHOULD be an error in the context. If not, we generate 1270 1265 // one. 1271 1266 c.Assertf(pos(x.Fun), c.HasErr(), 1272 - "argument %d to function %s is incomplete", i, c.Str(x.Fun)) 1267 + "argument %d to function %s is incomplete", i, x.Fun) 1273 1268 1274 1269 case *Bottom: 1275 1270 // TODO(errors): consider adding an argument index for this errors. ··· 1488 1483 buf.WriteString(")") 1489 1484 } 1490 1485 1491 - vErr := c.NewPosf(src, "invalid value %s (does not satisfy %s)", c.Str(args[0]), buf.String()) 1486 + vErr := c.NewPosf(src, "invalid value %s (does not satisfy %s)", args[0], buf.String()) 1492 1487 vErr.err = err 1493 1488 1494 1489 for _, v := range args {
+4 -6
internal/core/adt/feature.go
··· 196 196 if src == nil { 197 197 src = v 198 198 } 199 - c.AddErrf("invalid index %v: %v", c.Str(src), err) 199 + c.AddErrf("invalid index %v: %v", src, err) 200 200 return InvalidLabel 201 201 } 202 202 if i < 0 { ··· 204 204 case nil, *Num, *UnaryExpr: 205 205 // If the value is a constant, we know it is always an error. 206 206 // UnaryExpr is an approximation for a constant value here. 207 - c.AddErrf("invalid index %s (index must be non-negative)", 208 - c.Str(x)) 207 + c.AddErrf("invalid index %s (index must be non-negative)", x) 209 208 default: 210 209 // Use a different message is it is the result of evaluation. 211 - c.AddErrf("index %s out of range [%s]", c.Str(src), c.Str(x)) 210 + c.AddErrf("index %s out of range [%s]", src, x) 212 211 } 213 212 return InvalidLabel 214 213 } ··· 224 223 225 224 default: 226 225 if src != nil { 227 - c.AddErrf("invalid index %s (invalid type %v)", 228 - c.Str(src), v.Kind()) 226 + c.AddErrf("invalid index %s (invalid type %v)", src, v.Kind()) 229 227 } else { 230 228 c.AddErrf("invalid index type %v", v.Kind()) 231 229 }
+1 -1
internal/core/adt/simplify.go
··· 154 154 fallthrough 155 155 156 156 case d.Negative: 157 - return ctx.NewErrf("incompatible bounds %v and %v", ctx.Str(x), ctx.Str(y)) 157 + return ctx.NewErrf("incompatible bounds %v and %v", x, y) 158 158 } 159 159 160 160 case x.Op == NotEqualOp:
+1 -1
internal/core/compile/builtin.go
··· 69 69 if k&supportedByLen == adt.BottomKind { 70 70 return c.NewErrf("invalid argument type %v", k) 71 71 } 72 - b := c.NewErrf("incomplete argument %s (type %v)", c.Str(v), k) 72 + b := c.NewErrf("incomplete argument %s (type %v)", v, k) 73 73 b.Code = adt.IncompleteError 74 74 return b 75 75 }
+3 -5
internal/core/subsume/vertex.go
··· 52 52 53 53 case *adt.ListMarker: 54 54 if !y.IsList() { 55 - s.errf("list does not subsume %s (type %s)", ctx.Str(y), y.Kind()) 55 + s.errf("list does not subsume %s (type %s)", y, y.Kind()) 56 56 return false 57 57 } 58 58 if !s.listVertices(x, y) { ··· 157 157 s.gt = a 158 158 s.lt = y 159 159 160 - s.errf("field %s not present in %s", 161 - f.SelectorString(ctx), ctx.Str(y)) 160 + s.errf("field %s not present in %s", f, y) 162 161 return false 163 162 } 164 163 ··· 195 194 if s.Profile.IgnoreClosedness { 196 195 continue 197 196 } 198 - s.errf("field %s not allowed in closed struct", 199 - f.SelectorString(ctx)) 197 + s.errf("field %s not allowed in closed struct", f) 200 198 return false 201 199 } 202 200
+1 -1
internal/core/validate/validate.go
··· 92 92 x := x.Value() 93 93 v.add(&adt.Bottom{ 94 94 Code: adt.IncompleteError, 95 - Err: v.ctx.Newf("incomplete value %v", v.ctx.Str(x)), 95 + Err: v.ctx.Newf("incomplete value %v", x), 96 96 }) 97 97 } 98 98 }
+1 -1
internal/core/validate/validate_test.go
··· 100 100 y: 2 + x 101 101 x: string 102 102 `, 103 - out: "incomplete\ny: non-concrete value string in operand to +:\n test:2:6", 103 + out: "incomplete\ny: non-concrete value string in operand to +:\n test:2:6\n test:3:3", 104 104 }, { 105 105 desc: "allowed incomplete cycle", 106 106 in: `
+1
pkg/struct/testdata/gen.txtar
··· 15 15 ./in.cue:3:27 16 16 t4: invalid value {a:1} (does not satisfy struct.MaxFields(0)): 17 17 ./in.cue:6:5 18 + ./in.cue:6:1 18 19 ./in.cue:6:22 19 20 20 21 Result: