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] + } +}