# Non-CallExpr conjuncts (=~, == _|_, interpolation) must not be deferred
# under a cyclic context; companion to issue4230.txtar which covers CallExpr.
# https://cuelang.org/issue/4253
-- in.cue --
@experiment(aliasv2)

x: {
	#tmpl: {
		let _self = self
		foo: 1
		k8s: foo: _self.foo
	}

	#allowed: =~"^[a-z0-9]+$"

	[string]: {
		[string]~(ID,_): {
			#tmpl
			if (#allowed & ID) == _|_ {
				error("bad: \(ID)")
			}
		}
	}

	gateway: whoami2: {}
} @test(eq, at=gateway.whoami2, {foo: 1, k8s: {foo: 1}})
-- out/eval/stats --
Leaks:  9
Freed:  18
Reused: 9
Allocs: 18
Retain: 0

Unifications: 21
Conjuncts:    42
Disjuncts:    0

NumCloseIDs: 16
