cuelang.org/go@v0.10.1/cue/testdata/resolve/018_slice.txtar (about) 1 # DO NOT EDIT; generated by go run testdata/gen.go 2 # 3 #name: slice 4 #evalPartial 5 -- in.cue -- 6 a: [2][0:0] 7 b: [0][1:1] 8 e1: [][1:1] 9 e2: [0][-1:0] 10 e3: [0][1:0] 11 e4: [0][1:2] 12 e5: 4[1:2] 13 e6: [2]["":] 14 e7: [2][:"9"] 15 -- out/def -- 16 a: [] 17 b: [] 18 e1: _|_ // slice bounds out of range 19 e2: _|_ // negative slice index 20 e3: _|_ // invalid slice index: 1 > 0 21 e4: _|_ // slice bounds out of range 22 e5: _|_ // cannot slice 4 (type int) 23 e6: _|_ // invalid slice index "" (type string) 24 e7: _|_ // invalid slice index "9" (type string) 25 -- out/legacy-debug -- 26 <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))} 27 -- out/compile -- 28 --- in.cue 29 { 30 a: [ 31 2, 32 ][0:0] 33 b: [ 34 0, 35 ][1:1] 36 e1: [][1:1] 37 e2: [ 38 0, 39 ][-1:0] 40 e3: [ 41 0, 42 ][1:0] 43 e4: [ 44 0, 45 ][1:2] 46 e5: 4[1:2] 47 e6: [ 48 2, 49 ]["":] 50 e7: [ 51 2, 52 ][:"9"] 53 } 54 -- out/eval/stats -- 55 Leaks: 8 56 Freed: 10 57 Reused: 8 58 Allocs: 10 59 Retain: 8 60 61 Unifications: 18 62 Conjuncts: 18 63 Disjuncts: 18 64 -- out/eval -- 65 Errors: 66 e1: index 1 out of range: 67 ./in.cue:3:5 68 e2: cannot convert negative number to uint64: 69 ./in.cue:4:5 70 e3: invalid slice index: 1 > 0: 71 ./in.cue:5:5 72 e4: index 2 out of range: 73 ./in.cue:6:5 74 e5: cannot slice 4 (type int): 75 ./in.cue:7:5 76 e6: cannot use "" (type string) as type int in slice index: 77 ./in.cue:8:5 78 ./in.cue:8:9 79 e7: cannot use "9" (type string) as type int in slice index: 80 ./in.cue:9:5 81 ./in.cue:9:10 82 83 Result: 84 (_|_){ 85 // [eval] 86 a: (#list){ 87 } 88 b: (#list){ 89 } 90 e1: (_|_){ 91 // [eval] e1: index 1 out of range: 92 // ./in.cue:3:5 93 } 94 e2: (_|_){ 95 // [eval] e2: cannot convert negative number to uint64: 96 // ./in.cue:4:5 97 } 98 e3: (_|_){ 99 // [eval] e3: invalid slice index: 1 > 0: 100 // ./in.cue:5:5 101 } 102 e4: (_|_){ 103 // [eval] e4: index 2 out of range: 104 // ./in.cue:6:5 105 } 106 e5: (_|_){ 107 // [eval] e5: cannot slice 4 (type int): 108 // ./in.cue:7:5 109 } 110 e6: (_|_){ 111 // [eval] e6: cannot use "" (type string) as type int in slice index: 112 // ./in.cue:8:5 113 // ./in.cue:8:9 114 } 115 e7: (_|_){ 116 // [eval] e7: cannot use "9" (type string) as type int in slice index: 117 // ./in.cue:9:5 118 // ./in.cue:9:10 119 } 120 }