-- in.cue --
b: {for k, v in a {"\(k)": v + 1}} @test(eq, {b: 2, c: 3})
a: {b: 1, c: 2}                    @test(eq, {b: 1, c: 2})

x: {for k, v in y {"\(k)": v}} @test(eq, {})
y: {} // check that empty struct after reference works.

k: {for v in e {v}} @test(err, code=eval, pos=[0:14], contains="cannot range")
e: int @test(eq, int)

comprehensionBinds: {
	@test(eq, {a: a: _, b: a: _})
	a: {for _ in [1] {a: _}}
	b: {for _, _ in [1] {a: _}}
}
-- out/errors.txt --
[eval] k: cannot range over e (found int, want list or struct):
    ./in.cue:7:14
-- out/eval/stats --
Leaks:  2
Freed:  16
Reused: 12
Allocs: 6
Retain: 7

Unifications: 18
Conjuncts:    18
Disjuncts:    21

MisalignedConjunct: 1

NumCloseIDs: 5
