From 2eedbd1215da3fe2f70a2588084b713e52477a6a Mon Sep 17 00:00:00 2001 From: Marcel van Lohuizen Date: Sun, 6 Oct 2024 16:04:14 +0200 Subject: [PATCH] internal/core/export: document bug in export This records a bug in the SelfContained logic that was exposed developing eval V3. It fails for all versions, though. Signed-off-by: Marcel van Lohuizen Change-Id: Ia6a92a8bda41e58195abffbaf6f74416caa5cab8 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202232 Unity-Result: CUE porcuepine Reviewed-by: Matthew Sackman TryBot-Result: CUEcueckoo --- internal/core/export/self_test.go | 4 ++++ .../testdata/selfcontained/cyclic.txtar | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 internal/core/export/testdata/selfcontained/cyclic.txtar diff --git a/internal/core/export/self_test.go b/internal/core/export/self_test.go index a42fb806208..4a230efbfd4 100644 --- a/internal/core/export/self_test.go +++ b/internal/core/export/self_test.go @@ -42,6 +42,10 @@ func TestSelfContained(t *testing.T) { ToDo: map[string]string{ "self-v3/selfcontained/import": `wa: reference "_hidden_567475F3" not found:`, + + "self/selfcontained/cyclic": `reference not properly substituted`, + "self-v3/selfcontained/cyclic": `reference not properly substituted`, + "self-v3-noshare/selfcontained/cyclic": `reference not properly substituted`, }, } diff --git a/internal/core/export/testdata/selfcontained/cyclic.txtar b/internal/core/export/testdata/selfcontained/cyclic.txtar new file mode 100644 index 00000000000..787d980510f --- /dev/null +++ b/internal/core/export/testdata/selfcontained/cyclic.txtar @@ -0,0 +1,20 @@ +#path: a.b.#def + +The trick here is that we hoist values that are both cyclic as well as a +definition. The behavior of the definition should be retained, and the +cyclic references should be substituted accordingly. +-- in.cue -- +a: b: #def: { + opt?: #def + + list: [...#def] +} +-- out/self/default -- +X.#def + +let X = { + #def: { + opt?: #def + list: [...#def] + } +}