#name: closing with comprehensions
#evalPartial
-- in.cue --
#A: {f1: int, f2: int} @test(eq, {f1: int, f2: int}) @test(closed)

for k, v in {f3: int} {
	a: #A & {"\(k)": v}
}
@test(err, at=a.f3, code=eval, contains="field not allowed", pos=[-2:11])

#B: {
	for k, v in {f1: int} {
		"\(k)": v
	}
} @test(eq, { f1: int })

#C: {
	f1: _
	for k, v in {f1: int} {
		"\(k)": v
	}
} @test(eq, { f1: int }) @test(closed) @test(allows=false, string)

#D: {
	for k, v in {f1: int} {
		"\(k)": v
	}
	...
} @test(eq, { f1: int }) @test(closed) @test(allows, string)

#E: #A & {
	for k, v in {f3: int} {
		"\(k)": v
	}
} @test(err, at=f3, code=eval, contains="field not allowed", pos=[2:3])
-- out/errors.txt --
[eval] a.f3: field not allowed:
    ./in.cue:4:11
[eval] #E.f3: field not allowed:
    ./in.cue:30:3
-- out/eval/stats --
Leaks:  0
Freed:  28
Reused: 16
Allocs: 12
Retain: 0

Unifications: 28
Conjuncts:    43
Disjuncts:    0

NumCloseIDs: 16
-- out/diff-v2-v3.txt --
Error positions: v3 reports fewer positions than v2 for the "field not allowed" errors (v2 includes definition site positions, v3 only reports the immediate error site).
