From defac2fdb15b4f23aebe3df3638cf98dad23a747 Mon Sep 17 00:00:00 2001 From: Marcel van Lohuizen Date: Tue, 12 May 2026 11:05:11 +0200 Subject: [PATCH] internal/core/adt: add reproducer for unity failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lock in the correct behavior of a comprehension-over-resources shape originally surfaced by unity. The upcoming comprehension rework would otherwise regress this case; landing the test below the rework lets the follow-up fix show its diff cleanly. Signed-off-by: Marcel van Lohuizen Change-Id: Ic09a34161212ac5e79f3dcf26a5134b3bc305cb0 Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1237116 TryBot-Result: CUEcueckoo Reviewed-by: Daniel Martí Unity-Result: CUE porcuepine --- .../comprehensions/deferfieldsetknown.txtar | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 cue/testdata/comprehensions/deferfieldsetknown.txtar diff --git a/cue/testdata/comprehensions/deferfieldsetknown.txtar b/cue/testdata/comprehensions/deferfieldsetknown.txtar new file mode 100644 index 000000000..d5d5b1d75 --- /dev/null +++ b/cue/testdata/comprehensions/deferfieldsetknown.txtar @@ -0,0 +1,43 @@ +-- in.cue -- +package x + +#PDB: {y: int} + +result: resources: { + if true { + x: #PDB & {y: 1} + } +} + +out: ({ + cfg: resources: _ + out: {for n, _ in cfg.resources {(n): "x"}} +} & {cfg: result}).out @test(eq, {x: "x"}) +-- out/compile -- +--- in.cue +{ + #PDB: { + y: int + } + result: { + resources: { + if true { + x: (〈3;#PDB〉 & { + y: 1 + }) + } + } + } + out: ({ + cfg: { + resources: _ + } + out: { + for n, _ in 〈1;cfg〉.resources { + 〈1;n〉: "x" + } + } + } & { + cfg: 〈1;result〉 + }).out +} -- 2.51.2