# evalv3 incorrectly produces a "field not allowed" error when unifying against
# a definition that succeeds without error under evalv2, regressing on a
# real-world GitHub Actions schema.
# https://cuelang.org/issue/3827
-- in.cue --
reduced: {
	A: b: (A.c & {}).x
	A: null | { c: x: 1 }
	@test(eq, {A: {b: 1, c: {x: 1}}})
}

full: {
	out: #Workflow.#Step & {
		uses: "actions/upload-artifact@v3"
		with: {
			name: "foo"
			path: "bar"
		}
	}

	Y=#Workflow: #Step: (Y.steps & {x: {}}).x

	#Workflow: null | {
		steps: [string]: {
			uses?: string
			with?: [string]: string
		}
	}
	@test(eq, {
		out: {
			uses: "actions/upload-artifact@v3"
			with: {name: "foo", path: "bar"}
		}
		#Workflow: {
			#Step: {uses?: string, with?: {}}
			steps: {}
		}
	})
}
-- out/eval/stats --
Leaks:  9
Freed:  22
Reused: 10
Allocs: 21
Retain: 0

Unifications: 20
Conjuncts:    43
Disjuncts:    4
Notifications: 2

NumCloseIDs: 7
