diff --git a/internal/core/export/testdata/main/attrs.txtar b/internal/core/export/testdata/main/attrs.txtar index 869e16bc4cf..6d2cc16c380 100644 --- a/internal/core/export/testdata/main/attrs.txtar +++ b/internal/core/export/testdata/main/attrs.txtar @@ -331,7 +331,7 @@ dynamicSimple: { } @field(2) @field(1) @field(4) @field(3) @field(5) doNotPropagate: { #A: {} @attr1() - a: {} @attr1() + a: {} // Do not accumulated field attributes in embedding. #B: {} @attr1() @@ -399,7 +399,7 @@ dynamicSimple: { } @field(2) @field(1) @field(4) @field(3) @field(5) doNotPropagate: { #A: {} @attr1() - a: {} @attr1() + a: {} #B: {} @attr1() b: {} } @@ -456,35 +456,10 @@ dynamicSimple: { diff old new --- old +++ new -@@ -125,44 +125,45 @@ - } @field(2) @field(1) @field(4) @field(3) @field(5) - doNotPropagate: { - #A: {} @attr1() -- a: {} -- -- // Do not accumulated field attributes in embedding. -- #B: {} @attr1() -- b: {} -- } -- embedScalarField: { -- a: 2 @attr1() @attr2() -- } -- embedScalarDecl: { -- b0: { -- 2, @attr1() -- } -- b1: { -- 2, @attr1() -- } -- b2: { -- 2, @attr2(), @attr1() -- } -- } -- dontMergeForDef: { -- a: { -- @decl1() -- } -- b: { +@@ -150,19 +150,20 @@ + @decl1() + } + b: { - @decl1(), @decl2() - x: 1 - } @@ -498,31 +473,6 @@ diff old new - comprehensions: { - @step(0) - @step(2c) -+ a: {} @attr1() -+ -+ // Do not accumulated field attributes in embedding. -+ #B: {} @attr1() -+ b: {} -+ } -+ embedScalarField: { -+ a: 2 @attr1() @attr2() -+ } -+ embedScalarDecl: { -+ b0: { -+ 2, @attr1() -+ } -+ b1: { -+ 2, @attr1() -+ } -+ b2: { -+ 2, @attr2(), @attr1() -+ } -+ } -+ dontMergeForDef: { -+ a: { -+ @decl1() -+ } -+ b: { + @decl2(), @decl1() + x: 1 + } @@ -540,33 +490,10 @@ diff old new c1: {} @step(1) c2: { @step(2a) -@@ -192,42 +193,43 @@ - } @field(2) @field(1) @field(4) @field(3) @field(5) - doNotPropagate: { - #A: {} @attr1() -- a: {} -- #B: {} @attr1() -- b: {} -- } -- embedScalarField: { -- a: 2 @attr1() @attr2() -- } -- embedScalarDecl: { -- b0: { -- 2, @attr1() -- } -- b1: { -- 2, @attr1() -- } -- b2: { -- 2, @attr2(), @attr1() -- } -- } -- dontMergeForDef: { -- a: { -- @decl1() -- } -- b: { +@@ -215,19 +216,20 @@ + @decl1() + } + b: { - @decl1(), @decl2() - x: 1 - } @@ -580,29 +507,6 @@ diff old new - comprehensions: { - @step(0) - @step(2c) -+ a: {} @attr1() -+ #B: {} @attr1() -+ b: {} -+ } -+ embedScalarField: { -+ a: 2 @attr1() @attr2() -+ } -+ embedScalarDecl: { -+ b0: { -+ 2, @attr1() -+ } -+ b1: { -+ 2, @attr1() -+ } -+ b2: { -+ 2, @attr2(), @attr1() -+ } -+ } -+ dontMergeForDef: { -+ a: { -+ @decl1() -+ } -+ b: { + @decl2(), @decl1() + x: 1 + } @@ -621,9 +525,9 @@ diff old new c2: { @step(2a) -- diff/value/todo/p1 -- -== Eval.doNotPropagate -.a: missing attribute. -#B: missing comment +comprehension: @step(4c) added in comprehensions +-- diff/value/todo/p3 -- +Reordering of attributes. -- out/value -- == Simplified { diff --git a/internal/core/export/testdata/main/def.txtar b/internal/core/export/testdata/main/def.txtar index 80d407c2713..94c84eb070e 100644 --- a/internal/core/export/testdata/main/def.txtar +++ b/internal/core/export/testdata/main/def.txtar @@ -38,98 +38,6 @@ g: #d [g e] [g f] --- out/value-v3 -- -== Simplified -{ - a: *2 | int - c: {} - g: { - e!: =~"a" - } -} -== Raw -{ - a: *2 | int - b?: 4 | 5 - c: {} - #d: { - e!: =~"a" - f?: 1 - } - g: { - e!: =~"a" - f?: 1 - } -} -== Final -{ - a: 2 - c: {} - g: { - e!: =~"a" - } -} -== All -{ - a: *2 | int - b?: 4 | 5 - c: {} - #d: { - e!: =~"a" - f?: 1 - } - g: { - e!: =~"a" - f?: 1 - } -} -== Eval -{ - a: 2 - b?: 4 | 5 - c: {} - #d: { - e!: =~"a" - f?: 1 - } - g: { - e!: =~"a" - f?: 1 - } -} --- diff/-out/value-v3<==>+out/value -- -diff old new ---- old -+++ new -@@ -2,8 +2,6 @@ - { - a: *2 | int - c: {} -- -- // Issue #2305 - g: { - e!: =~"a" - } -@@ -17,8 +15,6 @@ - e!: =~"a" - f?: 1 - } -- -- // Issue #2305 - g: { - e!: =~"a" - f?: 1 -@@ -41,8 +37,6 @@ - e!: =~"a" - f?: 1 - } -- -- // Issue #2305 - g: { - e!: =~"a" - f?: 1 --- diff/value/todo/p1 -- -Missing comments. -- out/value -- == Simplified { diff --git a/internal/core/export/value.go b/internal/core/export/value.go index bb06157de81..8d2507c1d80 100644 --- a/internal/core/export/value.go +++ b/internal/core/export/value.go @@ -446,8 +446,7 @@ func (e *exporter) structComposite(v *adt.Vertex, attrs []*ast.Attribute) ast.Ex internal.SetConstraint(f, arc.ArcType.Token()) - arc = arc.DerefValue() - f.Value = e.vertex(arc) + f.Value = e.vertex(arc.DerefValue()) if label.IsDef() { e.inDefinition-- diff --git a/internal/core/export/value_test.go b/internal/core/export/value_test.go index cf425237ab7..af3230206b1 100644 --- a/internal/core/export/value_test.go +++ b/internal/core/export/value_test.go @@ -37,11 +37,21 @@ var exclude = map[string]string{ } func TestValue(t *testing.T) { + const debugValue = ` +-- in.cue -- +// Issue #2305 +g: #d +#d: 1 +` + test := cuetxtar.TxTarTest{ Root: "./testdata/main", Name: "value", Skip: exclude, Matrix: cuetdtest.SmallMatrix, + + // Uncomment to debug an isolated test case. + // DebugArchive: debugValue, } test.Run(t, func(t *cuetxtar.Test) {