this repo has no description
0
fork

Configure Feed

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

pkg: clean up builtin errors

- delete dead code and unused fields
- remove unused arguments
- dedup errors
- use OpContext-based error methods (for positions)

Fixes #902
Issue #52

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

+166 -159
+2 -1
cue/testdata/comprehensions/fields.txtar
··· 25 25 #User: (#struct){ 26 26 tags_str: (string){ string } 27 27 tags_map: (_|_){ 28 - // [incomplete] error in call to strings.Split: non-concrete value string 28 + // [incomplete] error in call to strings.Split: non-concrete value string: 29 + // ./in.cue:6:22 29 30 "{a}": (string){ string } 30 31 } 31 32 }
+20 -6
cue/testdata/cycle/compbottomnofinal.txtar
··· 359 359 } 360 360 -- out/eval -- 361 361 Errors: 362 - error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax 363 362 large.p1.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause 364 363 large.p2.#Y: cycle: field userinfo was added after an if clause evaluated it 365 364 large.p2.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause ··· 372 371 medium.p4.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause 373 372 minimal.b: cycle: new field port inserted by if clause that was previously evaluated by another if clause 374 373 small.p1.#Y: cycle: field port was added after an if clause evaluated it 374 + error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 375 + ./in.cue:104:23 376 + error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 377 + ./in.cue:126:23 378 + error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 379 + ./in.cue:228:23 380 + error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 381 + ./in.cue:269:23 382 + error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 383 + ./in.cue:310:23 375 384 376 385 Result: 377 386 (_|_){ ··· 441 450 Y: (_|_){ 442 451 // [eval] medium.p3.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause 443 452 port: (_|_){ 444 - // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax 453 + // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 454 + // ./in.cue:104:23 445 455 } 446 456 } 447 457 #Y: (#struct){ ··· 456 466 Y: (_|_){ 457 467 // [eval] medium.p4.Y: cycle: new field port inserted by if clause that was previously evaluated by another if clause 458 468 port: (_|_){ 459 - // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax 469 + // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 470 + // ./in.cue:126:23 460 471 } 461 472 } 462 473 #X: (#struct){ ··· 501 512 userinfo: (string){ "user" } 502 513 host: (string){ "example.com" } 503 514 port: (_|_){ 504 - // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax 515 + // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 516 + // ./in.cue:228:23 505 517 } 506 518 } 507 519 X: (string){ "user@example.com" } ··· 524 536 userinfo: (string){ "user" } 525 537 host: (string){ "example.com" } 526 538 port: (_|_){ 527 - // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax 539 + // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 540 + // ./in.cue:269:23 528 541 } 529 542 } 530 543 #X: (#struct){ ··· 552 565 userinfo: (string){ "user" } 553 566 host: (string){ "example.com" } 554 567 port: (_|_){ 555 - // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax 568 + // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: 569 + // ./in.cue:310:23 556 570 } 557 571 } 558 572 #Y: (_|_){
+2 -1
cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar
··· 92 92 } 93 93 s2: (string){ strings.ContainsAny("dd") } 94 94 s3: (_|_){ 95 - // [incomplete] error in call to strings.ContainsAny: non-concrete value string 95 + // [incomplete] error in call to strings.ContainsAny: non-concrete value string: 96 + // ./in.cue:15:5 96 97 } 97 98 str: (string){ string } 98 99 num: (number){ <4 }
+4 -2
cue/testdata/fulleval/044_Issue_#178.txtar
··· 27 27 -- out/eval -- 28 28 (struct){ 29 29 foo: (_|_){ 30 - // [incomplete] error in call to encoding/csv.Decode: non-concrete value bytes 30 + // [incomplete] error in call to encoding/csv.Decode: non-concrete value bytes: 31 + // ./in.cue:5:7 31 32 } 32 33 data: (bytes){ bytes } 33 34 len: (int){ int } 34 35 bar: (_|_){ 35 - // [incomplete] error in call to encoding/hex.EncodedLen: non-concrete value int 36 + // [incomplete] error in call to encoding/hex.EncodedLen: non-concrete value int: 37 + // ./in.cue:9:6 36 38 } 37 39 } 38 40 -- out/compile --
+2 -1
cue/testdata/fulleval/056_issue314.txtar
··· 84 84 #T: (#struct){ 85 85 s: (string){ string } 86 86 out: (_|_){ 87 - // [incomplete] error in call to text/template.Execute: cannot convert incomplete value "string" to JSON 87 + // [incomplete] error in call to text/template.Execute: cannot convert incomplete value "string" to JSON: 88 + // ./in.cue:14:7 88 89 } 89 90 } 90 91 #V: (#struct){
+12 -6
cue/testdata/resolve/048_builtins.txtar
··· 99 99 a3.a: invalid value "bar" (out of bound =~"fo"): 100 100 ./in.cue:9:5 101 101 ./in.cue:12:14 102 - stringListErrors.b.result: invalid type element 0 (int) of string list argument 0: 102 + stringListErrors.b.result: invalid list element 0 in argument 0 to call: cannot use value int (int) as string: 103 103 ./in.cue:31:17 104 + ./in.cue:30:13 104 105 stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join: 105 106 ./in.cue:36:33 106 - decimalListErrors.a.result: invalid type element 0 (string) of number list argument 0: 107 + decimalListErrors.a.result: invalid list element 0 in argument 0 to call: cannot use value string (string) as number: 107 108 ./in.cue:43:17 109 + ./in.cue:42:13 108 110 109 111 Result: 110 112 (_|_){ ··· 167 169 0: (string){ string } 168 170 } 169 171 result: (_|_){ 170 - // [incomplete] stringListErrors.a.result: non-concrete string value for element 0 of string list argument 0: 172 + // [incomplete] stringListErrors.a.result: non-concrete value string for element 0 of string list argument 0: 171 173 // ./in.cue:26:17 174 + // ./in.cue:25:13 172 175 } 173 176 } 174 177 b: (_|_){ ··· 177 180 0: (int){ int } 178 181 } 179 182 result: (_|_){ 180 - // [eval] stringListErrors.b.result: invalid type element 0 (int) of string list argument 0: 183 + // [eval] stringListErrors.b.result: invalid list element 0 in argument 0 to call: cannot use value int (int) as string: 181 184 // ./in.cue:31:17 185 + // ./in.cue:30:13 182 186 } 183 187 } 184 188 c: (_|_){ ··· 199 203 0: (string){ string } 200 204 } 201 205 result: (_|_){ 202 - // [eval] decimalListErrors.a.result: invalid type element 0 (string) of number list argument 0: 206 + // [eval] decimalListErrors.a.result: invalid list element 0 in argument 0 to call: cannot use value string (string) as number: 203 207 // ./in.cue:43:17 208 + // ./in.cue:42:13 204 209 } 205 210 } 206 211 b: (struct){ ··· 208 213 0: (int){ int } 209 214 } 210 215 result: (_|_){ 211 - // [incomplete] decimalListErrors.b.result: non-concrete number value for element 0 of number list argument 0: 216 + // [incomplete] decimalListErrors.b.result: non-concrete value int for element 0 of number list argument 0: 212 217 // ./in.cue:48:17 218 + // ./in.cue:47:13 213 219 } 214 220 } 215 221 }
+1 -2
internal/core/adt/context.go
··· 585 585 if b, ok := result.(*Bottom); ok { 586 586 if c.src != nil && 587 587 b.Code == CycleError && 588 - b.Err.Position() == token.NoPos && 589 - len(b.Err.InputPositions()) == 0 { 588 + len(errors.Positions(b.Err)) == 0 { 590 589 bb := *b 591 590 bb.Err = errors.Wrapf(b.Err, c.src.Pos(), "") 592 591 result = &bb
+1
internal/core/adt/expr.go
··· 1398 1398 c.addErrf(0, pos(a), 1399 1399 "cannot use %s as %s in argument %d to %s", 1400 1400 a, v, i+1, fun) 1401 + return nil 1401 1402 } 1402 1403 args[i] = n 1403 1404 }
+6 -5
pkg/encoding/base64/manual.go
··· 17 17 18 18 import ( 19 19 "encoding/base64" 20 - "fmt" 21 20 22 21 "cuelang.org/go/cue" 22 + "cuelang.org/go/cue/errors" 23 + "cuelang.org/go/cue/token" 23 24 ) 24 25 25 26 // EncodedLen returns the length in bytes of the base64 encoding ··· 27 28 // as only StdEncoding is supported for now. 28 29 func EncodedLen(encoding cue.Value, n int) (int, error) { 29 30 if err := encoding.Null(); err != nil { 30 - return 0, fmt.Errorf("base64: unsupported encoding: %v", err) 31 + return 0, errors.Wrapf(err, token.NoPos, "base64: unsupported encoding") 31 32 } 32 33 return base64.StdEncoding.EncodedLen(n), nil 33 34 } ··· 37 38 // null as only StdEncoding is supported for now. 38 39 func DecodedLen(encoding cue.Value, x int) (int, error) { 39 40 if err := encoding.Null(); err != nil { 40 - return 0, fmt.Errorf("base64: unsupported encoding: %v", err) 41 + return 0, errors.Wrapf(err, token.NoPos, "base64: unsupported encoding") 41 42 } 42 43 return base64.StdEncoding.DecodedLen(x), nil 43 44 } ··· 46 47 // as only StdEncoding is supported for now. 47 48 func Encode(encoding cue.Value, src []byte) (string, error) { 48 49 if err := encoding.Null(); err != nil { 49 - return "", fmt.Errorf("base64: unsupported encoding: %v", err) 50 + return "", errors.Wrapf(err, token.NoPos, "base64: unsupported encoding") 50 51 } 51 52 return base64.StdEncoding.EncodeToString(src), nil 52 53 } ··· 55 56 // to be set to null as only StdEncoding is supported for now. 56 57 func Decode(encoding cue.Value, s string) ([]byte, error) { 57 58 if err := encoding.Null(); err != nil { 58 - return nil, fmt.Errorf("base64: unsupported encoding: %v", err) 59 + return nil, errors.Wrapf(err, token.NoPos, "base64: unsupported encoding") 59 60 } 60 61 return base64.StdEncoding.DecodeString(s) 61 62 }
+4 -2
pkg/encoding/base64/testdata/gen.txtar
··· 9 9 t4: base64.Decode({}, "foo") 10 10 -- out/base64 -- 11 11 Errors: 12 - error in call to encoding/base64.Decode: base64: unsupported encoding: cannot use value {} (type struct) as null 13 - error in call to encoding/base64.Decode: illegal base64 data at input byte 0 12 + error in call to encoding/base64.Decode: illegal base64 data at input byte 0: 13 + ./in.cue:5:5 14 + error in call to encoding/base64.Decode: base64: unsupported encoding: cannot use value {} (type struct) as null: 15 + ./in.cue:6:5 14 16 15 17 Result: 16 18 t1: "Zm9v"
+2 -1
pkg/encoding/hex/testdata/gen.txtar
··· 9 9 t4: hex.Dump('foo') 10 10 -- out/hex -- 11 11 Errors: 12 - error in call to encoding/hex.Decode: encoding/hex: invalid byte: U+006F 'o' 12 + error in call to encoding/hex.Decode: encoding/hex: invalid byte: U+006F 'o': 13 + ./in.cue:5:5 13 14 14 15 Result: 15 16 t1: "666f6f"
+3 -1
pkg/encoding/json/manual.go
··· 21 21 22 22 "cuelang.org/go/cue" 23 23 "cuelang.org/go/cue/ast" 24 + "cuelang.org/go/cue/errors" 24 25 "cuelang.org/go/cue/parser" 26 + "cuelang.org/go/cue/token" 25 27 "cuelang.org/go/internal" 26 28 ) 27 29 ··· 98 100 expr, err := parser.ParseExpr("json", b) 99 101 if err != nil { 100 102 // NOTE: should never happen. 101 - return nil, fmt.Errorf("json: could not parse JSON: %v", err) 103 + return nil, errors.Wrapf(err, token.NoPos, "json: could not parse JSON") 102 104 } 103 105 return expr, nil 104 106 }
+1
pkg/encoding/json/testdata/gen.txtar
··· 18 18 -- out/json -- 19 19 Errors: 20 20 a: error in call to encoding/json.Validate: invalid value 10 (out of bound <3): 21 + ./in.cue:4:5 21 22 ./in.cue:4:36 22 23 json.Validate:1:6 23 24
+4 -1
pkg/encoding/yaml/testdata/gen.txtar
··· 14 14 t9: yaml.MarshalStream([{a: 1}, {b: int | *2}]) 15 15 -- out/yaml -- 16 16 Errors: 17 - b: error in call to encoding/yaml.Validate: incomplete value int 18 17 a: error in call to encoding/yaml.Validate: invalid value 4 (out of bound <3): 18 + ./in.cue:3:5 19 19 ./in.cue:3:41 20 20 yaml.Validate:3:5 21 + b: error in call to encoding/yaml.Validate: incomplete value int: 22 + ./in.cue:5:5 21 23 a: error in call to encoding/yaml.ValidatePartial: invalid value 4 (out of bound <3): 24 + ./in.cue:6:5 22 25 ./in.cue:6:48 23 26 yaml.ValidatePartial:3:5 24 27
-13
pkg/internal/builtin.go
··· 20 20 21 21 "cuelang.org/go/cue/errors" 22 22 "cuelang.org/go/cue/parser" 23 - "cuelang.org/go/cue/token" 24 23 "cuelang.org/go/internal" 25 24 "cuelang.org/go/internal/core/adt" 26 25 "cuelang.org/go/internal/core/compile" ··· 126 125 x.Func = func(ctx *adt.OpContext, args []adt.Value) (ret adt.Expr) { 127 126 // call, _ := ctx.Source().(*ast.CallExpr) 128 127 c := &CallCtxt{ 129 - // src: call, 130 128 ctx: ctx, 131 129 args: args, 132 130 builtin: b, ··· 179 177 } 180 178 return c.Expr() 181 179 182 - } 183 - 184 - func pos(n adt.Node) (p token.Pos) { 185 - if n == nil { 186 - return 187 - } 188 - src := n.Source() 189 - if src == nil { 190 - return 191 - } 192 - return src.Pos() 193 180 } 194 181 195 182 func (x *Builtin) name(ctx *adt.OpContext) string {
+11 -8
pkg/internal/context.go
··· 26 26 27 27 // CallCtxt is passed to builtin implementations that need to use a cue.Value. This is an internal type. It's interface may change. 28 28 type CallCtxt struct { 29 - src adt.Expr 30 29 ctx *adt.OpContext 31 30 builtin *Builtin 32 31 Err interface{} ··· 53 52 // TODO: remove default 54 53 // v, _ = v.Default() 55 54 if !v.IsConcrete() { 56 - c.errcf(c.src, adt.IncompleteError, "non-concrete argument %d", i) 55 + c.errcf(adt.IncompleteError, "non-concrete argument %d", i) 57 56 } 58 57 return v 59 58 } ··· 84 83 return 0 85 84 } 86 85 if n.BitLen() > bits { 87 - c.errf(c.src, err, "int %s overflows %s in argument %d in call to %s", 86 + c.errf(err, "int %s overflows %s in argument %d in call to %s", 88 87 n, typ, i, c.Name()) 89 88 } 90 89 res, _ := x.Int64() ··· 106 105 return 0 107 106 } 108 107 if n.BitLen() > bits { 109 - c.errf(c.src, err, "int %s overflows %s in argument %d in call to %s", 108 + c.errf(err, "int %s overflows %s in argument %d in call to %s", 110 109 n, typ, i, c.Name()) 111 110 } 112 111 res, _ := x.Uint64() ··· 273 272 default: 274 273 if k := w.Kind(); k&adt.NumKind == 0 { 275 274 err := c.ctx.NewErrf( 276 - "invalid type element %d (%s) of number list argument %d", j, k, i) 275 + "invalid list element %d in argument %d to call: cannot use value %s (%s) as number", 276 + j, i, w, k) 277 277 c.Err = &callError{err} 278 278 return a 279 279 } 280 280 281 281 err := c.ctx.NewErrf( 282 - "non-concrete number value for element %d of number list argument %d", j, i) 282 + "non-concrete value %s for element %d of number list argument %d", 283 + w, j, i) 283 284 err.Code = adt.IncompleteError 284 285 c.Err = &callError{err} 285 286 return nil ··· 309 310 default: 310 311 if k := w.Kind(); k&adt.StringKind == 0 { 311 312 err := c.ctx.NewErrf( 312 - "invalid type element %d (%s) of string list argument %d", j, k, i) 313 + "invalid list element %d in argument %d to call: cannot use value %s (%s) as string", 314 + j, i, w, k) 313 315 c.Err = &callError{err} 314 316 return a 315 317 } 316 318 317 319 err := c.ctx.NewErrf( 318 - "non-concrete string value for element %d of string list argument %d", j, i) 320 + "non-concrete value %s for element %d of string list argument %d", 321 + w, j, i) 319 322 err.Code = adt.IncompleteError 320 323 c.Err = &callError{err} 321 324 return nil
+26 -62
pkg/internal/errors.go
··· 15 15 package internal 16 16 17 17 import ( 18 - "encoding/json" 19 18 "fmt" 20 19 21 20 "cuelang.org/go/cue/errors" 22 - "cuelang.org/go/cue/token" 23 - "cuelang.org/go/internal" 24 21 "cuelang.org/go/internal/core/adt" 25 22 ) 26 23 ··· 37 34 return fmt.Sprint(e.b) 38 35 } 39 36 40 - func (c *CallCtxt) errf(src adt.Node, underlying error, format string, args ...interface{}) { 37 + func (c *CallCtxt) errf(underlying error, format string, args ...interface{}) { 41 38 var errs errors.Error 42 39 var code adt.ErrorCode 43 - if err, ok := underlying.(bottomer); ok { 44 - b := err.Bottom() 40 + switch x := underlying.(type) { 41 + case nil: 42 + case bottomer: 43 + b := x.Bottom() 45 44 errs = b.Err 46 45 code = b.Code 46 + case errors.Error: 47 + errs = x 48 + case error: 49 + errs = errors.Promote(x, "") 47 50 } 48 - errs = errors.Wrapf(errs, c.ctx.Pos(), format, args...) 49 - c.Err = &callError{&adt.Bottom{Code: code, Err: errs}} 51 + vErr := c.ctx.NewPosf(c.Pos(), format, args...) 52 + c.Err = &callError{&adt.Bottom{Code: code, Err: errors.Wrap(vErr, errs)}} 50 53 } 51 54 52 - func (c *CallCtxt) errcf(src adt.Node, code adt.ErrorCode, format string, args ...interface{}) { 55 + func (c *CallCtxt) errcf(code adt.ErrorCode, format string, args ...interface{}) { 53 56 err := c.ctx.NewErrf(format, args...) 54 57 err.Code = code 55 58 c.Err = &callError{err} 56 59 } 57 60 58 61 func wrapCallErr(c *CallCtxt, b *adt.Bottom) *adt.Bottom { 59 - pos := token.NoPos 60 - if c.src != nil { 61 - if src := c.src.Source(); src != nil { 62 - pos = src.Pos() 63 - } 64 - } 65 62 var err errors.Error 66 63 for _, e := range errors.Errors(b.Err) { 67 64 const msg = "error in call to %s" 68 65 err = errors.Append(err, 69 - errors.Wrapf(e, pos, msg, c.builtin.name(c.ctx))) 66 + errors.Wrapf(e, c.Pos(), msg, c.builtin.name(c.ctx))) 70 67 } 71 68 return &adt.Bottom{Code: b.Code, Err: err} 72 69 } 73 70 74 - func (c *CallCtxt) convertError(x interface{}, name string) *adt.Bottom { 75 - var err errors.Error 76 - switch v := x.(type) { 77 - case nil: 78 - return nil 79 - 80 - case *adt.Bottom: 81 - return v 82 - 83 - case *json.MarshalerError: 84 - err = errors.Promote(v, "marshal error") 85 - 86 - case errors.Error: 87 - err = v 88 - 89 - case error: 90 - if name != "" { 91 - err = errors.Newf(c.Pos(), "%s: %v", name, v) 92 - } else { 93 - err = errors.Newf(c.Pos(), "error in call to %s: %v", c.Name(), v) 94 - } 95 - 96 - default: 97 - err = errors.Newf(token.NoPos, "%s", name) 98 - } 99 - if err != internal.ErrIncomplete { 100 - return &adt.Bottom{ 101 - // Wrap to preserve position information. 102 - Err: errors.Wrapf(err, c.Pos(), "error in call to %s", c.Name()), 103 - } 104 - } 105 - return &adt.Bottom{ 106 - Code: adt.IncompleteError, 107 - Err: errors.Newf(c.Pos(), "incomplete values in call to %s", c.Name()), 108 - } 109 - } 110 - 111 - func (c *CallCtxt) invalidArgType(arg adt.Expr, i int, typ string, err error) { 71 + func (c *CallCtxt) invalidArgType(arg adt.Value, i int, typ string, err error) { 112 72 if ve, ok := err.(bottomer); ok && ve.Bottom().IsIncomplete() { 113 73 c.Err = ve 74 + return 75 + } 76 + if b, ok := adt.Unwrap(arg).(*adt.Bottom); ok { 77 + c.Err = b 114 78 return 115 79 } 116 80 v, ok := arg.(adt.Value) 117 81 // TODO: make these permanent errors if the value did not originate from 118 82 // a reference. 119 83 if !ok { 120 - c.errf(c.src, nil, 121 - "cannot use incomplete value %s as %s in argument %d to %s: %v", 122 - c.ctx.Str(arg), typ, i, c.Name(), err) 84 + c.errf(nil, 85 + "cannot use incomplete value %s as %s in argument %d to %s", 86 + arg, typ, i, c.Name()) 123 87 } 124 88 if err != nil { 125 - c.errf(c.src, err, 126 - "cannot use %s (type %s) as %s in argument %d to %s: %v", 127 - c.ctx.Str(arg), v.Kind(), typ, i, c.Name(), err) 89 + c.errf(err, 90 + "cannot use %s (type %s) as %s in argument %d to %s", 91 + arg, v.Kind(), typ, i, c.Name()) 128 92 } else { 129 - c.errf(c.src, err, 93 + c.errf(err, 130 94 "cannot use %s (type %s) as %s in argument %d to %s", 131 - c.ctx.Str(arg), v.Kind(), typ, i, c.Name()) 95 + arg, v.Kind(), typ, i, c.Name()) 132 96 } 133 97 }
+36 -27
pkg/list/testdata/gen.txtar
··· 63 63 t54: list.Sort([{a:1}, {b:2}], list.Ascending) 64 64 -- out/list -- 65 65 Errors: 66 - error in call to list.Avg: empty list 67 - error in call to list.Drop: negative index 68 - error in call to list.Max: empty list 69 - error in call to list.Min: empty list 70 - error in call to list.Range: end must be greater than start when step is positive 71 - error in call to list.Range: end must be less than start when step is negative 72 - error in call to list.Range: step must be non zero 73 - error in call to list.Slice: invalid index: 3 > 1 74 - error in call to list.Slice: negative index 75 - error in call to list.Slice: slice bounds out of range 76 - error in call to list.Take: negative index 77 - Ascending.x: error in call to list.Sort: 2 errors in empty disjunction: 78 - Ascending.x: error in call to list.Sort: conflicting values number and {b:2} (mismatched types number and struct): 79 - ./in.cue:46:24 80 - list:10:9 81 - Ascending.x: error in call to list.Sort: conflicting values string and {b:2} (mismatched types string and struct): 82 - ./in.cue:60:24 83 - list:10:18 84 - Ascending.y: error in call to list.Sort: 2 errors in empty disjunction: 85 - Ascending.y: error in call to list.Sort: conflicting values number and {a:1} (mismatched types number and struct): 86 - ./in.cue:60:17 87 - list:10:9 88 - Ascending.y: error in call to list.Sort: conflicting values string and {a:1} (mismatched types string and struct): 89 - ./in.cue:46:17 90 - list:10:18 66 + error in call to list.Avg: empty list: 67 + ./in.cue:4:5 91 68 t3: cannot use "foo" (type string) as list in argument 1 to list.Avg: 92 69 ./in.cue:5:14 70 + error in call to list.Drop: negative index: 71 + ./in.cue:9:5 93 72 error in call to list.FlattenN: cannot use value "foo" (type string) as list: 73 + ./in.cue:15:6 94 74 ./in.cue:15:20 95 75 t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN: 96 76 ./in.cue:16:24 77 + error in call to list.Max: empty list: 78 + ./in.cue:18:6 97 79 t17: cannot use "foo" (type string) as list in argument 1 to list.Max: 98 80 ./in.cue:19:15 81 + error in call to list.Min: empty list: 82 + ./in.cue:21:6 99 83 t20: cannot use "foo" (type string) as list in argument 1 to list.Min: 100 84 ./in.cue:22:15 101 85 t23: cannot use "foo" (type string) as list in argument 1 to list.Product: 102 86 ./in.cue:25:19 103 - t42: invalid type element 0 (int) of string list argument 0: 87 + error in call to list.Range: step must be non zero: 88 + ./in.cue:26:6 89 + error in call to list.Range: end must be greater than start when step is positive: 90 + ./in.cue:27:6 91 + error in call to list.Range: end must be less than start when step is negative: 92 + ./in.cue:28:6 93 + error in call to list.Slice: negative index: 94 + ./in.cue:35:6 95 + error in call to list.Slice: invalid index: 3 > 1: 96 + ./in.cue:36:6 97 + error in call to list.Slice: slice bounds out of range: 98 + ./in.cue:37:6 99 + error in call to list.Slice: slice bounds out of range: 100 + ./in.cue:38:6 101 + Ascending.x: error in call to list.Sort: 2 errors in empty disjunction:: 102 + ./in.cue:46:6 103 + Ascending.y: error in call to list.Sort: 2 errors in empty disjunction:: 104 + ./in.cue:46:6 105 + t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string: 104 106 ./in.cue:48:6 107 + ./in.cue:48:24 105 108 t45: cannot use "foo" (type string) as list in argument 1 to list.Sum: 106 109 ./in.cue:51:15 110 + error in call to list.Take: negative index: 111 + ./in.cue:55:6 112 + Ascending.x: error in call to list.Sort: 2 errors in empty disjunction:: 113 + ./in.cue:60:6 114 + Ascending.y: error in call to list.Sort: 2 errors in empty disjunction:: 115 + ./in.cue:60:6 107 116 108 117 Result: 109 118 t1: 2.5 ··· 156 165 }] 157 166 t40: _|_ // error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 5 more errors) 158 167 t41: ["a", "b"] 159 - t42: _|_ // t42: invalid type element 0 (int) of string list argument 0 168 + t42: _|_ // t42: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string 160 169 t43: 10 161 170 t44: 0 162 171 t45: _|_ // t45: cannot use "foo" (type string) as list in argument 1 to list.Sum
+5 -3
pkg/list/testdata/list.txtar
··· 43 43 } 44 44 -- out/list -- 45 45 Errors: 46 - error in call to list.Repeat: negative count 47 - concat.t7.v: cannot use 1 (type int) as list in argument 1 to list.Concat: 48 - ./in.cue:30:12 46 + error in call to list.Repeat: negative count: 47 + ./in.cue:4:33 49 48 error in call to list.Concat: cannot use value 1 (type int) as list: 49 + ./in.cue:19:25 50 50 ./in.cue:31:13 51 + concat.t7.v: cannot use 1 (type int) as list in argument 1 to list.Concat: 52 + ./in.cue:30:12 51 53 52 54 Result: 53 55 repeat: {
+3 -2
pkg/math/testdata/gen.txtar
··· 29 29 ./in.cue:5:5 30 30 error in call to math.Jacobi: big: invalid 2nd argument to Int.Jacobi: need odd integer but got 2000: 31 31 ./in.cue:6:5 32 - cannot use 2.0E+400 (type float) as float64 in argument 0 to math.Asin: value was rounded up: 32 + t8: cannot use 2.0E+400 (type float) as float64 in argument 0 to math.Asin: value was rounded up: 33 33 ./in.cue:8:5 34 + ./in.cue:8:15 34 35 35 36 Result: 36 37 t1: 3.14159265358979323846264338327950288419716939937510582097494459 ··· 38 39 t3: _|_ // t3: cannot call non-function math.Pi (type float) 39 40 t6: _|_ // error in call to math.Jacobi: big: invalid 2nd argument to Int.Jacobi: need odd integer but got 2000 40 41 t7: 1 41 - t8: _|_ // cannot use 2.0E+400 (type float) as float64 in argument 0 to math.Asin: value was rounded up 42 + t8: _|_ // t8: cannot use 2.0E+400 (type float) as float64 in argument 0 to math.Asin: value was rounded up 42 43 t16: 4096 43 44 t17: 1e+4 44 45 t18: true
+2 -1
pkg/math/testdata/round.txtar
··· 34 34 35 35 -- out/math -- 36 36 Errors: 37 - error in call to math.MultipleOf: division by zero 37 + error in call to math.MultipleOf: division by zero: 38 + ./in.cue:6:7 38 39 floorE1: too many arguments in call to math.Floor (have 2, want 1): 39 40 ./in.cue:17:10 40 41 floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor:
+2 -1
pkg/net/testdata/gen.txtar
··· 22 22 t17: net.ToIP16("127.0.0.1") 23 23 -- out/net -- 24 24 Errors: 25 - error in call to net.JoinHostPort: invalid host [192, 30, 4] 26 25 t9: invalid value "23.23.23.2333" (does not satisfy net.IPv4): 27 26 ./in.cue:11:16 27 + error in call to net.JoinHostPort: invalid host [192, 30, 4]: 28 + ./in.cue:9:5 28 29 t13: invalid value "ff02::1:3" (does not satisfy net.IPv4): 29 30 ./in.cue:15:6 30 31 ./in.cue:15:19
+1 -3
pkg/path/testdata/error.txtar
··· 19 19 joinErr: path.Join(["a", "b"], "foo") 20 20 -- out/path -- 21 21 Errors: 22 - cannot use _|_(2 errors in empty disjunction: (and 2 more errors)) (type _|_) as string in argument 1 to path.Join: 2 errors in empty disjunction: (and 2 more errors): 23 - ./in.cue:4:10 24 22 joinErr: cannot use "foo" as *"unix" | "windows" | "plan9" | "aix" | "android" | "darwin" | "dragonfly" | "freebsd" | "hurd" | "illumos" | "ios" | "js" | "linux" | "nacl" | "netbsd" | "openbsd" | "solaris" | "zos" in argument 2 to path.Join: 25 23 ./in.cue:4:32 26 24 27 25 Result: 28 26 joinOK: "a/b" 29 - joinErr: _|_ // joinErr: cannot use "foo" as *"unix" | "windows" | "plan9" | "aix" | "android" | "darwin" | "dragonfly" | "freebsd" | "hurd" | "illumos" | "ios" | "js" | "linux" | "nacl" | "netbsd" | "openbsd" | "solaris" | "zos" in argument 2 to path.Join (and 1 more errors) 27 + joinErr: _|_ // joinErr: cannot use "foo" as *"unix" | "windows" | "plan9" | "aix" | "android" | "darwin" | "dragonfly" | "freebsd" | "hurd" | "illumos" | "ios" | "js" | "linux" | "nacl" | "netbsd" | "openbsd" | "solaris" | "zos" in argument 2 to path.Join 30 28
+8 -4
pkg/regexp/testdata/gen.txtar
··· 19 19 t14: regexp.Valid & "invalid)" 20 20 -- out/regexp -- 21 21 Errors: 22 - error in call to regexp.Find: no match 23 - error in call to regexp.FindAll: no match 24 - error in call to regexp.FindAllNamedSubmatch: no match 25 - error in call to regexp.FindAllSubmatch: no match 26 22 t14: invalid value "invalid)" (does not satisfy regexp.Valid): error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)`: 27 23 ./in.cue:16:21 24 + error in call to regexp.Find: no match: 25 + ./in.cue:4:5 26 + error in call to regexp.FindAll: no match: 27 + ./in.cue:7:5 28 + error in call to regexp.FindAllSubmatch: no match: 29 + ./in.cue:10:5 30 + error in call to regexp.FindAllNamedSubmatch: no match: 31 + ./in.cue:14:6 28 32 29 33 Result: 30 34 t1: "foo"
+5 -4
pkg/strconv/testdata/gen.txtar
··· 10 10 t5: strconv.FormatBool(true) 11 11 -- out/strconv -- 12 12 Errors: 13 - int 300 overflows byte in argument 1 in call to strconv.FormatFloat: 13 + t2: int 300 overflows byte in argument 1 in call to strconv.FormatFloat: 14 14 ./in.cue:4:5 15 - cannot use -1 (type int) as byte in argument 1 to strconv.FormatFloat: 15 + t3: cannot use -1 (type int) as byte in argument 1 to strconv.FormatFloat: 16 16 ./in.cue:5:5 17 + ./in.cue:5:31 17 18 t4: cannot use 1.0 (type float) as int in argument 2 to strconv.FormatFloat: 18 19 ./in.cue:6:31 19 20 20 21 Result: 21 22 t1: "40" 22 - t2: _|_ // int 300 overflows byte in argument 1 in call to strconv.FormatFloat 23 - t3: _|_ // cannot use -1 (type int) as byte in argument 1 to strconv.FormatFloat 23 + t2: _|_ // t2: int 300 overflows byte in argument 1 in call to strconv.FormatFloat 24 + t3: _|_ // t3: cannot use -1 (type int) as byte in argument 1 to strconv.FormatFloat 24 25 t4: _|_ // t4: cannot use 1.0 (type float) as int in argument 2 to strconv.FormatFloat 25 26 t5: "true" 26 27
+3 -2
pkg/strings/testdata/gen.txtar
··· 22 22 t17: strings.MinRunes(10) & "hello" 23 23 -- out/strings -- 24 24 Errors: 25 - t2: invalid type element 0 (int) of string list argument 0: 25 + t2: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string: 26 26 ./in.cue:4:5 27 + ./in.cue:4:19 27 28 t10: invalid value "quux" (does not satisfy strings.MaxRunes(3)): 28 29 ./in.cue:12:6 29 30 ./in.cue:12:23 ··· 43 44 44 45 Result: 45 46 t1: "Hello World!" 46 - t2: _|_ // t2: invalid type element 0 (int) of string list argument 0 47 + t2: _|_ // t2: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string 47 48 t3: 97 48 49 t4: 'llo' 49 50 t5: "✓ H"