-- in.cue --
a: [2][0]               @test(eq, 2)
b: {foo: "bar"}["foo"]  @test(eq, "bar")
c: (*l | {"3": 3})["3"] @test(err, code=eval, contains="undefined field", pos=[0:20])
d: (*[] | [1])[0]       @test(err, code=eval, contains="index out of range [0]", pos=[0:16])
l: []                   @test(eq, [])

e1: [2][""]       @test(err, code=eval, contains="undefined field", pos=[0:9])
e2: 2[2]          @test(err, code=eval, contains="invalid operand 2", pos=[0:5])
e3: [][true]      @test(err, code=eval, contains="invalid index true", pos=[0:5, 0:8])
e4: [1, 2, 3][3]  @test(err, code=eval, contains="index out of range [3]", pos=[0:15])
e5: [1, 2, 3][-1] @test(err, code=eval, contains="invalid index -1", pos=[0:5, 0:15])
e6: (*[] | {})[1] @test(err, code=eval, contains="index out of range [1]", pos=[0:16])
e7: [1, 2, 3][3]  @test(err, code=eval, contains="index out of range [3]", pos=[0:15])
e8: [1, 2, 3][-1] @test(err, code=eval, contains="invalid index -1", pos=[0:5, 0:15])
e9: (*[] | {})[1] @test(err, code=eval, contains="index out of range [1]", pos=[0:16])

def: {
	a:  1
	#b: 3
} @test(eq, {a: 1, #b: 3})
e10: def["b"] @test(err, code=incomplete, contains="undefined field: b", pos=[0:10])
-- out/errors.txt --
[eval] c: undefined field: "3":
    ./in.cue:3:20
[eval] d: index out of range [0] with length 0:
    ./in.cue:4:16
[eval] e1: undefined field: "":
    ./in.cue:7:9
[eval] e2: invalid operand 2 (found int, want list or struct):
    ./in.cue:8:5
[eval] e3: invalid index true (invalid type bool):
    ./in.cue:9:5
    ./in.cue:9:8
[eval] e4: index out of range [3] with length 3:
    ./in.cue:10:15
[eval] e5: invalid index -1 (index must be non-negative):
    ./in.cue:11:5
    ./in.cue:11:15
[eval] e6: index out of range [1] with length 0:
    ./in.cue:12:16
[eval] e7: index out of range [3] with length 3:
    ./in.cue:13:15
[eval] e8: invalid index -1 (index must be non-negative):
    ./in.cue:14:5
    ./in.cue:14:15
[eval] e9: index out of range [1] with length 0:
    ./in.cue:15:16
[incomplete] e10: undefined field: b:
    ./in.cue:21:10
-- out/eval/stats --
Leaks:  0
Freed:  55
Reused: 33
Allocs: 22
Retain: 0

Unifications: 32
Conjuncts:    44
Disjuncts:    8

NumCloseIDs: 3
-- out/todo.txt --
Error messages slightly different.
