# A list field added inside an if-block of a let-bound struct, consumed by
# encoding/json.Marshal within a unified-and-projected definition, regressed
# in evalv3 with "adding field N not allowed as field set was already
# referenced".
-- in.cue --
import "encoding/json"

#W: {
	let _obj = {
		if true {
			list: [1, 2]
		}
	}
	out: json.Marshal(_obj)
}

result: (#W & {}).out @test(eq, "{\"list\":[1,2]}")
-- out/eval/stats --
Leaks:  0
Freed:  16
Reused: 5
Allocs: 11
Retain: 0

Unifications: 14
Conjuncts:    19
Disjuncts:    0

NumCloseIDs: 8
