| # DO NOT EDIT; generated by go run testdata/gen.go |
| # |
| #name: slice |
| #evalPartial |
| -- in.cue -- |
| a: [2][0:0] |
| b: [0][1:1] |
| e1: [][1:1] |
| e2: [0][-1:0] |
| e3: [0][1:0] |
| e4: [0][1:2] |
| e5: 4[1:2] |
| e6: [2]["":] |
| e7: [2][:"9"] |
| -- out/def -- |
| a: [] |
| b: [] |
| e1: _|_ // slice bounds out of range |
| e2: _|_ // negative slice index |
| e3: _|_ // invalid slice index: 1 > 0 |
| e4: _|_ // slice bounds out of range |
| e5: _|_ // cannot slice 4 (type int) |
| e6: _|_ // invalid slice index "" (type string) |
| e7: _|_ // invalid slice index "9" (type string) |
| -- out/legacy-debug -- |
| <0>{a: [], b: [], e1: _|_(1:slice bounds out of range), e2: _|_([0]:negative slice index), e3: _|_([0]:invalid slice index: 1 > 0), e4: _|_(2:slice bounds out of range), e5: _|_(4:cannot slice 4 (type int)), e6: _|_("":invalid slice index "" (type string)), e7: _|_("9":invalid slice index "9" (type string))} |
| -- out/compile -- |
| --- in.cue |
| { |
| a: [ |
| 2, |
| ][0:0] |
| b: [ |
| 0, |
| ][1:1] |
| e1: [][1:1] |
| e2: [ |
| 0, |
| ][-1:0] |
| e3: [ |
| 0, |
| ][1:0] |
| e4: [ |
| 0, |
| ][1:2] |
| e5: 4[1:2] |
| e6: [ |
| 2, |
| ]["":] |
| e7: [ |
| 2, |
| ][:"9"] |
| } |
| -- out/eval -- |
| Errors: |
| e1: index 1 out of range: |
| ./in.cue:3:5 |
| e2: cannot convert negative number to uint64: |
| ./in.cue:4:5 |
| e3: invalid slice index: 1 > 0: |
| ./in.cue:5:5 |
| e4: index 2 out of range: |
| ./in.cue:6:5 |
| e5: cannot slice 4 (type int): |
| ./in.cue:7:5 |
| e6: cannot use "" (type string) as type int in slice index: |
| ./in.cue:8:5 |
| ./in.cue:8:9 |
| e7: cannot use "9" (type string) as type int in slice index: |
| ./in.cue:9:5 |
| ./in.cue:9:10 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| a: (#list){ |
| } |
| b: (#list){ |
| } |
| e1: (_|_){ |
| // [eval] e1: index 1 out of range: |
| // ./in.cue:3:5 |
| } |
| e2: (_|_){ |
| // [eval] e2: cannot convert negative number to uint64: |
| // ./in.cue:4:5 |
| } |
| e3: (_|_){ |
| // [eval] e3: invalid slice index: 1 > 0: |
| // ./in.cue:5:5 |
| } |
| e4: (_|_){ |
| // [eval] e4: index 2 out of range: |
| // ./in.cue:6:5 |
| } |
| e5: (_|_){ |
| // [eval] e5: cannot slice 4 (type int): |
| // ./in.cue:7:5 |
| } |
| e6: (_|_){ |
| // [eval] e6: cannot use "" (type string) as type int in slice index: |
| // ./in.cue:8:5 |
| // ./in.cue:8:9 |
| } |
| e7: (_|_){ |
| // [eval] e7: cannot use "9" (type string) as type int in slice index: |
| // ./in.cue:9:5 |
| // ./in.cue:9:10 |
| } |
| } |