diff --git a/internal/core/export/testdata/main/adt.txtar b/internal/core/export/testdata/main/adt.txtar index 37d3d8e8e9e..9287b5b2ff4 100644 --- a/internal/core/export/testdata/main/adt.txtar +++ b/internal/core/export/testdata/main/adt.txtar @@ -337,6 +337,121 @@ Reordering. [errorListDef #Def] [errorListDef 0] [errorListDef 1] +-- out/value-v3 -- +== Simplified +_|_ // e3: index out of range [2] with length 2 +== Raw +_|_ // e3: index out of range [2] with length 2 +== Final +_|_ // e3: index out of range [2] with length 2 +== All +{ + @foo(bar) + p1: {} + d1: { + foobar: int + } + bar: "bar" + d2: { + foobar: { + name: "xx" + foo: "xx" + } + } + + // Issue #1910 + a: _ + comp: { + for k, v in [0] + let w = v { + "\(a)": w + "bar": w + } + } + bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)' + c1: true + s1: """ + multi + bar + line + """ + l1: [3, ...int] + l2: [...int] + l3: [] + l4: [1, 2] + l5: { + #foo: int + [1, 3] + } + #foo: int + l6: { + #foo: int + [1, 3] + } + n1: 1.0 + n10: 10 + + // t is true + t: true + e1: <1.0 + e2: >1.0 & <10 + e3: _|_ // e3: index out of range [2] with length 2 + e4: _|_ // e4: index 3 out of range (and 1 more errors) + e5: _|_ // e3: index out of range [2] with length 2 (and 1 more errors) + e6: false + e7: true + e8?: true + m1: { + // foo is an optional field + foo?: 3 + + // bar is a field + bar: 4 + + // baz is a required field. + baz!: 5 + } + y1: { + src: [1, 2, 3] + foo0: 1 + bar1: 2 + bar2: 3 + foo1: 2 + x: [1, 2, 3] + foo2: 3 + } + preserveKeyFieldInComprehension: 1 + errorStructDef: { + a: 1 + b: _|_ // errorStructDef.b: conflicting values 2 and 1 + #Def: 1 + } + errorList: [1, _|_] + x: int + errorListDef: { + #Def: 1 + [1, _|_] + } +} +== Eval +_|_ // e3: index out of range [2] with length 2 +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -56,8 +56,8 @@ + e1: <1.0 + e2: >1.0 & <10 + e3: _|_ // e3: index out of range [2] with length 2 +- e4: _|_ // e4: index 3 out of range +- e5: _|_ // e3: index out of range [2] with length 2 ++ e4: _|_ // e4: index 3 out of range (and 1 more errors) ++ e5: _|_ // e3: index out of range [2] with length 2 (and 1 more errors) + e6: false + e7: true + e8?: true +-- diff/value/todo/p3 -- +Error message change. -- out/value -- == Simplified _|_ // e3: index out of range [2] with length 2 diff --git a/internal/core/export/testdata/main/alias.txtar b/internal/core/export/testdata/main/alias.txtar index aa3e2572145..b53719cfd96 100644 --- a/internal/core/export/testdata/main/alias.txtar +++ b/internal/core/export/testdata/main/alias.txtar @@ -199,6 +199,422 @@ was known to compile and is known to be correct. [issue2374 a r] [issue2374 a z] [issue2374 a b] +-- out/value-v3 -- +== Simplified +{ + fieldAlias: { + simple: { + "a-b": 4 + foo: 4 + bar: 5 + "a-c": 5 + } + cross: { + baz: 3 + "d-2": {} + } + } + valueAlias: { + merge: { + // Merge fields, rename alias to avoid conflict. + // TODO: merged values can still be simplified. + value: { + b: 2 + v: { + X: 3 + } + } + } + selfRef: { + struct: { + a: { + b: { + b: 2 + } + } + } + } + selfRefValue: { + struct: { + // Note: this resolves to a cycle error, which is considered + // to be equal to "incomplete". As a result, in case of + // non-final evaluation, reference will remain. This is not + // an issue exclusive to value aliases, and falls within the + // range of what is acceptable for now. + // TODO: solve this issue. + a: or(X) + } + pattern: { + // this triggers the verbatim "adt" path. Note that there + // is no need to rename the variable here as the expression + // was known to compile and is known to be correct. + a: {} + } + } + } + issue1308: { + sub: [{}] + } + + // TODO: these could be merged into a single struct. + issue2374: { + a: { + r: 0 + z: 1 + b: null + } + } +} +== Raw +{ + fieldAlias: { + simple: { + "a-b": 4 + foo: 4 + bar: 5 + "a-c": 5 + } + cross: { + baz: 3 + "d-2": {} + } + } + valueAlias: { + merge: { + // Merge fields, rename alias to avoid conflict. + // TODO: merged values can still be simplified. + value: { + #value: 2 + b: 2 + v: { + X: 3 + } + } + } + selfRef: { + struct: { + a: { + b: { + #foo: 2 + b: 2 + } + } + } + } + selfRefValue: { + struct: { + // Note: this resolves to a cycle error, which is considered + // to be equal to "incomplete". As a result, in case of + // non-final evaluation, reference will remain. This is not + // an issue exclusive to value aliases, and falls within the + // range of what is acceptable for now. + // TODO: solve this issue. + a: or(X) + } + pattern: { + // this triggers the verbatim "adt" path. Note that there + // is no need to rename the variable here as the expression + // was known to compile and is known to be correct. + a: {} + } + } + } + issue1308: { + sub: [{ + _A: 1 + }] + } + + // TODO: these could be merged into a single struct. + issue2374: { + a: { + r: 0 + z: 1 + b: null + } + } +} +== Final +{ + fieldAlias: { + simple: { + "a-b": 4 + foo: 4 + bar: 5 + "a-c": 5 + } + cross: { + baz: 3 + "d-2": {} + } + } + valueAlias: { + merge: { + value: { + b: 2 + v: { + X: 3 + } + } + } + selfRef: { + struct: { + a: { + b: { + b: 2 + } + } + } + } + selfRefValue: { + struct: { + a: _|_ // valueAlias.selfRefValue.struct.a: incomplete list: _ (and 3 more errors) + } + pattern: { + a: {} + } + } + } + issue1308: { + sub: [{}] + } + issue2374: { + a: { + r: 0 + z: 1 + b: null + } + } +} +== All +{ + fieldAlias: { + simple: { + "a-b": 4 + foo: 4 + bar: 5 + "a-c": 5 + } + cross: { + baz: 3 + "d-2": {} + } + } + valueAlias: { + merge: { + // Merge fields, rename alias to avoid conflict. + // TODO: merged values can still be simplified. + value: { + #value: 2 + b: 2 + v: { + X: 3 + } + } + } + selfRef: { + struct: { + a: { + b: { + #foo: 2 + b: 2 + } + } + } + } + selfRefValue: { + struct: { + // Note: this resolves to a cycle error, which is considered + // to be equal to "incomplete". As a result, in case of + // non-final evaluation, reference will remain. This is not + // an issue exclusive to value aliases, and falls within the + // range of what is acceptable for now. + // TODO: solve this issue. + a: or(X) + } + pattern: { + // this triggers the verbatim "adt" path. Note that there + // is no need to rename the variable here as the expression + // was known to compile and is known to be correct. + a: {} + } + } + } + issue1308: { + sub: [{ + _A: 1 + }] + } + + // TODO: these could be merged into a single struct. + issue2374: { + a: { + r: 0 + z: 1 + b: null + } + } +} +== Eval +{ + fieldAlias: { + simple: { + "a-b": 4 + foo: 4 + bar: 5 + "a-c": 5 + } + cross: { + baz: 3 + "d-2": {} + } + } + valueAlias: { + merge: { + value: { + #value: 2 + b: 2 + v: { + X: 3 + } + } + } + selfRef: { + struct: { + a: { + b: { + #foo: 2 + b: 2 + } + } + } + } + selfRefValue: { + struct: { + a: or(X) + } + pattern: { + a: {} + } + } + } + issue1308: { + sub: [{}] + } + issue2374: { + a: { + r: 0 + z: 1 + b: null + } + } +} +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -4,6 +4,7 @@ + simple: { + "a-b": 4 + foo: 4 ++ bar: 5 + "a-c": 5 + } + cross: { +@@ -68,7 +69,7 @@ + simple: { + "a-b": 4 + foo: 4 +- bar?: 5 ++ bar: 5 + "a-c": 5 + } + cross: { +@@ -137,34 +138,35 @@ + simple: { + "a-b": 4 + foo: 4 +- "a-c": 5 +- } +- cross: { +- baz: 3 +- "d-2": {} +- } +- } +- valueAlias: { +- merge: { +- value: { +- b: 2 +- v: { +- X: 3 +- } +- } +- } +- selfRef: { +- struct: { +- a: { +- b: { +- b: 2 +- } +- } +- } +- } +- selfRefValue: { +- struct: { +- a: _|_ // cycle error ++ bar: 5 ++ "a-c": 5 ++ } ++ cross: { ++ baz: 3 ++ "d-2": {} ++ } ++ } ++ valueAlias: { ++ merge: { ++ value: { ++ b: 2 ++ v: { ++ X: 3 ++ } ++ } ++ } ++ selfRef: { ++ struct: { ++ a: { ++ b: { ++ b: 2 ++ } ++ } ++ } ++ } ++ selfRefValue: { ++ struct: { ++ a: _|_ // valueAlias.selfRefValue.struct.a: incomplete list: _ (and 3 more errors) + } + pattern: { + a: {} +@@ -188,7 +190,7 @@ + simple: { + "a-b": 4 + foo: 4 +- bar?: 5 ++ bar: 5 + "a-c": 5 + } + cross: { +@@ -257,7 +259,7 @@ + simple: { + "a-b": 4 + foo: 4 +- bar?: 5 ++ bar: 5 + "a-c": 5 + } + cross: { +-- diff/value/todo/p0 -- +Dropped optional field marker. +Reorderings? -- out/value -- == Simplified { diff --git a/internal/core/export/testdata/main/attrs.txtar b/internal/core/export/testdata/main/attrs.txtar index 11565e97747..869e16bc4cf 100644 --- a/internal/core/export/testdata/main/attrs.txtar +++ b/internal/core/export/testdata/main/attrs.txtar @@ -203,6 +203,427 @@ dynamicSimple: { [dynamicSimple] [dynamicSimple a] [dynamicSimple b] +-- out/value-v3 -- +== Simplified +{ + a: {} + doNotPropagate: { + a: {} + b: {} + } + embedScalarField: { + a: 2 + } + embedScalarDecl: { + b0: 2 + b1: 2 + b2: 2 + } + dontMergeForDef: { + a: {} + b: { + x: 1 + } + c: {} + d: {} + } + comprehensions: { + c1: {} + c2: {} + c3: {} + } + dynamicComplex: { + foo: "foo" + a: "foo" + } + dynamicSimple: { + a: "foo" + } +} +== Raw +{ + a: {} + doNotPropagate: { + #A: {} + a: {} + + // Do not accumulated field attributes in embedding. + #B: {} + b: {} + } + embedScalarField: { + a: 2 + } + embedScalarDecl: { + b0: 2 + b1: 2 + b2: 2 + } + dontMergeForDef: { + a: {} + b: { + x: 1 + } + c: {} + d: {} + } + comprehensions: { + c1: {} + c2: {} + c3: {} + } + dynamicComplex: { + foo: "foo" + a: "foo" + b?: "foo" + } + dynamicSimple: { + a: "foo" + b?: "foo" + } +} +== Final +{ + a: {} + doNotPropagate: { + a: {} + b: {} + } + embedScalarField: { + a: 2 + } + embedScalarDecl: { + b0: 2 + b1: 2 + b2: 2 + } + dontMergeForDef: { + a: {} + b: { + x: 1 + } + c: {} + d: {} + } + comprehensions: { + c1: {} + c2: {} + c3: {} + } + dynamicComplex: { + foo: "foo" + a: "foo" + } + dynamicSimple: { + a: "foo" + } +} +== All +{ + @file("foo") + + @file("bar") + a: { + @decl(1) + @decl(2) + @decl(3) + @decl(5) + } @field(2) @field(1) @field(4) @field(3) @field(5) + doNotPropagate: { + #A: {} @attr1() + 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 + } + c: { + @decl2(), @decl1() + } + d: { + @decl2(), @decl1() + } + } + comprehensions: { + @step(0) + @step(2c) + @step(4c) + c1: {} @step(1) + c2: { + @step(2a) + } @step(2b) + c3: {} @step(3) + } + dynamicComplex: { + foo: "foo" @step(1) @step(2) + a: "foo" @step(3) @step(2) + b?: "foo" @step(4) @step(2) + } + dynamicSimple: { + a: "foo" @step(3) + b?: "foo" @step(4) + } +} +== Eval +{ + @file("foo") + + @file("bar") + a: { + @decl(1) + @decl(2) + @decl(3) + @decl(5) + } @field(2) @field(1) @field(4) @field(3) @field(5) + doNotPropagate: { + #A: {} @attr1() + 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 + } + c: { + @decl2(), @decl1() + } + d: { + @decl2(), @decl1() + } + } + comprehensions: { + @step(0) + @step(2c) + @step(4c) + c1: {} @step(1) + c2: { + @step(2a) + } @step(2b) + c3: {} @step(3) + } + dynamicComplex: { + foo: "foo" @step(1) @step(2) + a: "foo" @step(3) @step(2) + b?: "foo" @step(4) @step(2) + } + dynamicSimple: { + a: "foo" @step(3) + b?: "foo" @step(4) + } +} +-- diff/-out/value-v3<==>+out/value -- +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: { +- @decl1(), @decl2() +- x: 1 +- } +- c: { +- @decl1(), @decl2() +- } +- d: { +- @decl2(), @decl1() +- } +- } +- 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 ++ } ++ c: { ++ @decl2(), @decl1() ++ } ++ d: { ++ @decl2(), @decl1() ++ } ++ } ++ comprehensions: { ++ @step(0) ++ @step(2c) ++ @step(4c) + 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: { +- @decl1(), @decl2() +- x: 1 +- } +- c: { +- @decl1(), @decl2() +- } +- d: { +- @decl2(), @decl1() +- } +- } +- 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 ++ } ++ c: { ++ @decl2(), @decl1() ++ } ++ d: { ++ @decl2(), @decl1() ++ } ++ } ++ comprehensions: { ++ @step(0) ++ @step(2c) ++ @step(4c) + c1: {} @step(1) + c2: { + @step(2a) +-- diff/value/todo/p1 -- +== Eval.doNotPropagate +.a: missing attribute. +#B: missing comment -- out/value -- == Simplified { diff --git a/internal/core/export/testdata/main/def.txtar b/internal/core/export/testdata/main/def.txtar index 871a7e27026..b6efad47cb4 100644 --- a/internal/core/export/testdata/main/def.txtar +++ b/internal/core/export/testdata/main/def.txtar @@ -61,6 +61,98 @@ Two missing entries. [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/testdata/main/docs.txtar b/internal/core/export/testdata/main/docs.txtar index 7488c191c39..aadd649d72f 100644 --- a/internal/core/export/testdata/main/docs.txtar +++ b/internal/core/export/testdata/main/docs.txtar @@ -248,6 +248,250 @@ sub: { innerField: y } } +-- out/value-v3 -- +== Simplified +{ + // A Foo fooses stuff. + Foo: { + // field1 is an int. + field1: int + field2: int + + // duplicate field comment + dup3: int + } + + // foos are instances of Foo. + foos: { + // My first little foo. + MyFoo: { + // local field comment. + + // field1 is an int. + field1: 0 + + // other field comment. + field2: 1 + + // duplicate field comment + dup3: int + } + } + bar: { + // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int + } + baz: { + // comment from baz on field 1 + + // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int + } + sub: { + // comment inside of if comprehension + field1: int + innerField: 1 + } +} +== Raw +{ + // A Foo fooses stuff. + Foo: { + // field1 is an int. + field1: int + field2: int + + // duplicate field comment + dup3: int + } + + // foos are instances of Foo. + foos: { + // My first little foo. + MyFoo: { + // local field comment. + + // field1 is an int. + field1: 0 + + // other field comment. + field2: 1 + + // duplicate field comment + dup3: int + } + } + bar: { + // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int + } + baz: { + // comment from baz on field 1 + + // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int + } + sub: { + // comment inside of if comprehension + field1: int + innerField: 1 + } +} +== Final +{ + Foo: { + field1: int + field2: int + dup3: int + } + foos: { + MyFoo: { + field1: 0 + field2: 1 + dup3: int + } + } + bar: { + field1: int + field2: int + } + baz: { + field1: int + field2: int + } + sub: { + field1: int + innerField: 1 + } +} +== All +{ + // A Foo fooses stuff. + Foo: { + // field1 is an int. + field1: int + field2: int + + // duplicate field comment + dup3: int + } + + // foos are instances of Foo. + foos: { + // My first little foo. + MyFoo: { + // local field comment. + + // field1 is an int. + field1: 0 + + // other field comment. + field2: 1 + + // duplicate field comment + dup3: int + } + } + bar: { + // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int + } + baz: { + // comment from baz on field 1 + + // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int + } + sub: { + // comment inside of if comprehension + field1: int + innerField: 1 + } +} +== Eval +{ + Foo: { + field1: int + field2: int + dup3: int + } + foos: { + MyFoo: { + field1: 0 + field2: 1 + dup3: int + } + } + bar: { + field1: int + field2: int + } + baz: { + field1: int + field2: int + } + sub: { + field1: int + innerField: 1 + } +} +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -33,9 +33,9 @@ + field2: int + } + baz: { +- // comment from bar on field 1 +- +- // comment from baz on field 1 ++ // comment from baz on field 1 ++ ++ // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int +@@ -81,9 +81,9 @@ + field2: int + } + baz: { +- // comment from bar on field 1 +- +- // comment from baz on field 1 ++ // comment from baz on field 1 ++ ++ // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int +@@ -156,9 +156,9 @@ + field2: int + } + baz: { +- // comment from bar on field 1 +- +- // comment from baz on field 1 ++ // comment from baz on field 1 ++ ++ // comment from bar on field 1 + field1: int + // comment from bar on field 2 + field2: int +-- diff/value/explanation -- +Reordering. -- out/value -- == Simplified { diff --git a/internal/core/export/testdata/main/dynamic.txtar b/internal/core/export/testdata/main/dynamic.txtar index 626eece8789..3e4004a340e 100644 --- a/internal/core/export/testdata/main/dynamic.txtar +++ b/internal/core/export/testdata/main/dynamic.txtar @@ -87,6 +87,215 @@ Missing lines. ["s-r"] ["s-q1"] ["s-q1" r1] +-- out/value-v3 -- +== Simplified +{ + x: string + X=(x): 4 + Y=(x): 6 + Z="y": int + a: { + labelX: X + labelY: Y + labelZ: Z + } + E=["cue"]: { + name: E | null + } + q: "q" + q1: "q1" + r: "r" + r1: "r1" + ("s-" + q)?: 1 + ("s-" + r)!: 2 + ("s-" + q1)?: { + (r1)!: 3 + } +} +== Raw +{ + x: string + X=(x): 4 + Y=(x): 6 + Z="y": int + a: { + labelX: X + labelY: Y + labelZ: Z + } + E=["cue"]: { + name: E | null + } + q: "q" + q1: "q1" + r: "r" + r1: "r1" + ("s-" + q)?: 1 + ("s-" + r)!: 2 + ("s-" + q1)?: { + (r1)!: 3 + } +} +== Final +_|_ // key value of dynamic field must be concrete, found string (and 2 more errors) +== All +{ + x: string + X=(x): 4 + Y=(x): 6 + Z="y": int + a: { + labelX: X + labelY: Y + labelZ: Z + } + E=["cue"]: { + name: E | null + } + q: "q" + q1: "q1" + r: "r" + r1: "r1" + ("s-" + q)?: 1 + ("s-" + r)!: 2 + ("s-" + q1)?: { + (r1)!: 3 + } +} +== Eval +{ + x: string + X=(x): 4 + Y=(x): 6 + Z="y": int + a: { + labelX: X + labelY: Y + labelZ: Z + } + E=["cue"]: { + name: E | null + } + q: "q" + q1: "q1" + r: "r" + r1: "r1" + ("s-" + q)?: 1 + ("s-" + r)!: 2 + ("s-" + q1)?: { + (r1)!: 3 + } +} +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -1,10 +1,98 @@ + == Simplified +-_|_ // invalid non-ground value string (must be concrete string) (and 1 more errors) ++{ ++ x: string ++ X=(x): 4 ++ Y=(x): 6 ++ Z="y": int ++ a: { ++ labelX: X ++ labelY: Y ++ labelZ: Z ++ } ++ E=["cue"]: { ++ name: E | null ++ } ++ q: "q" ++ q1: "q1" ++ r: "r" ++ r1: "r1" ++ ("s-" + q)?: 1 ++ ("s-" + r)!: 2 ++ ("s-" + q1)?: { ++ (r1)!: 3 ++ } ++} + == Raw +-_|_ // invalid non-ground value string (must be concrete string) (and 1 more errors) ++{ ++ x: string ++ X=(x): 4 ++ Y=(x): 6 ++ Z="y": int ++ a: { ++ labelX: X ++ labelY: Y ++ labelZ: Z ++ } ++ E=["cue"]: { ++ name: E | null ++ } ++ q: "q" ++ q1: "q1" ++ r: "r" ++ r1: "r1" ++ ("s-" + q)?: 1 ++ ("s-" + r)!: 2 ++ ("s-" + q1)?: { ++ (r1)!: 3 ++ } ++} + == Final +-_|_ // invalid non-ground value string (must be concrete string) (and 1 more errors) ++_|_ // key value of dynamic field must be concrete, found string (and 2 more errors) + == All +-_|_ // invalid non-ground value string (must be concrete string) (and 1 more errors) ++{ ++ x: string ++ X=(x): 4 ++ Y=(x): 6 ++ Z="y": int ++ a: { ++ labelX: X ++ labelY: Y ++ labelZ: Z ++ } ++ E=["cue"]: { ++ name: E | null ++ } ++ q: "q" ++ q1: "q1" ++ r: "r" ++ r1: "r1" ++ ("s-" + q)?: 1 ++ ("s-" + r)!: 2 ++ ("s-" + q1)?: { ++ (r1)!: 3 ++ } ++} + == Eval +-_|_ // invalid non-ground value string (must be concrete string) (and 1 more errors) ++{ ++ x: string ++ X=(x): 4 ++ Y=(x): 6 ++ Z="y": int ++ a: { ++ labelX: X ++ labelY: Y ++ labelZ: Z ++ } ++ E=["cue"]: { ++ name: E | null ++ } ++ q: "q" ++ q1: "q1" ++ r: "r" ++ r1: "r1" ++ ("s-" + q)?: 1 ++ ("s-" + r)!: 2 ++ ("s-" + q1)?: { ++ (r1)!: 3 ++ } ++} +-- diff/value/todo/p0 -- +Ignored errors? -- out/value -- == Simplified _|_ // invalid non-ground value string (must be concrete string) (and 1 more errors) diff --git a/internal/core/export/testdata/main/issue1284.txtar b/internal/core/export/testdata/main/issue1284.txtar index 761d0bdace6..8a0ebb7df89 100644 --- a/internal/core/export/testdata/main/issue1284.txtar +++ b/internal/core/export/testdata/main/issue1284.txtar @@ -72,6 +72,71 @@ a4: { [a4 l #foo] [a4 l 0] [a4 l 1] +-- out/value-v3 -- +== Simplified +_|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) +== Raw +_|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) +== Final +_|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) +== All +{ + a0: { + l: ["a", "b", ...] + } + a1: { + l: ["a", "b", ...] + } + a2: { + l: _|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) + } + a3: { + l: ["a", "b", ...] + } + a4: { + l: { + @decl(1) + #foo: 1 + ["a", "b", ...] + } + } +} +== Eval +_|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -1,9 +1,9 @@ + == Simplified +-_|_ // a2.l: conflicting values ["a","b",...] and {} (mismatched types list and struct) ++_|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) + == Raw +-_|_ // a2.l: conflicting values ["a","b",...] and {} (mismatched types list and struct) ++_|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) + == Final +-_|_ // a2.l: conflicting values ["a","b",...] and {} (mismatched types list and struct) ++_|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) + == All + { + a0: { +@@ -13,7 +13,7 @@ + l: ["a", "b", ...] + } + a2: { +- l: _|_ // a2.l: conflicting values ["a","b",...] and {} (mismatched types list and struct) ++ l: _|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) + } + a3: { + l: ["a", "b", ...] +@@ -27,4 +27,4 @@ + } + } + == Eval +-_|_ // a2.l: conflicting values ["a","b",...] and {} (mismatched types list and struct) ++_|_ // a2.l: conflicting values [...] and {} (mismatched types list and struct) +-- diff/value/todo/p2 -- +Slightly changed error messages. -- out/value -- == Simplified _|_ // a2.l: conflicting values ["a","b",...] and {} (mismatched types list and struct) diff --git a/internal/core/export/testdata/main/issue2584.txtar b/internal/core/export/testdata/main/issue2584.txtar index 8e66d0b55fa..4d3dc02601f 100644 --- a/internal/core/export/testdata/main/issue2584.txtar +++ b/internal/core/export/testdata/main/issue2584.txtar @@ -52,6 +52,88 @@ Missing line item. [F2 _] [D] [L] +-- out/value-v3 -- +== Simplified +{ + let L = D + F1: { + sub1: { + sub2: {} + } + } + F2: { + (string): _ + L + } + D: {} +} +== Raw +{ + let L = D + F1: { + sub1: { + sub2: {} + } + } + F2: { + (string): _ + L + } + D: {} +} +== Final +{ + F1: { + sub1: { + sub2: {} + } + } + F2: _|_ // F2: key value of dynamic field must be concrete, found string + D: {} +} +== All +{ + let L = D + F1: { + sub1: { + sub2: {} + } + } + F2: { + (string): _ + L + } + D: {} +} +== Eval +{ + let L = D + F1: { + sub1: { + sub2: {} + } + } + F2: { + (string): _ + L + } + D: {} +} +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -33,7 +33,7 @@ + sub2: {} + } + } +- F2: _|_ // F2: invalid non-ground value string (must be concrete string) ++ F2: _|_ // F2: key value of dynamic field must be concrete, found string + D: {} + } + == All +-- diff/value/todo/p2 -- +Seemingly benign change in error message. -- out/value -- == Simplified { diff --git a/internal/core/export/testdata/main/issue662.txtar b/internal/core/export/testdata/main/issue662.txtar index 7c65476f8c6..c3c8318be33 100644 --- a/internal/core/export/testdata/main/issue662.txtar +++ b/internal/core/export/testdata/main/issue662.txtar @@ -41,6 +41,79 @@ reordering [#GraphFieldConfig] [#GraphFieldConfig lineColor] [#GraphFieldConfig drawStyle] +-- out/value-v3 -- +== Simplified +{} +== Raw +{ + #LineConfig: { + lineColor?: string + } + #GraphFieldConfig: { + drawStyle?: int + lineColor?: string + } +} +== Final +{} +== All +{ + #LineConfig: { + lineColor?: string + } + #GraphFieldConfig: { + drawStyle?: int + lineColor?: string + } +} +== Eval +{ + #LineConfig: { + lineColor?: string + } + #GraphFieldConfig: { + drawStyle?: int + lineColor?: string + } +} +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -6,8 +6,8 @@ + lineColor?: string + } + #GraphFieldConfig: { +- lineColor?: string +- drawStyle?: int ++ drawStyle?: int ++ lineColor?: string + } + } + == Final +@@ -18,8 +18,8 @@ + lineColor?: string + } + #GraphFieldConfig: { +- lineColor?: string +- drawStyle?: int ++ drawStyle?: int ++ lineColor?: string + } + } + == Eval +@@ -28,7 +28,7 @@ + lineColor?: string + } + #GraphFieldConfig: { +- lineColor?: string +- drawStyle?: int ++ drawStyle?: int ++ lineColor?: string + } + } +-- diff/value/explanation -- +reordering -- out/value -- == Simplified {} diff --git a/internal/core/export/testdata/main/let.txtar b/internal/core/export/testdata/main/let.txtar index 0bb3ae57c55..dae53e1f0f0 100644 --- a/internal/core/export/testdata/main/let.txtar +++ b/internal/core/export/testdata/main/let.txtar @@ -472,6 +472,850 @@ Missing lines. [Y] [y] [Y] +-- out/value-v3 -- +== Simplified +{ + comprehension: { + for cfg in [{ + a: "one" + }] { + let filepath = "kind-\(cfg.name)" + "\(filepath)": { + patches: cfg + } + } + } + complete: { + x: "a foo z" + run: { + a: "foo" + } + } + cfgs: [{ + metadata: { + name: "one" + } + }, { + metadata: { + name: "two" + } + }] + files: { + "\("kind-\(cfg.name)")": { + patches: cfg + } + } + scoped: { + direct: { + a: 1 + } + embed1: { + a: 1 + } + embed2: { + a: 1 + } + list: { + a: [1] + } + listStruct: { + a: [{ + a: 1 + }] + } + listEmbed: { + a: [1] + } + } + x: "foo" + incomplete: { + a: { + x: "a \(run.a) z" + run: { + a: string + } + } + b: { + x: "a \(run.a) z" + run: { + a: string + } + } + c: { + x: "a \(run.a) z" + x2: "a \(run2.a) z" + run: { + a: string + } + run2: { + a: string + } + } + d: { + x: "a \(run.a) z" + x2: "a \(run2.a) z" + run: { + a: string + } + run2: { + a: string + } + } + } + unresolvedDisjunction: {} + y: "foo" +} +== Raw +{ + comprehension: { + for cfg in [{ + a: "one" + }] { + let filepath = "kind-\(cfg.name)" + "\(filepath)": { + patches: cfg + } + } + } + #Foo: 2 + complete: { + x: "a foo z" + run: { + a: "foo" + } + } + cfgs: [{ + metadata: { + name: "one" + } + }, { + metadata: { + name: "two" + } + }] + files: { + "\("kind-\(cfg.name)")": { + patches: cfg + } + } + scoped: { + _args: { + required: 1 + } + direct: { + a: 1 + } + embed1: { + a: 1 + } + embed2: { + a: 1 + } + list: { + a: [1] + } + listStruct: { + a: [{ + a: 1 + }] + } + listEmbed: { + a: [1] + } + } + x: "foo" + incomplete: { + a: { + x: "a \(run.a) z" + run: { + a: string + } + } + b: { + x: "a \(run.a) z" + run: { + a: string + } + } + c: { + x: "a \(run.a) z" + x2: "a \(run2.a) z" + run: { + a: string + } + run2: { + a: string + } + } + d: { + x: "a \(run.a) z" + x2: "a \(run2.a) z" + run: { + a: string + } + run2: { + a: string + } + } + } + unresolvedDisjunction: { + #TypePrimitive: { + _args: { + required: bool + } + "*": {} + } + #TypeBool: { + let Args = _args + _args: { + required: bool + } + + if !Args.required { + // `default` sets the default value. + default: bool | null + } + } + } + y: "foo" +} +== Final +{ + comprehension: _|_ // comprehension: key value of dynamic field must be concrete, found _|_(invalid interpolation: invalid interpolation: comprehension.filepath: undefined field: name (and 1 more errors)) (and 2 more errors) + complete: { + x: "a foo z" + run: { + a: "foo" + } + } + cfgs: [{ + metadata: { + name: "one" + } + }, { + metadata: { + name: "two" + } + }] + files: _|_ // files: key value of dynamic field must be concrete, found _|_(invalid interpolation: invalid interpolation: filepath: undefined field: name (and 3 more errors)) (and 9 more errors) + scoped: { + direct: { + a: 1 + } + embed1: { + a: 1 + } + embed2: { + a: 1 + } + list: { + a: [1] + } + listStruct: { + a: [{ + a: 1 + }] + } + listEmbed: { + a: [1] + } + } + x: "foo" + incomplete: { + a: { + x: _|_ // invalid interpolation: incomplete.a.x: non-concrete value string (type string) (and 1 more errors) + run: { + a: string + } + } + b: { + x: _|_ // invalid interpolation: incomplete.b.x: non-concrete value string (type string) (and 1 more errors) + run: { + a: string + } + } + c: { + x: _|_ // invalid interpolation: incomplete.c.x: non-concrete value string (type string) (and 1 more errors) + x2: _|_ // invalid interpolation: incomplete.c.x2: non-concrete value string (type string) (and 1 more errors) + run: { + a: string + } + run2: { + a: string + } + } + d: { + x: _|_ // invalid interpolation: incomplete.d.x: non-concrete value string (type string) (and 1 more errors) + x2: _|_ // invalid interpolation: incomplete.d.x2: non-concrete value string (type string) (and 1 more errors) + run: { + a: string + } + run2: { + a: string + } + } + } + unresolvedDisjunction: {} + y: "foo" +} +== All +{ + comprehension: { + for cfg in [{ + a: "one" + }] { + let filepath = "kind-\(cfg.name)" + "\(filepath)": { + patches: cfg + } + } + } + #Foo: 2 + complete: { + x: "a foo z" + run: { + a: "foo" + } + } + cfgs: [{ + metadata: { + name: "one" + } + }, { + metadata: { + name: "two" + } + }] + files: { + "\("kind-\(cfg.name)")": { + patches: cfg + } + } + scoped: { + _args: { + required: 1 + } + direct: { + a: 1 + } + embed1: { + a: 1 + } + embed2: { + a: 1 + } + list: { + a: [1] + } + listStruct: { + a: [{ + a: 1 + }] + } + listEmbed: { + a: [1] + } + } + x: "foo" + incomplete: { + a: { + x: "a \(run.a) z" + run: { + a: string + } + } + b: { + x: "a \(run.a) z" + run: { + a: string + } + } + c: { + x: "a \(run.a) z" + x2: "a \(run2.a) z" + run: { + a: string + } + run2: { + a: string + } + } + d: { + x: "a \(run.a) z" + x2: "a \(run2.a) z" + run: { + a: string + } + run2: { + a: string + } + } + } + unresolvedDisjunction: { + #TypePrimitive: { + _args: { + required: bool + } + "*": {} + } + #TypeBool: { + let Args = _args + _args: { + required: bool + } + + if !Args.required { + // `default` sets the default value. + default: bool | null + } + } + } + y: "foo" +} +== Eval +{ + comprehension: { + for cfg in [{ + a: "one" + }] { + let filepath = "kind-\(cfg.name)" + "\(filepath)": { + patches: cfg + } + } + } + #Foo: 2 + complete: { + x: "a foo z" + run: { + a: "foo" + } + } + cfgs: [{ + metadata: { + name: "one" + } + }, { + metadata: { + name: "two" + } + }] + files: { + "\("kind-\(cfg.name)")": { + patches: cfg + } + } + scoped: { + direct: { + a: 1 + } + embed1: { + a: 1 + } + embed2: { + a: 1 + } + list: { + a: [1] + } + listStruct: { + a: [{ + a: 1 + }] + } + listEmbed: { + a: [1] + } + } + x: "foo" + incomplete: { + a: { + x: "a \(run.a) z" + run: { + a: string + } + } + b: { + x: "a \(run.a) z" + run: { + a: string + } + } + c: { + x: "a \(run.a) z" + x2: "a \(run2.a) z" + run: { + a: string + } + run2: { + a: string + } + } + d: { + x: "a \(run.a) z" + x2: "a \(run2.a) z" + run: { + a: string + } + run2: { + a: string + } + } + } + unresolvedDisjunction: { + #TypePrimitive: { + "*": {} + } + #TypeBool: { + let Args = _args + _args: { + required: bool + } + + if !Args.required { + default: bool | null + } + } + } + y: "foo" +} +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -61,29 +61,24 @@ + } + } + b: { +- let A = run.a +- x: "a \(A) z" +- run: { +- a: string +- } +- } +- c: { +- let A_1 = run.a +- let A_2 = run2.a +- x: "a \(A_1) z" +- x2: "a \(A_2) z" +- run: { +- a: string +- } +- run2: { +- a: string +- } +- } +- d: { +- let A_3 = run.a +- let A_4 = run2.a +- x: "a \(A_3) z" +- x2: "a \(A_4) z" ++ x: "a \(run.a) z" ++ run: { ++ a: string ++ } ++ } ++ c: { ++ x: "a \(run.a) z" ++ x2: "a \(run2.a) z" ++ run: { ++ a: string ++ } ++ run2: { ++ a: string ++ } ++ } ++ d: { ++ x: "a \(run.a) z" ++ x2: "a \(run2.a) z" + run: { + a: string + } +@@ -162,29 +157,24 @@ + } + } + b: { +- let A = run.a +- x: "a \(A) z" +- run: { +- a: string +- } +- } +- c: { +- let A_1 = run.a +- let A_2 = run2.a +- x: "a \(A_1) z" +- x2: "a \(A_2) z" +- run: { +- a: string +- } +- run2: { +- a: string +- } +- } +- d: { +- let A_3 = run.a +- let A_4 = run2.a +- x: "a \(A_3) z" +- x2: "a \(A_4) z" ++ x: "a \(run.a) z" ++ run: { ++ a: string ++ } ++ } ++ c: { ++ x: "a \(run.a) z" ++ x2: "a \(run2.a) z" ++ run: { ++ a: string ++ } ++ run2: { ++ a: string ++ } ++ } ++ d: { ++ x: "a \(run.a) z" ++ x2: "a \(run2.a) z" + run: { + a: string + } +@@ -216,72 +206,72 @@ + } + == Final + { +- comprehension: _|_ // invalid interpolation: cycle error +- complete: { +- x: "a foo z" +- run: { +- a: "foo" +- } +- } +- cfgs: [{ +- metadata: { +- name: "one" +- } +- }, { +- metadata: { +- name: "two" +- } +- }] +- files: _|_ // invalid interpolation: cycle error (and 3 more errors) +- scoped: { +- direct: { +- a: 1 +- } +- embed1: { +- a: 1 +- } +- embed2: { +- a: 1 +- } +- list: { +- a: [1] +- } +- listStruct: { +- a: [{ +- a: 1 +- }] +- } +- listEmbed: { +- a: [1] +- } +- } +- x: "foo" +- incomplete: { +- a: { +- x: _|_ // invalid interpolation: incomplete.a.x: non-concrete value string (type string) +- run: { +- a: string +- } +- } +- b: { +- x: _|_ // invalid interpolation: incomplete.b.x: non-concrete value string (type string) +- run: { +- a: string +- } +- } +- c: { +- x: _|_ // invalid interpolation: incomplete.c.x: non-concrete value string (type string) +- x2: _|_ // invalid interpolation: incomplete.c.x2: non-concrete value string (type string) +- run: { +- a: string +- } +- run2: { +- a: string +- } +- } +- d: { +- x: _|_ // invalid interpolation: incomplete.d.x: non-concrete value string (type string) +- x2: _|_ // invalid interpolation: incomplete.d.x2: non-concrete value string (type string) ++ comprehension: _|_ // comprehension: key value of dynamic field must be concrete, found _|_(invalid interpolation: invalid interpolation: comprehension.filepath: undefined field: name (and 1 more errors)) (and 2 more errors) ++ complete: { ++ x: "a foo z" ++ run: { ++ a: "foo" ++ } ++ } ++ cfgs: [{ ++ metadata: { ++ name: "one" ++ } ++ }, { ++ metadata: { ++ name: "two" ++ } ++ }] ++ files: _|_ // files: key value of dynamic field must be concrete, found _|_(invalid interpolation: invalid interpolation: filepath: undefined field: name (and 3 more errors)) (and 9 more errors) ++ scoped: { ++ direct: { ++ a: 1 ++ } ++ embed1: { ++ a: 1 ++ } ++ embed2: { ++ a: 1 ++ } ++ list: { ++ a: [1] ++ } ++ listStruct: { ++ a: [{ ++ a: 1 ++ }] ++ } ++ listEmbed: { ++ a: [1] ++ } ++ } ++ x: "foo" ++ incomplete: { ++ a: { ++ x: _|_ // invalid interpolation: incomplete.a.x: non-concrete value string (type string) (and 1 more errors) ++ run: { ++ a: string ++ } ++ } ++ b: { ++ x: _|_ // invalid interpolation: incomplete.b.x: non-concrete value string (type string) (and 1 more errors) ++ run: { ++ a: string ++ } ++ } ++ c: { ++ x: _|_ // invalid interpolation: incomplete.c.x: non-concrete value string (type string) (and 1 more errors) ++ x2: _|_ // invalid interpolation: incomplete.c.x2: non-concrete value string (type string) (and 1 more errors) ++ run: { ++ a: string ++ } ++ run2: { ++ a: string ++ } ++ } ++ d: { ++ x: _|_ // invalid interpolation: incomplete.d.x: non-concrete value string (type string) (and 1 more errors) ++ x2: _|_ // invalid interpolation: incomplete.d.x2: non-concrete value string (type string) (and 1 more errors) + run: { + a: string + } +@@ -360,29 +350,24 @@ + } + } + b: { +- let A = run.a +- x: "a \(A) z" +- run: { +- a: string +- } +- } +- c: { +- let A_1 = run.a +- let A_2 = run2.a +- x: "a \(A_1) z" +- x2: "a \(A_2) z" +- run: { +- a: string +- } +- run2: { +- a: string +- } +- } +- d: { +- let A_3 = run.a +- let A_4 = run2.a +- x: "a \(A_3) z" +- x2: "a \(A_4) z" ++ x: "a \(run.a) z" ++ run: { ++ a: string ++ } ++ } ++ c: { ++ x: "a \(run.a) z" ++ x2: "a \(run2.a) z" ++ run: { ++ a: string ++ } ++ run2: { ++ a: string ++ } ++ } ++ d: { ++ x: "a \(run.a) z" ++ x2: "a \(run2.a) z" + run: { + a: string + } +@@ -476,29 +461,24 @@ + } + } + b: { +- let A = run.a +- x: "a \(A) z" +- run: { +- a: string +- } +- } +- c: { +- let A_1 = run.a +- let A_2 = run2.a +- x: "a \(A_1) z" +- x2: "a \(A_2) z" +- run: { +- a: string +- } +- run2: { +- a: string +- } +- } +- d: { +- let A_3 = run.a +- let A_4 = run2.a +- x: "a \(A_3) z" +- x2: "a \(A_4) z" ++ x: "a \(run.a) z" ++ run: { ++ a: string ++ } ++ } ++ c: { ++ x: "a \(run.a) z" ++ x2: "a \(run2.a) z" ++ run: { ++ a: string ++ } ++ run2: { ++ a: string ++ } ++ } ++ d: { ++ x: "a \(run.a) z" ++ x2: "a \(run2.a) z" + run: { + a: string + } +-- diff/value/todo/p0 -- +Large change, investigate. -- out/value -- == Simplified { diff --git a/internal/core/export/testdata/main/merge.txtar b/internal/core/export/testdata/main/merge.txtar index cc1840f22ff..bbc434ecfa9 100644 --- a/internal/core/export/testdata/main/merge.txtar +++ b/internal/core/export/testdata/main/merge.txtar @@ -75,6 +75,112 @@ Reordering. [#B #def] [#B #f] [#B #bar] +-- out/value-v3 -- +== Simplified +{} +== Raw +{ + #A: { + _ + #a: string + } + #E: _ + #F: _ + #G: _ + #B: { + 2 + #f: int + #def: 3 + #bar: int + #a: string + } +} +== Final +{} +== All +{ + #A: { + _ + #a: string + } + #E: _ + #F: _ + #G: _ + #B: { + 2 + #f: int + #def: 3 + #bar: int + #a: string + } +} +== Eval +{ + #A: { + _ + #a: string + } + #E: _ + #F: _ + #G: _ + #B: { + 2 + #f: int + #def: 3 + #bar: int + #a: string + } +} +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -11,10 +11,10 @@ + #G: _ + #B: { + 2 +- #a: string +- #f: int +- #def: 3 +- #bar: int ++ #f: int ++ #def: 3 ++ #bar: int ++ #a: string + } + } + == Final +@@ -30,10 +30,10 @@ + #G: _ + #B: { + 2 +- #a: string +- #f: int +- #def: 3 +- #bar: int ++ #f: int ++ #def: 3 ++ #bar: int ++ #a: string + } + } + == Eval +@@ -47,9 +47,9 @@ + #G: _ + #B: { + 2 +- #a: string +- #f: int +- #def: 3 +- #bar: int ++ #f: int ++ #def: 3 ++ #bar: int ++ #a: string + } + } +-- diff/value/todo/p2 -- +Reordering. -- out/value -- == Simplified {} diff --git a/internal/core/export/testdata/main/shadow.txtar b/internal/core/export/testdata/main/shadow.txtar index 0cdf87c0f6c..d94521e380c 100644 --- a/internal/core/export/testdata/main/shadow.txtar +++ b/internal/core/export/testdata/main/shadow.txtar @@ -385,6 +385,192 @@ or even [shadowField issue2378 a d] [shadowField issue2378 a d b] [shadowField issue2378 a d c] +-- out/value-v3 -- +== Simplified +_|_ // shadowRef.e1.x.x: structural cycle +== Raw +_|_ // shadowRef.e1.x.x: structural cycle +== Final +_|_ // shadowRef.e1.x.x: structural cycle +== All +{ + shadowRef: { + t1: { + x: { + x: null + } + } + t2: { + x: { + x: { + x: null + } + } + } + t3: { + x: { + x: { + x: { + x: null + } + } + } + } + t4: { + x: { + x: null + y: null + } + } + t5: { + x: { + x: null + } + } + e1: { + x: { + x: _|_ // shadowRef.e1.x.x: structural cycle + } + } + } + shadowAlias: { + t1: { + y: "outer" + a: { + key: "y" + y: "inner" + refs: { + y: 1 + outer: "outer" + mid: "inner" + inner: 1 + } + } + } + t2: { + a: { + key: "y" + y: "inner" + refs: { + y: 1 + outer: "outer" + mid: "inner" + inner: 1 + } + } + y: "outer" + } + } + shadowField: { + t1: { + z: { + b: 0 + d: { + b: 1 + c: 0 + } + } + } + t2: { + z: { + b: 0 + d: { + b: 1 + A: 1 + c: 0 + } + } + } + t4: { + merge: { + z: { + b: 0 + d: { + b: 1 + A: 1 + c: 0 + } + } + } + } + t5: { + merge: { + b: 0 + d: { + b: 1 + c: 0 + } + } + } + + // TODO: could be simplified to: + // A=b: 0 + // c: A + // or even + // b: 0 + // c: b + t6: { + x: { + b: 0 + c: 0 + } + } + issue2378: { + a: { + b: 0 + d: { + b: 1 + c: b & a.z + } + } + } + } +} +== Eval +_|_ // shadowRef.e1.x.x: structural cycle +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -1,9 +1,9 @@ + == Simplified +-_|_ // shadowRef.e1.x.x: structural cycle (and 1 more errors) ++_|_ // shadowRef.e1.x.x: structural cycle + == Raw +-_|_ // shadowRef.e1.x.x: structural cycle (and 1 more errors) ++_|_ // shadowRef.e1.x.x: structural cycle + == Final +-_|_ // shadowRef.e1.x.x: structural cycle (and 1 more errors) ++_|_ // shadowRef.e1.x.x: structural cycle + == All + { + shadowRef: { +@@ -41,7 +41,7 @@ + } + e1: { + x: { +- x: _|_ // shadowRef.e1.x.x: structural cycle (and 1 more errors) ++ x: _|_ // shadowRef.e1.x.x: structural cycle + } + } + } +@@ -132,7 +132,7 @@ + b: 0 + d: { + b: 1 +- c: A & a.z ++ c: b & a.z + } + } + } +@@ -139,4 +139,4 @@ + } + } + == Eval +-_|_ // shadowRef.e1.x.x: structural cycle (and 1 more errors) ++_|_ // shadowRef.e1.x.x: structural cycle +-- diff/value/todo/p1 -- +Changes may be related to sharing. Investigate. -- out/value -- == Simplified _|_ // shadowRef.e1.x.x: structural cycle (and 1 more errors) diff --git a/internal/core/export/testdata/main/simplify.txtar b/internal/core/export/testdata/main/simplify.txtar index a28e3c9e91e..f1820d92572 100644 --- a/internal/core/export/testdata/main/simplify.txtar +++ b/internal/core/export/testdata/main/simplify.txtar @@ -39,6 +39,85 @@ additional: { [additional] [additional env] [additional confs] +-- out/value-v3 -- +== Simplified +{ + x: { + y: int64 + } + s: strings.MinRunes(4) & strings.MaxRunes(7) + additional: { + env: _ + confs: { + if env {} + } + } +} +== Raw +{ + x: { + y: >=-9223372036854775808 & <=9223372036854775807 & int + } + s: strings.MinRunes(4) & strings.MaxRunes(7) + additional: { + env: _ + confs: { + if env {} + } + } +} +== Final +{ + x: { + y: int64 + } + s: strings.MinRunes(4) & strings.MaxRunes(7) + additional: { + env: _ + confs: _|_ // additional.confs: incomplete bool: _ (and 1 more errors) + } +} +== All +{ + x: { + y: int64 + } + s: strings.MinRunes(4) & strings.MaxRunes(7) + additional: { + env: _ + confs: { + if env {} + } + } +} +== Eval +{ + x: { + y: >=-9223372036854775808 & <=9223372036854775807 & int + } + s: strings.MinRunes(4) & strings.MaxRunes(7) + additional: { + env: _ + confs: { + if env {} + } + } +} +-- diff/-out/value-v3<==>+out/value -- +diff old new +--- old ++++ new +@@ -32,7 +32,7 @@ + s: strings.MinRunes(4) & strings.MaxRunes(7) + additional: { + env: _ +- confs: _|_ // additional.confs: incomplete bool: _ (and 2 more errors) ++ confs: _|_ // additional.confs: incomplete bool: _ (and 1 more errors) + } + } + == All +-- diff/value/explanation -- +Benign change in error message. -- out/value -- == Simplified { diff --git a/internal/core/export/value_test.go b/internal/core/export/value_test.go index bf5dd8d327f..81dd325d401 100644 --- a/internal/core/export/value_test.go +++ b/internal/core/export/value_test.go @@ -25,6 +25,7 @@ import ( "cuelang.org/go/internal/core/eval" "cuelang.org/go/internal/core/export" "cuelang.org/go/internal/core/runtime" + "cuelang.org/go/internal/cuetdtest" "cuelang.org/go/internal/cuetxtar" "golang.org/x/tools/txtar" ) @@ -35,14 +36,14 @@ var exclude = map[string]string{ func TestValue(t *testing.T) { test := cuetxtar.TxTarTest{ - Root: "./testdata/main", - Name: "value", - Skip: exclude, + Root: "./testdata/main", + Name: "value", + Skip: exclude, + Matrix: cuetdtest.SmallMatrix, } - r := runtime.New() - test.Run(t, func(t *cuetxtar.Test) { + r := t.Runtime() a := t.Instance() pkgID := a.ID()