| # DO NOT EDIT; generated by go run testdata/gen.go |
| # |
| #name: index |
| #evalPartial |
| -- in.cue -- |
| a: [2][0] |
| b: {foo: "bar"}["foo"] |
| c: (*l | {"3": 3})["3"] |
| d: (*[] | [1])[0] |
| l: [] |
| e1: [2][""] |
| e2: 2[2] |
| e3: [][true] |
| e4: [1, 2, 3][3] |
| e5: [1, 2, 3][-1] |
| e6: (*[] | {})[1] |
| def: { |
| a: 1 |
| b :: 3 |
| } |
| e7: def["b"] |
| -- out/def -- |
| a: 2 |
| b: "bar" |
| c: _|_ // invalid list index "3" (type string) |
| l: [] |
| d: _|_ // index 0 out of bounds |
| e1: _|_ // invalid list index "" (type string) |
| e2: _|_ // invalid operation: 2[2] (type int does not support indexing) |
| e3: _|_ // invalid list index true (type bool) |
| e4: _|_ // index 3 out of bounds |
| e5: _|_ // invalid list index -1 (index must be non-negative) |
| e6: _|_ // index 1 out of bounds |
| def: { |
| a: 1 |
| b :: 3 |
| } |
| e7: _|_ // field "b" is a definition |
| -- out/legacy-debug -- |
| <0>{a: 2, b: "bar", c: _|_("3":invalid list index "3" (type string)), l: [], d: _|_([]:index 0 out of bounds), e1: _|_("":invalid list index "" (type string)), e2: _|_(2:invalid operation: 2[2] (type int does not support indexing)), e3: _|_(true:invalid list index true (type bool)), e4: _|_([1,2,3]:index 3 out of bounds), e5: _|_(-1:invalid list index -1 (index must be non-negative)), e6: _|_([]:index 1 out of bounds), def: <1>{a: 1, b :: 3}, e7: _|_(<2>.def["b"]:field "b" is a definition)} |