diff --git a/cue/ast/astutil/testdata/resolve/comprehensions.txtar b/cue/ast/astutil/testdata/resolve/comprehensions.txtar index b4b89a54a..3f5e58f73 100644 --- a/cue/ast/astutil/testdata/resolve/comprehensions.txtar +++ b/cue/ast/astutil/testdata/resolve/comprehensions.txtar @@ -4,9 +4,8 @@ src: [{foo: 3}] for k, v in src let y = v.foo if y > 3 { - x: [k, v, y] + x: [k, v, y] } - -- out/resolve/in -- 3[src]: Scope: 0[] Node: 0[] 6[foo]: Scope: 0[] Node: 0[] @@ -25,7 +24,6 @@ if y > 3 { -- issue946.cue -- x: {for a in a {}} y: {for aa in a {}} - -- out/resolve/issue946 -- 3[x]: Scope: 0[] Node: 0[] 6[a]: Scope: 0[] Node: 0[] diff --git a/cue/ast/astutil/testdata/resolve/fieldalias.txtar b/cue/ast/astutil/testdata/resolve/fieldalias.txtar index cbd7c1c06..6d93d94fc 100644 --- a/cue/ast/astutil/testdata/resolve/fieldalias.txtar +++ b/cue/ast/astutil/testdata/resolve/fieldalias.txtar @@ -1,8 +1,7 @@ -- in.cue -- X=a: int -b: a -c: X - +b: a +c: X -- out/resolve/in -- 4[X]: Scope: 0[] Node: 0[] 5[a]: Scope: 0[] Node: 0[] @@ -13,11 +12,10 @@ c: X 12[X]: Scope: 1[*ast.File] Node: 2[X=a: int] -- dynamic.cue -- -X=("foo"): int -Y="\(X)": string -a: X -b: Y - +X=("foo"): int +Y="\(X)": string +a: X +b: Y -- out/resolve/dynamic -- 4[X]: Scope: 0[] Node: 0[] 5[int]: Scope: 0[] Node: 0[] diff --git a/cue/ast/astutil/testdata/resolve/labels.txtar b/cue/ast/astutil/testdata/resolve/labels.txtar index 7cd724a31..5907bf3ec 100644 --- a/cue/ast/astutil/testdata/resolve/labels.txtar +++ b/cue/ast/astutil/testdata/resolve/labels.txtar @@ -2,15 +2,14 @@ [X=string]: name: X a: X -Z=[string]: { x: string, y: Z.x } +Z=[string]: {x: string, y: Z.x} c: Z // `_` should not resolve. _: 1 x: _ -for _ in [1] { a: _ } - +for _ in [1] {a: _} -- out/resolve/in -- 4[X]: Scope: 0[] Node: 0[] 5[string]: Scope: 0[] Node: 0[] diff --git a/cue/ast/astutil/testdata/resolve/let.txtar b/cue/ast/astutil/testdata/resolve/let.txtar index b3a5f6645..14020cd8d 100644 --- a/cue/ast/astutil/testdata/resolve/let.txtar +++ b/cue/ast/astutil/testdata/resolve/let.txtar @@ -2,7 +2,6 @@ b: X let X = int a: X - -- out/resolve/let -- 3[b]: Scope: 0[] Node: 0[] 4[X]: Scope: 1[*ast.File] Node: 5[let X=int] diff --git a/cue/ast/astutil/testdata/resolve/value.txtar b/cue/ast/astutil/testdata/resolve/value.txtar index 3ba1621c0..eb803c693 100644 --- a/cue/ast/astutil/testdata/resolve/value.txtar +++ b/cue/ast/astutil/testdata/resolve/value.txtar @@ -1,8 +1,7 @@ -- in.cue -- b: X={ - c: X.a + c: X.a } - -- out/resolve/in -- 3[b]: Scope: 0[] Node: 0[] 5[X]: Scope: 0[] Node: 0[] diff --git a/cue/testdata/basicrewrite/aliases/aliases.txtar b/cue/testdata/basicrewrite/aliases/aliases.txtar index fb1d760b2..03436061b 100644 --- a/cue/testdata/basicrewrite/aliases/aliases.txtar +++ b/cue/testdata/basicrewrite/aliases/aliases.txtar @@ -5,9 +5,9 @@ t0: { _out: _b } t1: { - _a: b - let b = c - c=d: 3 + _a: b + let b = c + c=d: 3 } -- out/compile -- --- in.cue diff --git a/cue/testdata/benchmarks/disjunction.txtar b/cue/testdata/benchmarks/disjunction.txtar index 712409718..7ce9ca6b4 100644 --- a/cue/testdata/benchmarks/disjunction.txtar +++ b/cue/testdata/benchmarks/disjunction.txtar @@ -24,7 +24,6 @@ x: [_]: f: *1 | int x: [_]: f: *1 | int x: [_]: f: *1 | int - x: a0: {} -- out/compile -- --- in.cue diff --git a/cue/testdata/benchmarks/listdedup.txtar b/cue/testdata/benchmarks/listdedup.txtar index 4c6d33f5b..9f4c5b112 100644 --- a/cue/testdata/benchmarks/listdedup.txtar +++ b/cue/testdata/benchmarks/listdedup.txtar @@ -3,10 +3,10 @@ -- in.cue -- A: #Task -B: #steps: #Script & { mount: [A] } -C: #steps: #Script & { mount: [B] } +B: #steps: #Script & {mount: [A]} +C: #steps: #Script & {mount: [B]} -#Script: { mount: [...#Task] } +#Script: {mount: [...#Task]} #Task: { // Without the proper constructs, repeating the below results @@ -19,7 +19,7 @@ C: #steps: #Script & { mount: [B] } ... } -#ref: {a:1} | {b:2} +#ref: {a: 1} | {b: 2} -- out/eval -- (struct){ A: (#struct){ |((#struct){ diff --git a/cue/testdata/benchmarks/mergeddisjunction.txtar b/cue/testdata/benchmarks/mergeddisjunction.txtar index 56ae63661..73dab3172 100644 --- a/cue/testdata/benchmarks/mergeddisjunction.txtar +++ b/cue/testdata/benchmarks/mergeddisjunction.txtar @@ -26,7 +26,7 @@ a: { b: { for x in a { - "\(x.text)": { text: x.text } + "\(x.text)": {text: x.text} } } -- out/eval -- diff --git a/cue/testdata/builtins/all.txtar b/cue/testdata/builtins/all.txtar index 446da0961..c0df80c18 100644 --- a/cue/testdata/builtins/all.txtar +++ b/cue/testdata/builtins/all.txtar @@ -1,30 +1,28 @@ -- in.cue -- - fatalArg: { - x: len("eee" + 'eee') + x: len("eee" + 'eee') } // don't call builtin for a permanent error of a child node fatalChild: { - #b: {} - x: and([{a: #b.c}]) + #b: {} + x: and([{a: #b.c}]) } // allow incomplete child values. The error will persist after `and` is // evaluated down the line. This allows the and-ing of templates that may // complete later. okIncompleteChild: { - b: {} - x: and([{a: b.c}, {b: 1}]) + b: {} + x: and([{a: b.c}, {b: 1}]) } - -- out/eval -- Errors: fatalArg.x: invalid operands "eee" and 'eee' to '+' (type string and bytes): - ./in.cue:3:12 - ./in.cue:3:20 + ./in.cue:2:9 + ./in.cue:2:17 fatalChild.0.a: undefined field: c: - ./in.cue:9:20 + ./in.cue:8:17 Result: (_|_){ @@ -33,8 +31,8 @@ Result: // [eval] x: (_|_){ // [eval] fatalArg.x: invalid operands "eee" and 'eee' to '+' (type string and bytes): - // ./in.cue:3:12 - // ./in.cue:3:20 + // ./in.cue:2:9 + // ./in.cue:2:17 } } fatalChild: (_|_){ @@ -43,7 +41,7 @@ Result: } x: (_|_){ // [eval] fatalChild.0.a: undefined field: c: - // ./in.cue:9:20 + // ./in.cue:8:17 } } okIncompleteChild: (struct){ @@ -52,7 +50,7 @@ Result: x: (struct){ a: (_|_){ // [incomplete] okIncompleteChild.x.a: undefined field: c: - // ./in.cue:17:19 + // ./in.cue:16:16 } b: (int){ 1 } } diff --git a/cue/testdata/builtins/closed.txtar b/cue/testdata/builtins/closed.txtar index 72d7dc695..08f25f186 100644 --- a/cue/testdata/builtins/closed.txtar +++ b/cue/testdata/builtins/closed.txtar @@ -1,53 +1,52 @@ -- in.cue -- a: close({ - a: b: int + a: b: int }) -b: a & { x: int } // err -c: a & { a: c: int } // okay (non-recursive close) +b: a & {x: int} // err +c: a & {a: c: int} // okay (non-recursive close) inDisjunctions: { - x: [string]: #Def - #Def: [string]: { - a: b: true - let X = a - close({uint: a: b: X.b}) | close({string: a: b: true}) - } - x: socket: string: {} - x: syslog: x.socket - x: syslog: xxx: {} + x: [string]: #Def + #Def: [string]: { + a: b: true + let X = a + close({uint: a: b: X.b}) | close({string: a: b: true}) + } + x: socket: string: {} + x: syslog: x.socket + x: syslog: xxx: {} } issue642: { - test: close({ - a: _ - b: x: _ - } & { - [string]: y: _ - }) + test: close({ + a: _ + b: x: _ + } & { + [string]: y: _ + }) - test: a: x: _ - test: b: x: _ + test: a: x: _ + test: b: x: _ } // Issue 642 withSubfields: { - test: close({ - a: _ - b: x: _ - [string]: y: _ - }) + test: close({ + a: _ + b: x: _ + [string]: y: _ + }) - test: a: x: _ - test: b: x: _ + test: a: x: _ + test: b: x: _ } - -- out/eval -- Errors: b: field not allowed: x: ./in.cue:1:10 ./in.cue:5:4 - ./in.cue:5:10 + ./in.cue:5:9 Result: (_|_){ @@ -66,7 +65,7 @@ Result: // [eval] b: field not allowed: x: // ./in.cue:1:10 // ./in.cue:5:4 - // ./in.cue:5:10 + // ./in.cue:5:9 } } c: (#struct){ diff --git a/cue/testdata/builtins/incomplete.txtar b/cue/testdata/builtins/incomplete.txtar index 07d4476be..4194b0e1c 100644 --- a/cue/testdata/builtins/incomplete.txtar +++ b/cue/testdata/builtins/incomplete.txtar @@ -1,114 +1,113 @@ -- in.cue -- import ( - "list" - "strings" - "text/template" + "list" + "strings" + "text/template" ) - list1: { - // Note that Top is not incomplete, only its first element is. - // We allow FlattenN to proceed and pass on the incomplete values. - Out1: list.FlattenN(Top , 1) - Out2: [...] & list.FlattenN(Top , 1) - Out3: list.FlattenN(Top , 1) & [...] + // Note that Top is not incomplete, only its first element is. + // We allow FlattenN to proceed and pass on the incomplete values. + Out1: list.FlattenN(Top, 1) + Out2: [...] & list.FlattenN(Top, 1) + Out3: list.FlattenN(Top, 1) & [...] - // This evaluates to a list with an incomplete element. - Top: [ - [ for _, F in _Sub { F } ], - ] + // This evaluates to a list with an incomplete element. + Top: [ + [ for _, F in _Sub {F}], + ] - _Sub: a.b - a: {} // b does not + _Sub: a.b + a: {} // b does not } list2: { - Out1: list.FlattenN(_Top , 1) - Out2: [...] & list.FlattenN(_Top , 1) - Out3: list.FlattenN(_Top , 1) & [...] + Out1: list.FlattenN(_Top, 1) + Out2: [...] & list.FlattenN(_Top, 1) + Out3: list.FlattenN(_Top, 1) & [...] - // This evaluates to a list with an incomplete element. - _Top: [ - for _, F in #Sub { F } - ] + // This evaluates to a list with an incomplete element. + _Top: [ + for _, F in #Sub {F}, + ] + + #Sub: a.b - #Sub: a.b - a: {} // b does not + a: {} // b does not } value1: { - a: len('sf' | 'dd') + a: len('sf' | 'dd') } value2: { - len('sf' | 'dd') + len('sf' | 'dd') } incompleteArgDecimalList: { - a: #a & {param: 123} - #a: { - param: int - transformed: +param - max: list.Max([transformed]) - } + a: #a & {param: 123} + #a: { + param: int + transformed: +param + max: list.Max([transformed]) + } } incompleteArgStringList: { - a: #a & {param: "123"} - #a: { - param: string - transformed: param+"" - joined: strings.Join([transformed], "-") - } + a: #a & {param: "123"} + #a: { + param: string + transformed: param + "" + joined: strings.Join([transformed], "-") + } } incompleteList: { - x: _ - decimal: list.Max(x) - str: strings.Join(x, "") + x: _ + decimal: list.Max(x) + str: strings.Join(x, "") } incompleteListError: { - x: y + [] - y: _ - decimal: list.Max(x) - str: strings.Join(x, "") + x: y + [] + y: _ + decimal: list.Max(x) + str: strings.Join(x, "") } badListType: { - x: 2 - decimal: list.Max(x) - str: strings.Join(x, "") + x: 2 + decimal: list.Max(x) + str: strings.Join(x, "") } badListError: { - x: 2 + y - y: "foo" - decimal: list.Max(x) - str: strings.Join(x, "") + x: 2 + y + y: "foo" + decimal: list.Max(x) + str: strings.Join(x, "") } // Issue #1095 // Preserve combined error severity for multiple errors. multipleErrors: { - #T: { - params: { - x: string - y: string - } - out: template.Execute("{{.x}} {{.y}}", params) - } + #T: { + params: { + x: string + y: string + } + out: template.Execute("{{.x}} {{.y}}", params) + } } - -- out/eval -- Errors: badListType.decimal: cannot use 2 (type int) as list in argument 1 to list.Max: - ./in.cue:78:8 + ./in.cue:78:11 badListType.str: cannot use 2 (type int) as list in argument 1 to strings.Join: - ./in.cue:78:8 + ./in.cue:78:11 badListError.x: invalid operands 2 and "foo" to '+' (type int and string): - ./in.cue:84:8 - ./in.cue:85:8 + ./in.cue:84:11 + ./in.cue:85:11 Result: (_|_){ @@ -117,30 +116,30 @@ Result: Out1: (#list){ 0: (_|_){ // [incomplete] list1._Sub: undefined field: b: - // ./in.cue:20:13 + // ./in.cue:19:10 } } Out2: (#list){ 0: (_|_){ // [incomplete] list1._Sub: undefined field: b: - // ./in.cue:20:13 + // ./in.cue:19:10 } } Out3: (#list){ 0: (_|_){ // [incomplete] list1._Sub: undefined field: b: - // ./in.cue:20:13 + // ./in.cue:19:10 } } Top: (#list){ 0: (_|_){ // [incomplete] list1._Sub: undefined field: b: - // ./in.cue:20:13 + // ./in.cue:19:10 } } _Sub: (_|_){ // [incomplete] list1._Sub: undefined field: b: - // ./in.cue:20:13 + // ./in.cue:19:10 } a: (struct){ } @@ -148,23 +147,23 @@ Result: list2: (struct){ Out1: (_|_){ // [incomplete] list2.#Sub: undefined field: b: - // ./in.cue:34:13 + // ./in.cue:33:10 } Out2: (_|_){ // [incomplete] list2.#Sub: undefined field: b: - // ./in.cue:34:13 + // ./in.cue:33:10 } Out3: (_|_){ // [incomplete] list2.#Sub: undefined field: b: - // ./in.cue:34:13 + // ./in.cue:33:10 } _Top: (_|_){ // [incomplete] list2.#Sub: undefined field: b: - // ./in.cue:34:13 + // ./in.cue:33:10 } #Sub: (_|_){ // [incomplete] list2.#Sub: undefined field: b: - // ./in.cue:34:13 + // ./in.cue:33:10 } a: (struct){ } @@ -172,12 +171,12 @@ Result: value1: (struct){ a: (_|_){ // [incomplete] value1.a: unresolved disjunction 'sf' | 'dd' (type bytes): - // ./in.cue:39:8 + // ./in.cue:39:5 } } value2: (_|_){ // [incomplete] value2: unresolved disjunction 'sf' | 'dd' (type bytes): - // ./in.cue:43:5 + // ./in.cue:43:2 } incompleteArgDecimalList: (struct){ a: (#struct){ @@ -189,11 +188,11 @@ Result: param: (int){ int } transformed: (_|_){ // [incomplete] incompleteArgDecimalList.#a.transformed: operand param of '+' not concrete (was int): - // ./in.cue:50:23 + // ./in.cue:50:17 } max: (_|_){ // [incomplete] incompleteArgDecimalList.#a.0: operand param of '+' not concrete (was int): - // ./in.cue:50:23 + // ./in.cue:50:17 } } } @@ -207,12 +206,12 @@ Result: param: (string){ string } transformed: (_|_){ // [incomplete] incompleteArgStringList.#a.transformed: non-concrete value string in operand to +: - // ./in.cue:59:22 + // ./in.cue:59:16 // ./in.cue:58:16 } joined: (_|_){ // [incomplete] incompleteArgStringList.#a.0: non-concrete value string in operand to +: - // ./in.cue:59:22 + // ./in.cue:59:16 // ./in.cue:58:16 } } @@ -221,29 +220,29 @@ Result: x: (_){ _ } decimal: (_|_){ // [incomplete] incompleteList.decimal: non-concrete list for argument 0: - // ./in.cue:66:14 + // ./in.cue:66:11 } str: (_|_){ // [incomplete] incompleteList.str: non-concrete list for argument 0: - // ./in.cue:67:14 + // ./in.cue:67:11 } } incompleteListError: (struct){ x: (_|_){ // [incomplete] incompleteListError.x: non-concrete value _ in operand to +: - // ./in.cue:71:8 - // ./in.cue:72:8 + // ./in.cue:71:11 + // ./in.cue:72:11 } y: (_){ _ } decimal: (_|_){ // [incomplete] incompleteListError.x: non-concrete value _ in operand to +: - // ./in.cue:71:8 - // ./in.cue:72:8 + // ./in.cue:71:11 + // ./in.cue:72:11 } str: (_|_){ // [incomplete] incompleteListError.x: non-concrete value _ in operand to +: - // ./in.cue:71:8 - // ./in.cue:72:8 + // ./in.cue:71:11 + // ./in.cue:72:11 } } badListType: (_|_){ @@ -251,30 +250,30 @@ Result: x: (int){ 2 } decimal: (_|_){ // [eval] badListType.decimal: cannot use 2 (type int) as list in argument 1 to list.Max: - // ./in.cue:78:8 + // ./in.cue:78:11 } str: (_|_){ // [eval] badListType.str: cannot use 2 (type int) as list in argument 1 to strings.Join: - // ./in.cue:78:8 + // ./in.cue:78:11 } } badListError: (_|_){ // [eval] x: (_|_){ // [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string): - // ./in.cue:84:8 - // ./in.cue:85:8 + // ./in.cue:84:11 + // ./in.cue:85:11 } y: (string){ "foo" } decimal: (_|_){ // [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string): - // ./in.cue:84:8 - // ./in.cue:85:8 + // ./in.cue:84:11 + // ./in.cue:85:11 } str: (_|_){ // [eval] badListError.x: invalid operands 2 and "foo" to '+' (type int and string): - // ./in.cue:84:8 - // ./in.cue:85:8 + // ./in.cue:84:11 + // ./in.cue:85:11 } } multipleErrors: (struct){ @@ -285,8 +284,8 @@ Result: } out: (_|_){ // [incomplete] error in call to text/template.Execute: cannot convert non-concrete value string: - // ./in.cue:98:12 - // ./in.cue:95:9 + // ./in.cue:98:8 + // ./in.cue:95:4 } } } diff --git a/cue/testdata/builtins/intdiv.txtar b/cue/testdata/builtins/intdiv.txtar index d4e427dc6..630cadbbd 100644 --- a/cue/testdata/builtins/intdiv.txtar +++ b/cue/testdata/builtins/intdiv.txtar @@ -1,47 +1,43 @@ -- in.cue -- -quo1: quo(5, 2) // 2 -quo2: quo(5, -2) // -2 -quo3: quo(-5, 2) // -2 -quo4: quo(-5, -2) // 2 +quo1: quo(5, 2) // 2 +quo2: quo(5, -2) // -2 +quo3: quo(-5, 2) // -2 +quo4: quo(-5, -2) // 2 quoDivByZero: quo(2, 0) quoTypeError1: quo(2.0, 1) quoTypeError2: quo(2, 1.0) - -rem1: rem(5, 2) // 1 -rem2: rem(5, -2) // 1 -rem3: rem(-5, 2) // -1 -rem4: rem(-5, -2) // -1 +rem1: rem(5, 2) // 1 +rem2: rem(5, -2) // 1 +rem3: rem(-5, 2) // -1 +rem4: rem(-5, -2) // -1 remDivByZero: rem(2, 0) remTypeError1: rem(2.0, 1) remTypeError2: rem(2, 1.0) - -div1: div(5, 2) // 2 -div2: div(5, -2) // -2 -div3: div(-5, 2) // -3 -div4: div(-5, -2) // 3 +div1: div(5, 2) // 2 +div2: div(5, -2) // -2 +div3: div(-5, 2) // -3 +div4: div(-5, -2) // 3 divDivByZero: div(2, 0) divTypeError1: div(2.0, 1) divTypeError2: div(2, 1.0) - -mod1: mod(5, 2) // 1 -mod2: mod(5, -2) // 1 -mod3: mod(-5, 2) // 1 -mod4: mod(-5, -2) // 1 +mod1: mod(5, 2) // 1 +mod2: mod(5, -2) // 1 +mod3: mod(-5, 2) // 1 +mod4: mod(-5, -2) // 1 modDivByZero: mod(2, 0) modTypeError1: mod(2.0, 1) modTypeError2: mod(2, 1.0) - -- out/eval -- Errors: quoDivByZero: division by zero: @@ -51,23 +47,23 @@ quoTypeError1: cannot use 2.0 (type float) as int in argument 1 to quo: quoTypeError2: cannot use 1.0 (type float) as int in argument 2 to quo: ./in.cue:9:23 remDivByZero: division by zero: - ./in.cue:17:15 + ./in.cue:16:15 remTypeError1: cannot use 2.0 (type float) as int in argument 1 to rem: - ./in.cue:19:20 + ./in.cue:18:20 remTypeError2: cannot use 1.0 (type float) as int in argument 2 to rem: - ./in.cue:20:23 + ./in.cue:19:23 divDivByZero: division by zero: - ./in.cue:28:15 + ./in.cue:26:15 divTypeError1: cannot use 2.0 (type float) as int in argument 1 to div: - ./in.cue:30:20 + ./in.cue:28:20 divTypeError2: cannot use 1.0 (type float) as int in argument 2 to div: - ./in.cue:31:23 + ./in.cue:29:23 modDivByZero: division by zero: - ./in.cue:39:15 + ./in.cue:36:15 modTypeError1: cannot use 2.0 (type float) as int in argument 1 to mod: - ./in.cue:41:20 + ./in.cue:38:20 modTypeError2: cannot use 1.0 (type float) as int in argument 2 to mod: - ./in.cue:42:23 + ./in.cue:39:23 Result: (_|_){ @@ -94,15 +90,15 @@ Result: rem4: (int){ -1 } remDivByZero: (_|_){ // [eval] remDivByZero: division by zero: - // ./in.cue:17:15 + // ./in.cue:16:15 } remTypeError1: (_|_){ // [eval] remTypeError1: cannot use 2.0 (type float) as int in argument 1 to rem: - // ./in.cue:19:20 + // ./in.cue:18:20 } remTypeError2: (_|_){ // [eval] remTypeError2: cannot use 1.0 (type float) as int in argument 2 to rem: - // ./in.cue:20:23 + // ./in.cue:19:23 } div1: (int){ 2 } div2: (int){ -2 } @@ -110,15 +106,15 @@ Result: div4: (int){ 3 } divDivByZero: (_|_){ // [eval] divDivByZero: division by zero: - // ./in.cue:28:15 + // ./in.cue:26:15 } divTypeError1: (_|_){ // [eval] divTypeError1: cannot use 2.0 (type float) as int in argument 1 to div: - // ./in.cue:30:20 + // ./in.cue:28:20 } divTypeError2: (_|_){ // [eval] divTypeError2: cannot use 1.0 (type float) as int in argument 2 to div: - // ./in.cue:31:23 + // ./in.cue:29:23 } mod1: (int){ 1 } mod2: (int){ 1 } @@ -126,15 +122,15 @@ Result: mod4: (int){ 1 } modDivByZero: (_|_){ // [eval] modDivByZero: division by zero: - // ./in.cue:39:15 + // ./in.cue:36:15 } modTypeError1: (_|_){ // [eval] modTypeError1: cannot use 2.0 (type float) as int in argument 1 to mod: - // ./in.cue:41:20 + // ./in.cue:38:20 } modTypeError2: (_|_){ // [eval] modTypeError2: cannot use 1.0 (type float) as int in argument 2 to mod: - // ./in.cue:42:23 + // ./in.cue:39:23 } } -- out/compile -- diff --git a/cue/testdata/builtins/issue299.txtar b/cue/testdata/builtins/issue299.txtar index 8c1d446ee..1f5746f33 100644 --- a/cue/testdata/builtins/issue299.txtar +++ b/cue/testdata/builtins/issue299.txtar @@ -1,23 +1,24 @@ -- in.cue -- import "list" + x: list.UniqueItems x: [string, ...string] -x: ["x","x"] +x: ["x", "x"] -- out/eval -- Errors: x: invalid value ["x","x"] (does not satisfy list.UniqueItems): - ./in.cue:2:4 ./in.cue:3:4 ./in.cue:4:4 + ./in.cue:5:4 Result: (_|_){ // [eval] x: (_|_){ // [eval] x: invalid value ["x","x"] (does not satisfy list.UniqueItems): - // ./in.cue:2:4 // ./in.cue:3:4 // ./in.cue:4:4 + // ./in.cue:5:4 0: (string){ "x" } 1: (string){ "x" } } diff --git a/cue/testdata/builtins/list/issue332.txtar b/cue/testdata/builtins/list/issue332.txtar index f60859d1a..06d810e73 100644 --- a/cue/testdata/builtins/list/issue332.txtar +++ b/cue/testdata/builtins/list/issue332.txtar @@ -1,12 +1,13 @@ -- in.cue -- import "list" + #d: { #x: string result: [#x] } #foo: { X=#x: _ - y: list.FlattenN((#d & {#x: X}).result, 1) + y: list.FlattenN((#d & {#x: X}).result, 1) } r: #foo & { #x: "hello" diff --git a/cue/testdata/builtins/list/sort.txtar b/cue/testdata/builtins/list/sort.txtar index 238c78b80..e85779408 100644 --- a/cue/testdata/builtins/list/sort.txtar +++ b/cue/testdata/builtins/list/sort.txtar @@ -1,8 +1,7 @@ -- in.cue -- import "list" -a: list.Sort([2, 3, 1, 4], {x:_, y:_, less: x 2 { x } ] +a: [ 3, for x in list {x}, for x in list {x}] +b: [ 3, if true {3}, for x in list if x > 2 {x}] issue574: { - greet: true - bye: true + greet: true + bye: true - message1: [ - if greet { "hello" }, - "how are you doing?", - "bye", - ] + message1: [ + if greet {"hello"}, + "how are you doing?", + "bye", + ] - message2: [ - if !greet { "hello" }, - "how are you doing?", - if bye { - "bye" - }, - ] + message2: [ + if !greet {"hello"}, + "how are you doing?", + if bye { + "bye" + }, + ] } -- out/eval -- (struct){ diff --git a/cue/testdata/comprehensions/nested.txtar b/cue/testdata/comprehensions/nested.txtar index da1142a3d..855eb2c8d 100644 --- a/cue/testdata/comprehensions/nested.txtar +++ b/cue/testdata/comprehensions/nested.txtar @@ -1,5 +1,6 @@ -- in.cue -- package kube + service: "node-exporter": { spec: { ports: [{ @@ -30,7 +31,7 @@ service: [ID=string]: { }] } } -deployment: [ID=string]: { } +deployment: [ID=string]: {} deployment: [ID=_]: _spec & {} _spec: { _name: string @@ -72,7 +73,7 @@ for k, v in deployment { } selector: (_|_){ // [incomplete] service."node-exporter".spec.selector: undefined field: metadata: - // ./in.cue:47:35 + // ./in.cue:48:35 } } } diff --git a/cue/testdata/comprehensions/nested2.txtar b/cue/testdata/comprehensions/nested2.txtar index df3fc908f..e0b4ff215 100644 --- a/cue/testdata/comprehensions/nested2.txtar +++ b/cue/testdata/comprehensions/nested2.txtar @@ -4,23 +4,23 @@ given: { USD: GBP: 3.0 } hydrated: { - for k,v in given { - for k1,r in v { - "\(k)": "\(k)": 1.0 + for k, v in given { + for k1, r in v { + "\(k)": "\(k)": 1.0 "\(k1)": "\(k1)": 1.0 - "\(k)": "\(k1)": r - "\(k1)": "\(k)": number + "\(k)": "\(k1)": r + "\(k1)": "\(k)": number } } } foo: { - a: 10 - if a < 20 { - if a < 50 { - b: 20 - } - } + a: 10 + if a < 20 { + if a < 50 { + b: 20 + } + } } -- out/eval -- (struct){ diff --git a/cue/testdata/comprehensions/nestembed.txtar b/cue/testdata/comprehensions/nestembed.txtar index baa9c3f68..6c4aba93c 100644 --- a/cue/testdata/comprehensions/nestembed.txtar +++ b/cue/testdata/comprehensions/nestembed.txtar @@ -5,17 +5,17 @@ import "list" DeleteThis: ["this", "that"] useful_infra: { - gcp: cluters: 10 - aws: clusters: 20 + gcp: cluters: 10 + aws: clusters: 20 this: clusters: 1 that: clusters: 2 } New_infra: { - for k,v in useful_infra { - if !list.Contains(DeleteThis, k) { - "\(k)": v - } - } + for k, v in useful_infra { + if !list.Contains(DeleteThis, k) { + "\(k)": v + } + } } -- out/eval -- (struct){ diff --git a/cue/testdata/cycle/builtins.txtar b/cue/testdata/cycle/builtins.txtar index 0e4876682..9c2ba6be4 100644 --- a/cue/testdata/cycle/builtins.txtar +++ b/cue/testdata/cycle/builtins.txtar @@ -8,65 +8,65 @@ import "regexp" // builtin, effectively the entire struct needs to be evaluated and special care // should be taking to not evaluate too early. builtinCyclePerm0: { - X: "example.com" + X: "example.com" - Y: { - #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) - host: #components.host - } + Y: { + #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) + host: #components.host + } - X: Y.host + X: Y.host } builtinCyclePerm1: { - X: Y.host + X: Y.host - Y: { - #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) - host: #components.host - } + Y: { + #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) + host: #components.host + } - X: "example.com" + X: "example.com" } builtinCyclePerm2: { - Y: { - #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) - host: #components.host - } + Y: { + #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) + host: #components.host + } - X: Y.host - X: "example.com" + X: Y.host + X: "example.com" } builtinCyclePerm3: { - Y: { - #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) - host: #components.host - } + Y: { + #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) + host: #components.host + } - X: "example.com" - X: Y.host + X: "example.com" + X: Y.host } builtinCyclePerm4: { - X: "example.com" - X: Y.host + X: "example.com" + X: Y.host - Y: { - #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) - host: #components.host - } + Y: { + #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) + host: #components.host + } } builtinCyclePerm5: { - X: Y.host - X: "example.com" + X: Y.host + X: "example.com" - Y: { - #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) - host: #components.host - } + Y: { + #components: regexp.FindNamedSubmatch(#"^(?P[[:alnum:].]+)$"#, X) + host: #components.host + } } -- out/eval -- (struct){ diff --git a/cue/testdata/cycle/compbottom.txtar b/cue/testdata/cycle/compbottom.txtar index f55529e9e..52259f581 100644 --- a/cue/testdata/cycle/compbottom.txtar +++ b/cue/testdata/cycle/compbottom.txtar @@ -31,222 +31,221 @@ import "regexp" simple: { - #message: #"^(message: (?P.*))?$"# - - - p1: { - X: "message: hello" - #aux: { - if Y.message == _|_ { - message: "" - } - if Y.message != _|_ { - message: "message: " + Y.message - } - } - - Y: regexp.FindNamedSubmatch(#message, X) - X: #aux.message - } - - p2: { - #aux: { - if Y.message == _|_ { - message: "" - } - if Y.message != _|_ { - message: "message: " + Y.message - } - } - - X: "message: hello" - Y: regexp.FindNamedSubmatch(#message, X) - X: #aux.message - } - - p3: { - #aux: { - if Y.message == _|_ { - message: "" - } - if Y.message != _|_ { - message: "message: " + Y.message - } - } - - Y: regexp.FindNamedSubmatch(#message, X) - X: "message: hello" - X: #aux.message - } - - p4: { - X: #aux.message - #aux: { - if Y.message == _|_ { - message: "" - } - if Y.message != _|_ { - message: "message: " + Y.message - } - } - - Y: regexp.FindNamedSubmatch(#message, X) - X: "message: hello" - } - - p5: { - #aux: { - if Y.message == _|_ { - message: "" - } - if Y.message != _|_ { - message: "message: " + Y.message - } - } - - X: #aux.message - Y: regexp.FindNamedSubmatch(#message, X) - X: "message: hello" - } - - p6: { - #aux: { - if Y.message == _|_ { - message: "" - } - if Y.message != _|_ { - message: "message: " + Y.message - } - } - - Y: regexp.FindNamedSubmatch(#message, X) - X: #aux.message - X: "message: hello" - } + #message: #"^(message: (?P.*))?$"# + + p1: { + X: "message: hello" + #aux: { + if Y.message == _|_ { + message: "" + } + if Y.message != _|_ { + message: "message: " + Y.message + } + } + + Y: regexp.FindNamedSubmatch(#message, X) + X: #aux.message + } + + p2: { + #aux: { + if Y.message == _|_ { + message: "" + } + if Y.message != _|_ { + message: "message: " + Y.message + } + } + + X: "message: hello" + Y: regexp.FindNamedSubmatch(#message, X) + X: #aux.message + } + + p3: { + #aux: { + if Y.message == _|_ { + message: "" + } + if Y.message != _|_ { + message: "message: " + Y.message + } + } + + Y: regexp.FindNamedSubmatch(#message, X) + X: "message: hello" + X: #aux.message + } + + p4: { + X: #aux.message + #aux: { + if Y.message == _|_ { + message: "" + } + if Y.message != _|_ { + message: "message: " + Y.message + } + } + + Y: regexp.FindNamedSubmatch(#message, X) + X: "message: hello" + } + + p5: { + #aux: { + if Y.message == _|_ { + message: "" + } + if Y.message != _|_ { + message: "message: " + Y.message + } + } + + X: #aux.message + Y: regexp.FindNamedSubmatch(#message, X) + X: "message: hello" + } + + p6: { + #aux: { + if Y.message == _|_ { + message: "" + } + if Y.message != _|_ { + message: "message: " + Y.message + } + } + + Y: regexp.FindNamedSubmatch(#message, X) + X: #aux.message + X: "message: hello" + } } medium: { - #userHostPort: #"^((?P[[:alnum:]]*)@)?(?P[[:alnum:].]+)$"# - - p1: { - Y: { - userinfo: "user" - host: "example.com" - } - - X: #X.userinfo + #X.host - - #X: { - if Y.userinfo == _|_ { - userinfo: "" - } - if Y.userinfo != _|_ { - userinfo: Y.userinfo + "@" - } - - host: Y.host - } - - Y: { - if #Y.userinfo != _|_ { - userinfo: #Y.userinfo - } - - host: #Y.host - } - - #Y: regexp.FindNamedSubmatch(#userHostPort, X) - } - - p2: { - X: #X.userinfo + #X.host - - Y: { - userinfo: "user" - host: "example.com" - } - - #X: { - if Y.userinfo == _|_ { - userinfo: "" - } - if Y.userinfo != _|_ { - userinfo: Y.userinfo + "@" - } - - host: Y.host - } - - Y: { - if #Y.userinfo != _|_ { - userinfo: #Y.userinfo - } - - host: #Y.host - } - - #Y: regexp.FindNamedSubmatch(#userHostPort, X) - } - - p3: { - X: #X.userinfo + #X.host - - #X: { - if Y.userinfo == _|_ { - userinfo: "" - } - if Y.userinfo != _|_ { - userinfo: Y.userinfo + "@" - } - - host: Y.host - } - - Y: { - userinfo: "user" - host: "example.com" - } - - Y: { - if #Y.userinfo != _|_ { - userinfo: #Y.userinfo - } - - host: #Y.host - } - - #Y: regexp.FindNamedSubmatch(#userHostPort, X) - } - - p4: { - X: #X.userinfo + #X.host - - #X: { - if Y.userinfo == _|_ { - userinfo: "" - } - if Y.userinfo != _|_ { - userinfo: Y.userinfo + "@" - } - - host: Y.host - } - - Y: { - if #Y.userinfo != _|_ { - userinfo: #Y.userinfo - } - - host: #Y.host - } - - #Y: regexp.FindNamedSubmatch(#userHostPort, X) - - Y: { - userinfo: "user" - host: "example.com" - } - } + #userHostPort: #"^((?P[[:alnum:]]*)@)?(?P[[:alnum:].]+)$"# + + p1: { + Y: { + userinfo: "user" + host: "example.com" + } + + X: #X.userinfo + #X.host + + #X: { + if Y.userinfo == _|_ { + userinfo: "" + } + if Y.userinfo != _|_ { + userinfo: Y.userinfo + "@" + } + + host: Y.host + } + + Y: { + if #Y.userinfo != _|_ { + userinfo: #Y.userinfo + } + + host: #Y.host + } + + #Y: regexp.FindNamedSubmatch(#userHostPort, X) + } + + p2: { + X: #X.userinfo + #X.host + + Y: { + userinfo: "user" + host: "example.com" + } + + #X: { + if Y.userinfo == _|_ { + userinfo: "" + } + if Y.userinfo != _|_ { + userinfo: Y.userinfo + "@" + } + + host: Y.host + } + + Y: { + if #Y.userinfo != _|_ { + userinfo: #Y.userinfo + } + + host: #Y.host + } + + #Y: regexp.FindNamedSubmatch(#userHostPort, X) + } + + p3: { + X: #X.userinfo + #X.host + + #X: { + if Y.userinfo == _|_ { + userinfo: "" + } + if Y.userinfo != _|_ { + userinfo: Y.userinfo + "@" + } + + host: Y.host + } + + Y: { + userinfo: "user" + host: "example.com" + } + + Y: { + if #Y.userinfo != _|_ { + userinfo: #Y.userinfo + } + + host: #Y.host + } + + #Y: regexp.FindNamedSubmatch(#userHostPort, X) + } + + p4: { + X: #X.userinfo + #X.host + + #X: { + if Y.userinfo == _|_ { + userinfo: "" + } + if Y.userinfo != _|_ { + userinfo: Y.userinfo + "@" + } + + host: Y.host + } + + Y: { + if #Y.userinfo != _|_ { + userinfo: #Y.userinfo + } + + host: #Y.host + } + + #Y: regexp.FindNamedSubmatch(#userHostPort, X) + + Y: { + userinfo: "user" + host: "example.com" + } + } } -- out/eval -- (struct){ diff --git a/cue/testdata/cycle/compbottom2.txtar b/cue/testdata/cycle/compbottom2.txtar index 18569a55b..0de28238f 100644 --- a/cue/testdata/cycle/compbottom2.txtar +++ b/cue/testdata/cycle/compbottom2.txtar @@ -1,63 +1,62 @@ -- in.cue -- - self: { - fail: { - a: { - if a.b == _|_ { - b: 1 - } - } - } - isConcreteFail: { - a: { - if a.b == _|_ { - b: 1 - } - b: int - } - } - isNotConcrete: { - a: { - if a.b != _|_ { - b: 1 - } - b: int - } - } + fail: { + a: { + if a.b == _|_ { + b: 1 + } + } + } + isConcreteFail: { + a: { + if a.b == _|_ { + b: 1 + } + b: int + } + } + isNotConcrete: { + a: { + if a.b != _|_ { + b: 1 + } + b: int + } + } } mutual: { noConflicts: { - a: { if b.foo == _|_ { new: "" } } - b: { if a.bar == _|_ { new: "" } } + a: {if b.foo == _|_ {new: ""}} + b: {if a.bar == _|_ {new: ""}} } mutualCycleFail: { - b: { if a.bar == _|_ { foo: "" } } - a: { if b.foo == _|_ { bar: "" } } + b: {if a.bar == _|_ {foo: ""}} + a: {if b.foo == _|_ {bar: ""}} } - brokenCycleSuccess: { - a: { if b.foo == _|_ { foo: "" } } - b: { if a.bar == _|_ { bar: "" } } - a: bar: "" + brokenCycleSuccess: { + a: {if b.foo == _|_ {foo: ""}} + b: {if a.bar == _|_ {bar: ""}} + a: bar: "" } oneDirectionalConflictFail: { - p1: { - a: { if b.foo == _|_ { bar: "" } } - b: { if a.bar == _|_ { new: "" } } - } - p2: { - a: { if b.foo == _|_ { new: "" } } - b: { if a.bar == _|_ { foo: "" } } - } + p1: { + a: {if b.foo == _|_ {bar: ""}} + b: {if a.bar == _|_ {new: ""}} + } + p2: { + a: {if b.foo == _|_ {new: ""}} + b: {if a.bar == _|_ {foo: ""}} + } } oneDirectionalBrokenConflictSuccess: { - a: { if b.foo == _|_ { bar: "" } } - b: { if a.bar == _|_ { new: "" } } - b: foo: "" + a: {if b.foo == _|_ {bar: ""}} + b: {if a.bar == _|_ {new: ""}} + b: foo: "" } } @@ -87,16 +86,16 @@ sameStruct: { defCloseSuccess: { #Example: { raises?: { - runtime?: string + runtime?: string } - + if raises == _|_ { ret?: _ } } expr: #Example & { - ret: 2 + ret: 2 } } } @@ -121,11 +120,11 @@ nestedChain: { #E: x: true } #E: [_]: bool - #E: x: true + #E: x: true } - // TODO: the current algorithm does _not_ handle checking fields that were - // not added in certain situations. + // TODO: the current algorithm does _not_ handle checking fields that were + // not added in certain situations. doubleAddfail: { if #E.x == _|_ { #E: y: true diff --git a/cue/testdata/cycle/compbottomnofinal.txtar b/cue/testdata/cycle/compbottomnofinal.txtar index da66ae149..3dfb7406c 100644 --- a/cue/testdata/cycle/compbottomnofinal.txtar +++ b/cue/testdata/cycle/compbottomnofinal.txtar @@ -10,352 +10,351 @@ import ( // // This tests shows the essences of when an existence check cannot be resolved. minimal: { - a: { - if b.port == _|_ { - port: "" - } - } + a: { + if b.port == _|_ { + port: "" + } + } - b: { - if a.port == _|_ { - port: "" - } - } + b: { + if a.port == _|_ { + port: "" + } + } } small: { - #userHostPort: #"^(:(?P\d+))?$"# + #userHostPort: #"^(:(?P\d+))?$"# - p1: { + p1: { #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) - #X: { - if #Y.port == _|_ { - port: "" - } - if #Y.port != _|_ { - port: ":" + strconv.FormatInt(#Y.port, 10) - } - } + #X: { + if #Y.port == _|_ { + port: "" + } + if #Y.port != _|_ { + port: ":" + strconv.FormatInt(#Y.port, 10) + } + } } - p2: { - #X: { - if #Y.port == _|_ { - port: "" - } - if #Y.port != _|_ { - port: ":" + strconv.FormatInt(#Y.port, 10) - } - } + p2: { + #X: { + if #Y.port == _|_ { + port: "" + } + if #Y.port != _|_ { + port: ":" + strconv.FormatInt(#Y.port, 10) + } + } #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) } } medium: { - #userHostPort: #"^(:(?P\d+))?$"# - - p1: { - #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) + #userHostPort: #"^(:(?P\d+))?$"# - Y: { - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } - - #X: { - // Can never determine whether Y.port exists as its resolution - // depends on #Y becoming finalized, which, in turn, depends on #X - // becoming finalized. - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } - } - - p2: { - #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) - - #X: { - // Can never determine whether Y.port exists as its resolution - // depends on #Y becoming finalized, which, in turn, depends on #X - // becoming finalized. - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } + p1: { + #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) - Y: { - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } + Y: { + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } + + #X: { + // Can never determine whether Y.port exists as its resolution + // depends on #Y becoming finalized, which, in turn, depends on #X + // becoming finalized. + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } } - p3: { - Y: { - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } + p2: { + #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) - #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) + #X: { + // Can never determine whether Y.port exists as its resolution + // depends on #Y becoming finalized, which, in turn, depends on #X + // becoming finalized. + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } + + Y: { + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } + } - #X: { - // Can never determine whether Y.port exists as its resolution - // depends on #Y becoming finalized, which, in turn, depends on #X - // becoming finalized. - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } - } + p3: { + Y: { + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } - p4: { - Y: { - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } + #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) - #X: { - // Can never determine whether Y.port exists as its resolution - // depends on #Y becoming finalized, which, in turn, depends on #X - // becoming finalized. - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } + #X: { + // Can never determine whether Y.port exists as its resolution + // depends on #Y becoming finalized, which, in turn, depends on #X + // becoming finalized. + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } + } - #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) - } + p4: { + Y: { + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } + + #X: { + // Can never determine whether Y.port exists as its resolution + // depends on #Y becoming finalized, which, in turn, depends on #X + // becoming finalized. + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } - p5: { - #X: { - // Can never determine whether Y.port exists as its resolution - // depends on #Y becoming finalized, which, in turn, depends on #X - // becoming finalized. - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } + #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) + } - #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) + p5: { + #X: { + // Can never determine whether Y.port exists as its resolution + // depends on #Y becoming finalized, which, in turn, depends on #X + // becoming finalized. + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } - Y: { - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } - } + #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) - p6: { - #X: { - // Can never determine whether Y.port exists as its resolution - // depends on #Y becoming finalized, which, in turn, depends on #X - // becoming finalized. - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } + Y: { + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } + } - Y: { - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } + p6: { + #X: { + // Can never determine whether Y.port exists as its resolution + // depends on #Y becoming finalized, which, in turn, depends on #X + // becoming finalized. + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } + + Y: { + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } - #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) - } + #Y: regexp.FindNamedSubmatch(#userHostPort, #X.port) + } } - large: { - #userHostPort: #"^((?P[[:alnum:]]*)@)?(?P[[:alnum:].]+)(:(?P\d+))?$"# - - p1: { - Y: { - userinfo: "user" - host: "example.com" - } - - X: #X.userinfo + #X.host + #X.port - - #X: { - if Y.userinfo == _|_ { - userinfo: "" - } - if Y.userinfo != _|_ { - userinfo: Y.userinfo + "@" - } - - host: Y.host - - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } - - Y: { - if #Y.userinfo != _|_ { - userinfo: #Y.userinfo - } - - host: #Y.host - - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } - - #Y: regexp.FindNamedSubmatch(#userHostPort, X) - } - - p2: { - X: #X.userinfo + #X.host + #X.port - - Y: { - userinfo: "user" - host: "example.com" - } - - #X: { - if Y.userinfo == _|_ { - userinfo: "" - } - if Y.userinfo != _|_ { - userinfo: Y.userinfo + "@" - } - - host: Y.host - - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } - - Y: { - if #Y.userinfo != _|_ { - userinfo: #Y.userinfo - } - - host: #Y.host - - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } - - #Y: regexp.FindNamedSubmatch(#userHostPort, X) - } - - p3: { - X: #X.userinfo + #X.host + #X.port - - #X: { - if Y.userinfo == _|_ { - userinfo: "" - } - if Y.userinfo != _|_ { - userinfo: Y.userinfo + "@" - } - - host: Y.host - - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } - - Y: { - userinfo: "user" - host: "example.com" - } - - Y: { - if #Y.userinfo != _|_ { - userinfo: #Y.userinfo - } - - host: #Y.host - - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } - - #Y: regexp.FindNamedSubmatch(#userHostPort, X) - } - - p4: { - X: #X.userinfo + #X.host + #X.port - - #X: { - if Y.userinfo == _|_ { - userinfo: "" - } - if Y.userinfo != _|_ { - userinfo: Y.userinfo + "@" - } - - host: Y.host - - if Y.port == _|_ { - port: "" - } - if Y.port != _|_ { - port: ":" + strconv.FormatInt(Y.port, 10) - } - } - - #Y: regexp.FindNamedSubmatch(#userHostPort, X) - - Y: { - userinfo: "user" - host: "example.com" - } + #userHostPort: #"^((?P[[:alnum:]]*)@)?(?P[[:alnum:].]+)(:(?P\d+))?$"# + + p1: { + Y: { + userinfo: "user" + host: "example.com" + } + + X: #X.userinfo + #X.host + #X.port + + #X: { + if Y.userinfo == _|_ { + userinfo: "" + } + if Y.userinfo != _|_ { + userinfo: Y.userinfo + "@" + } + + host: Y.host + + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } + + Y: { + if #Y.userinfo != _|_ { + userinfo: #Y.userinfo + } + + host: #Y.host + + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } + + #Y: regexp.FindNamedSubmatch(#userHostPort, X) + } - Y: { - if #Y.userinfo != _|_ { - userinfo: #Y.userinfo - } + p2: { + X: #X.userinfo + #X.host + #X.port + + Y: { + userinfo: "user" + host: "example.com" + } + + #X: { + if Y.userinfo == _|_ { + userinfo: "" + } + if Y.userinfo != _|_ { + userinfo: Y.userinfo + "@" + } + + host: Y.host + + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } + + Y: { + if #Y.userinfo != _|_ { + userinfo: #Y.userinfo + } + + host: #Y.host + + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } + + #Y: regexp.FindNamedSubmatch(#userHostPort, X) + } - host: #Y.host + p3: { + X: #X.userinfo + #X.host + #X.port + + #X: { + if Y.userinfo == _|_ { + userinfo: "" + } + if Y.userinfo != _|_ { + userinfo: Y.userinfo + "@" + } + + host: Y.host + + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } + + Y: { + userinfo: "user" + host: "example.com" + } + + Y: { + if #Y.userinfo != _|_ { + userinfo: #Y.userinfo + } + + host: #Y.host + + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } + + #Y: regexp.FindNamedSubmatch(#userHostPort, X) + } - if #Y.port != _|_ { - port: strconv.Atoi(#Y.port) - } - } - } + p4: { + X: #X.userinfo + #X.host + #X.port + + #X: { + if Y.userinfo == _|_ { + userinfo: "" + } + if Y.userinfo != _|_ { + userinfo: Y.userinfo + "@" + } + + host: Y.host + + if Y.port == _|_ { + port: "" + } + if Y.port != _|_ { + port: ":" + strconv.FormatInt(Y.port, 10) + } + } + + #Y: regexp.FindNamedSubmatch(#userHostPort, X) + + Y: { + userinfo: "user" + host: "example.com" + } + + Y: { + if #Y.userinfo != _|_ { + userinfo: #Y.userinfo + } + + host: #Y.host + + if #Y.port != _|_ { + port: strconv.Atoi(#Y.port) + } + } + } } -- out/eval -- Errors: @@ -372,15 +371,15 @@ medium.p4.Y: cycle: field inserted by if clause that was previously evaluated by minimal.b: cycle: field inserted by if clause that was previously evaluated by another if clause: port small.p1.#Y: cycle: field was added after an if clause evaluated it: port error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - ./in.cue:104:23 + ./in.cue:104:11 error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - ./in.cue:126:23 + ./in.cue:126:11 error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - ./in.cue:228:23 + ./in.cue:227:11 error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - ./in.cue:269:23 + ./in.cue:268:11 error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - ./in.cue:310:23 + ./in.cue:309:11 Result: (_|_){ @@ -451,7 +450,7 @@ Result: // [eval] medium.p3.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port port: (_|_){ // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - // ./in.cue:104:23 + // ./in.cue:104:11 } } #Y: (#struct){ @@ -467,7 +466,7 @@ Result: // [eval] medium.p4.Y: cycle: field inserted by if clause that was previously evaluated by another if clause: port port: (_|_){ // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - // ./in.cue:126:23 + // ./in.cue:126:11 } } #X: (#struct){ @@ -483,7 +482,7 @@ Result: } #Y: (_|_){ // [incomplete] medium.p5.#Y: undefined field: port: - // ./in.cue:158:56 + // ./in.cue:158:50 port: (string){ "" } } Y: (struct){ @@ -497,7 +496,7 @@ Result: } #Y: (_|_){ // [incomplete] medium.p6.#Y: undefined field: port: - // ./in.cue:186:56 + // ./in.cue:186:50 port: (string){ "" } } } @@ -513,7 +512,7 @@ Result: host: (string){ "example.com" } port: (_|_){ // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - // ./in.cue:228:23 + // ./in.cue:227:11 } } X: (string){ "user@example.com" } @@ -537,7 +536,7 @@ Result: host: (string){ "example.com" } port: (_|_){ // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - // ./in.cue:269:23 + // ./in.cue:268:11 } } #X: (#struct){ @@ -566,7 +565,7 @@ Result: host: (string){ "example.com" } port: (_|_){ // [eval] error in call to strconv.Atoi: strconv.Atoi: parsing "": invalid syntax: - // ./in.cue:310:23 + // ./in.cue:309:11 } } #Y: (_|_){ diff --git a/cue/testdata/cycle/comprehension.txtar b/cue/testdata/cycle/comprehension.txtar index 32f5e29ac..aad865a34 100644 --- a/cue/testdata/cycle/comprehension.txtar +++ b/cue/testdata/cycle/comprehension.txtar @@ -2,50 +2,50 @@ // Allow lookup in partially evaluated struct as long as the end result is // concrete. A: { - a: { - parent: "" - children: [ for k, v in A if v.parent == k { k } ] - } - b: { - parent: "a" - children: [ for k, v in A if v.parent == k { k } ] - } + a: { + parent: "" + children: [ for k, v in A if v.parent == k {k}] + } + b: { + parent: "a" + children: [ for k, v in A if v.parent == k {k}] + } } // This should result in an incomplete error (a reference cycle error classifies // as incomplete). B: { - a: { - parent: "" - children: [ for k, v in B for _, w in v.children { k } ] - } + a: { + parent: "" + children: [ for k, v in B for _, w in v.children {k}] + } } // Issue #486 Issue486: { - A: { - a: { - parent: "" - children: [...string] - } - b: { - parent: "a" - children: [...string] - } - c: { - parent: "b" - children: [...string] - } - } + A: { + a: { + parent: "" + children: [...string] + } + b: { + parent: "a" + children: [...string] + } + c: { + parent: "b" + children: [...string] + } + } - A: [Name=string]: { - children: [ - for k, v in A - if v.parent == Name { - k - } - ] - } + A: [Name=string]: { + children: [ + for k, v in A + if v.parent == Name { + k + }, + ] + } } -- out/eval -- (struct){ @@ -66,7 +66,7 @@ Issue486: { parent: (string){ "" } children: (_|_){ // [cycle] cycle error: - // ./in.cue:19:47 + // ./in.cue:19:41 } } } diff --git a/cue/testdata/cycle/cycle_with_bounds.txtar b/cue/testdata/cycle/cycle_with_bounds.txtar index 38d6eff3a..47b777c77 100644 --- a/cue/testdata/cycle/cycle_with_bounds.txtar +++ b/cue/testdata/cycle/cycle_with_bounds.txtar @@ -2,9 +2,9 @@ #Value: int foo: #Value -foo: != bar +foo: !=bar bar: #Value -bar: != foo +bar: !=foo bar: 0 foo: 1 diff --git a/cue/testdata/cycle/disjunction.txtar b/cue/testdata/cycle/disjunction.txtar index e6ebc9ba9..575ac5313 100644 --- a/cue/testdata/cycle/disjunction.txtar +++ b/cue/testdata/cycle/disjunction.txtar @@ -1,6 +1,7 @@ --- in.cue -- +# TODO(fmt): first line indented when it should not be: cuelang.org/issue/722 -// cycle is a structural cycle +-- in.cue -- + // cycle is a structural cycle cycle: a: cycle // reference to outside structural cycle @@ -34,9 +35,6 @@ s4b: x: {} | s4b s5a: x: s5a | [] s5b: x: [] | s5b - - - -- out/eval -- Errors: cycle.a: structural cycle diff --git a/cue/testdata/cycle/expression.txtar b/cue/testdata/cycle/expression.txtar index 07a4da606..f4a459b6e 100644 --- a/cue/testdata/cycle/expression.txtar +++ b/cue/testdata/cycle/expression.txtar @@ -1,101 +1,100 @@ -- in.cue -- t1: a: { - a1: a0 + 2 - b1: a1 - 2 - a0: X - X: b1 - X: 5.0 + a1: a0 + 2 + b1: a1 - 2 + a0: X + X: b1 + X: 5.0 } t1: b: { - X: 5.0 - a1: a0 + 2 - b1: a1 - 2 - a0: X - X: b1 + X: 5.0 + a1: a0 + 2 + b1: a1 - 2 + a0: X + X: b1 } t1: c: { - a1: a0 + 2 - b1: a1 - 2 - X: 5.0 - a0: X - X: b1 + a1: a0 + 2 + b1: a1 - 2 + X: 5.0 + a0: X + X: b1 } t1: c: { - b1: a1 - 2 - a1: a0 + 2 - X: 5.0 - a0: X - X: b1 + b1: a1 - 2 + a1: a0 + 2 + X: 5.0 + a0: X + X: b1 } t1: c: { - b1: a1 - 2 - X: 5.0 - a1: a0 + 2 - a0: X - X: b1 + b1: a1 - 2 + X: 5.0 + a1: a0 + 2 + a0: X + X: b1 } t1total: { - for _, v in t1 { v } + for _, v in t1 {v} } // Issue #622 t2: a: { - a0: X - a1: a0 * 2 - Y: a1 + a0: X + a1: a0 * 2 + Y: a1 - b0: Y - b1: b0 / 2 - X: b1 + b0: Y + b1: b0 / 2 + X: b1 - X: 5.0 + X: 5.0 } t2: b: { - b0: Y - b1: b0 / 2 - X: b1 + b0: Y + b1: b0 / 2 + X: b1 - a0: X - a1: a0 * 2 - Y: a1 + a0: X + a1: a0 * 2 + Y: a1 - X: 5.0 + X: 5.0 } t2: c: { - b0: Y - b1: b0 / 2 - X: b1 + b0: Y + b1: b0 / 2 + X: b1 - X: 5.0 + X: 5.0 - a0: X - a1: a0 * 2 - Y: a1 + a0: X + a1: a0 * 2 + Y: a1 } t2: d: { - b0: Y - b1: b0 / 2 - X: b1 + b0: Y + b1: b0 / 2 + X: b1 - a0: X - a1: a0 * 2 - Y: a1 + a0: X + a1: a0 * 2 + Y: a1 - X: 5.0 + X: 5.0 } t2total: { - for _, v in t2 { v } + for _, v in t2 {v} } - -- out/eval -- (struct){ t1: (struct){ diff --git a/cue/testdata/cycle/issue241.txtar b/cue/testdata/cycle/issue241.txtar index 62f257437..35310c2a4 100644 --- a/cue/testdata/cycle/issue241.txtar +++ b/cue/testdata/cycle/issue241.txtar @@ -2,28 +2,27 @@ #Value: 0 | 1 foo: #Value -foo: != bar +foo: !=bar bar: #Value -bar: != foo +bar: !=foo #Value: 0 | 1 Foo: #Value -Foo: != Bar +Foo: !=Bar Bar: #Value -Bar: != Foo +Bar: !=Foo Bar: 0 -cell: a: 0 | 1 -cell: a: != cell.b -cell: b: 0 | 1 -cell: b: != cell.a -cell: a: 0 -cell: b: _ +cell: a: 0 | 1 +cell: a: !=cell.b +cell: b: 0 | 1 +cell: b: !=cell.a +cell: a: 0 +cell: b: _ a: cell.a b: cell.b - -- out/eval -- (struct){ #Value: (int){ |((int){ 0 }, (int){ 1 }) } diff --git a/cue/testdata/cycle/issue242.txtar b/cue/testdata/cycle/issue242.txtar index b195f0dc0..886cda9ca 100644 --- a/cue/testdata/cycle/issue242.txtar +++ b/cue/testdata/cycle/issue242.txtar @@ -1,86 +1,88 @@ +# TODO: remove support for '::'; cuelang.org/issue/1543 + -- in.cue -- -size:: 2 +size :: 2 #CellValue: 0 | 1 | 2 | 3 cell: "0": "0": #CellValue -cell: "0": "0": != cell["0"]["1"] -cell: "0": "0": != cell["1"]["0"] -cell: "0": "0": != cell["1"]["1"] +cell: "0": "0": !=cell["0"]["1"] +cell: "0": "0": !=cell["1"]["0"] +cell: "0": "0": !=cell["1"]["1"] cell: "0": "1": #CellValue -cell: "0": "1": != cell["0"]["0"] -cell: "0": "1": != cell["1"]["0"] -cell: "0": "1": != cell["1"]["1"] +cell: "0": "1": !=cell["0"]["0"] +cell: "0": "1": !=cell["1"]["0"] +cell: "0": "1": !=cell["1"]["1"] cell: "1": "0": #CellValue -cell: "1": "0": != cell["0"]["0"] -cell: "1": "0": != cell["0"]["1"] -cell: "1": "0": != cell["1"]["1"] +cell: "1": "0": !=cell["0"]["0"] +cell: "1": "0": !=cell["0"]["1"] +cell: "1": "0": !=cell["1"]["1"] cell: "1": "1": #CellValue -cell: "1": "1": != cell["0"]["0"] -cell: "1": "1": != cell["0"]["1"] -cell: "1": "1": != cell["1"]["0"] +cell: "1": "1": !=cell["0"]["0"] +cell: "1": "1": !=cell["0"]["1"] +cell: "1": "1": !=cell["1"]["0"] cell: "0": "0": 0 cell: "0": "1": 1 cell: "1": "0": 2 cell: "1": "1": 3 -cell2: a: 0 | 1 -cell2: a: != cell2.b +cell2: a: 0 | 1 +cell2: a: !=cell2.b -cell2: b: 0 | 1 -cell2: b: != cell2.a +cell2: b: 0 | 1 +cell2: b: !=cell2.a -cell2: a: _ -cell2: b: 1 +cell2: a: _ +cell2: b: 1 -cell3: a: 0 | 1 -cell3: a: != cell3.b +cell3: a: 0 | 1 +cell3: a: !=cell3.b -cell3: b: 0 | 1 -cell3: b: != cell3.a +cell3: b: 0 | 1 +cell3: b: !=cell3.a -cell3: a: 0 -cell3: b: _ +cell3: a: 0 +cell3: b: _ -cell4: a: 0 | 1 -cell4: a: != cell4.b +cell4: a: 0 | 1 +cell4: a: !=cell4.b -cell4: b: 0 | 1 -cell4: b: != cell4.a +cell4: b: 0 | 1 +cell4: b: !=cell4.a -cell4: b: _ -cell4: a: 0 +cell4: b: _ +cell4: a: 0 -cell5: b: 0 | 1 -cell5: b: != cell5.a +cell5: b: 0 | 1 +cell5: b: !=cell5.a -cell5: a: 0 | 1 -cell5: a: != cell5.b +cell5: a: 0 | 1 +cell5: a: !=cell5.b -cell5: b: _ -cell5: a: 0 +cell5: b: _ +cell5: a: 0 a: #CellValue -a: != b -a: != c -a: != d +a: !=b +a: !=c +a: !=d b: #CellValue -b: != a -b: != c -b: != d +b: !=a +b: !=c +b: !=d c: #CellValue -c: != a -c: != b -c: != d +c: !=a +c: !=b +c: !=d d: #CellValue -d: != a -d: != b -d: != c +d: !=a +d: !=b +d: !=c a: 0 b: 1 diff --git a/cue/testdata/cycle/issue306.txtar b/cue/testdata/cycle/issue306.txtar index f5bb102b8..01053d366 100644 --- a/cue/testdata/cycle/issue306.txtar +++ b/cue/testdata/cycle/issue306.txtar @@ -1,9 +1,8 @@ -- in.cue -- a: 12 #Controller: settings: { - controller: #Controller + controller: #Controller } - -- out/eval -- Errors: #Controller.settings.controller: structural cycle diff --git a/cue/testdata/cycle/issue429.txtar b/cue/testdata/cycle/issue429.txtar index b5e0154c8..5c4461a5b 100644 --- a/cue/testdata/cycle/issue429.txtar +++ b/cue/testdata/cycle/issue429.txtar @@ -3,77 +3,75 @@ be an error. In this case #Size.amx should resolve. -- in.cue -- // Range disjunction without cycle (checks only one-way). -#Size : { - res: uint | * 0 - min: >res | *(1 + res) - max: >min | *min +#Size: { + res: uint | *0 + min: >res | *(1 + res) + max: >min | *min } -s0: #Size & { res: 1 } +s0: #Size & {res: 1} // This discards the default for max. This is correct, but unfortunate. // TODO: is there a tweak to the default mechanism possible that would fix that? // Tread very carefully, though! Perhaps we could have a builtin that // discards any default, so that we can at least manually override this // behavior. -s1: #Size & { min: 5 } -s2: #Size & { max: 5 } +s1: #Size & {min: 5} +s2: #Size & {max: 5} s3: #Size & { - min: 5 - max: 10 + min: 5 + max: 10 } es3: #Size & { - min: 10 - max: 5 + min: 10 + max: 5 } // Disjunctions with cycles // TODO: improve error message here. Logic is correct, though. #nonEmptyRange: { - min: *1 | int - min: min + min: *1 | int + min: min } r1: #nonEmptyRange & { - min: 3 + min: 3 } r2: #nonEmptyRange & { - max: 5 + max: 5 } r3: #nonEmptyRange & { - min: 3 - max: 6 + min: 3 + max: 6 } er3: #nonEmptyRange & { - min: 5 - max: 5 + min: 5 + max: 5 } - - -- out/eval -- Errors: er3.min: 2 errors in empty disjunction: er3.min: conflicting values 1 and 5: - ./in.cue:28:11 + ./in.cue:28:8 ./in.cue:43:6 - ./in.cue:44:10 + ./in.cue:44:7 es3.max: 3 errors in empty disjunction: es3.max: conflicting values 1 and 5: - ./in.cue:4:19 - ./in.cue:5:18 + ./in.cue:4:16 + ./in.cue:5:15 ./in.cue:20:6 - ./in.cue:22:10 + ./in.cue:22:7 es3.max: conflicting values 10 and 5: - ./in.cue:5:18 + ./in.cue:5:15 ./in.cue:20:6 - ./in.cue:21:10 - ./in.cue:22:10 + ./in.cue:21:7 + ./in.cue:22:7 es3.max: invalid value 5 (out of bound >10): - ./in.cue:5:10 - ./in.cue:22:10 + ./in.cue:5:7 + ./in.cue:22:7 er3.max: invalid value 5 (out of bound >5): - ./in.cue:30:10 - ./in.cue:45:10 + ./in.cue:30:7 + ./in.cue:45:7 Result: (_|_){ @@ -110,18 +108,18 @@ Result: max: (_|_){ // [eval] es3.max: 3 errors in empty disjunction: // es3.max: conflicting values 1 and 5: - // ./in.cue:4:19 - // ./in.cue:5:18 + // ./in.cue:4:16 + // ./in.cue:5:15 // ./in.cue:20:6 - // ./in.cue:22:10 + // ./in.cue:22:7 // es3.max: conflicting values 10 and 5: - // ./in.cue:5:18 + // ./in.cue:5:15 // ./in.cue:20:6 - // ./in.cue:21:10 - // ./in.cue:22:10 + // ./in.cue:21:7 + // ./in.cue:22:7 // es3.max: invalid value 5 (out of bound >10): - // ./in.cue:5:10 - // ./in.cue:22:10 + // ./in.cue:5:7 + // ./in.cue:22:7 } } #nonEmptyRange: (#struct){ @@ -149,17 +147,17 @@ Result: min: (_|_){ // [eval] er3.min: 2 errors in empty disjunction: // er3.min: conflicting values 1 and 5: - // ./in.cue:28:11 + // ./in.cue:28:8 // ./in.cue:43:6 - // ./in.cue:44:10 + // ./in.cue:44:7 // er3.max: invalid value 5 (out of bound >5): - // ./in.cue:30:10 - // ./in.cue:45:10 + // ./in.cue:30:7 + // ./in.cue:45:7 } max: (_|_){ // [eval] er3.max: invalid value 5 (out of bound >5): - // ./in.cue:30:10 - // ./in.cue:45:10 + // ./in.cue:30:7 + // ./in.cue:45:7 } } } diff --git a/cue/testdata/cycle/issue494.txtar b/cue/testdata/cycle/issue494.txtar index 2611455cd..da18c6e00 100644 --- a/cue/testdata/cycle/issue494.txtar +++ b/cue/testdata/cycle/issue494.txtar @@ -1,7 +1,7 @@ -- in.cue -- -_Q : [{pos: 0},{pos: 1}] +_Q: [{pos: 0}, {pos: 1}] -a: [rn=string]: _Q[0:len(a[rn])] +a: [rn=string]: _Q[0:len(a[rn])] a: ben: [{}] b: [rn=string]: _Q[0:1] @@ -10,20 +10,19 @@ b: ben: [{}] c: [rn=string]: [...{l: len(a[rn])}] c: ben: [{}] -#d: [rn=string]: [...{pos:uint}] & _Q[0:len(#d[rn])] +#d: [rn=string]: [...{pos: uint}] & _Q[0:len(#d[rn])] #d: ben: [{}] d: #d -e: [rn=string]: _Q[0:len(a[rn])+1] +e: [rn=string]: _Q[0 : len(a[rn])+1] e: ben: [{}, ...] -f: [rn=string]: _Q[0:len(a[rn])+1] +f: [rn=string]: _Q[0 : len(a[rn])+1] f: ben: [{}] -g: [rn=string]: _Q[0:len(a[rn])] +g: [rn=string]: _Q[0:len(a[rn])] g: ben: [{}, {}] - -- out/eval -- Errors: f.ben: incompatible list lengths (1 and 2) diff --git a/cue/testdata/cycle/issue502.txtar b/cue/testdata/cycle/issue502.txtar index 7888450ad..89c247575 100644 --- a/cue/testdata/cycle/issue502.txtar +++ b/cue/testdata/cycle/issue502.txtar @@ -1,31 +1,31 @@ -- in.cue -- -#T : { - config: _ - body: _ - mas: [string]: { - cfg: _ - _link: #T - link: _link & {config: cfg} - } +#T: { + config: _ + body: _ + mas: [string]: { + cfg: _ + _link: #T + link: _link & {config: cfg} + } } #a: #T & { - config: a: int - body: config.a - mas: one: { - cfg: b: config.a - _link: { - config: b: int - body: config.b - mas: two : { - cfg: c: config.b - _link: { - config: c: int - body: config.c - } - } - } - } + config: a: int + body: config.a + mas: one: { + cfg: b: config.a + _link: { + config: b: int + body: config.b + mas: two: { + cfg: c: config.b + _link: { + config: c: int + body: config.c + } + } + } + } } a: #a & {config: a: 34} diff --git a/cue/testdata/cycle/patterns.txtar b/cue/testdata/cycle/patterns.txtar index 937c3d954..9bc5c6c6b 100644 --- a/cue/testdata/cycle/patterns.txtar +++ b/cue/testdata/cycle/patterns.txtar @@ -2,14 +2,13 @@ Lots of cycle-reference goodness. -- in.cue -- [!~"^[.]"]: c -a: b +a: b b: [string]: int -c: a: int +c: a: int [string]: c -a: b +a: b b: [string]: int -c: a: int - +c: a: int -- out/eval -- (struct){ a: (struct){ diff --git a/cue/testdata/cycle/structural.txtar b/cue/testdata/cycle/structural.txtar index 33f973164..be572affc 100644 --- a/cue/testdata/cycle/structural.txtar +++ b/cue/testdata/cycle/structural.txtar @@ -1,423 +1,414 @@ -- in.cue -- a1: { - f: [f] + f: [f] } a2: { - f: f + f: f } a3: { - f: { g: f } + f: {g: f} } a4: { - a: [a|int] + a: [a | int] } a5: { - a: b: a | int + a: b: a | int } a6: { - a: a | int + a: a | int } a7: { - a: c.x - b: { - x: c - y: "foo" - } - c: { - x: b.y - y: 3 - } + a: c.x + b: { + x: c + y: "foo" + } + c: { + x: b.y + y: 3 + } } b1: { - b: a & [1] - a: [a|int] + b: a & [1] + a: [a | int] } b2: { - a: [a|int] - b: a & [1] + a: [a | int] + b: a & [1] } b3: { - x: a: [a|int] - b: x & {a: [1]} + x: a: [a | int] + b: x & {a: [1]} } b4: { - b: x.y & [1] - x: y: [y] + b: x.y & [1] + x: y: [y] } b5: { - b: x.y & {a: [1]} - x: y: a: [a|int] + b: x.y & {a: [1]} + x: y: a: [a | int] } b6: { - b: x & {a: [1]} - x: a: [a] + b: x & {a: [1]} + x: a: [a] } b7: { - b: a & [[1]] - a: [a] + b: a & [[1]] + a: [a] } // Issue #555 b8: { - x: a - a: f: b - b: a | string + x: a + a: f: b + b: a | string } // Issue #555 b9: { - #a: string | #b | #ref - #b: { - c: [#a, #a, #a] - } - #ref: ref: string - x: #b | #ref + #a: string | #b | #ref + #b: { + c: [#a, #a, #a] + } + #ref: ref: string + x: #b | #ref } // Issue #534 b10: { - a: close({ - b: string | a | c - }) - c: close({ - d: string | a - }) + a: close({ + b: string | a | c + }) + c: close({ + d: string | a + }) } // Issue #509 -- with comprehension b11: { - #list: { - tail: #list | *null - if tail != null { - } - } + #list: { + tail: #list | *null + if tail != null { + } + } } // Issue #509 -- with comprehension b12: { - #list: { - V=value: int - T=tail: #list|*null - if T != null { - sum: V + T.sum - } - if T == null { - sum: V - } - } - - list1: #list - list1: { - value: 1, - tail: { - value: 2 - tail: { - value: 3 - tail: { - value: 4 - } - } - } - } + #list: { + V=value: int + T=tail: #list | *null + if T != null { + sum: V + T.sum + } + if T == null { + sum: V + } + } + + list1: #list + list1: { + value: 1 + tail: { + value: 2 + tail: { + value: 3 + tail: { + value: 4 + } + } + } + } } // More trigger happy on stack overflows. b12b: { - #list: { - tail: #list - - if tail != null { - sum: tail.sum - } - } - - list1: #list - list1: { - tail: { - tail: { - } - } - } + #list: { + tail: #list + + if tail != null { + sum: tail.sum + } + } + + list1: #list + list1: { + tail: { + tail: { + } + } + } } // Issue #587 -b13: root: a: [ for x in root {x} ] +b13: root: a: [ for x in root {x}] // Issue #587 b14: { - root: { - a: [...int] + root: { + a: [...int] - for x in a { - "\(x)": {} - } + for x in a { + "\(x)": {} + } - b: [ for x in root {x}] - } + b: [ for x in root {x}] + } } // This is okay // Issue #587 -b15: root: a: { for x in root {x} } +b15: root: a: {for x in root {x}} // Issue #502 -- unused bulk constraints are not cyclic p1: { - #T: { - a: [string]: link: #T - } + #T: { + a: [string]: link: #T + } - a: #T & { - a: one: link: a: two: {} - } + a: #T & { + a: one: link: a: two: {} + } } // Issue #502 -- but they are if it is invoked within the struct. p2: { - #T: { - a: [string]: link: #T - a: b: {} - } - - a: #T & { - a: one: link: a: two: {} - } + #T: { + a: [string]: link: #T + a: b: {} + } + + a: #T & { + a: one: link: a: two: {} + } } // Issue #502 -- or added later. p3: { - #S: #T: { - a: [string]: link: #T - } - - #U: { - #S - #T: a: b: {} - } - - a: #U.#T & { - a: one: link: a: two: {} - } + #S: #T: { + a: [string]: link: #T + } + + #U: { + #S + #T: a: b: {} + } + + a: #U.#T & { + a: one: link: a: two: {} + } } // Issue #502 -- unused bulk constraints are not cyclic p4: { - #T: { - a: [...{link: #T}] - } + #T: { + a: [...{link: #T}] + } - a: #T & { - a: [{link: a: [{}]}] - } + a: #T & { + a: [{link: a: [{}]}] + } } // Issue #502 -- but they are if it is invoked within the struct. p5: { - #T: { - a: [...{link: #T}] - a: [{}] - } - - a: #T & { - a: [{link: a: [{}]}] - } + #T: { + a: [...{link: #T}] + a: [{}] + } + + a: #T & { + a: [{link: a: [{}]}] + } } // Issue #502 -- or added later. p6: { - #S: #T: { - a: [...{link: #T}] - } - - #U: { - #S - #T: a: [{}] - } - - a: #U.#T & { - a: [{link: a: [{}]}] - } + #S: #T: { + a: [...{link: #T}] + } + + #U: { + #S + #T: a: [{}] + } + + a: #U.#T & { + a: [{link: a: [{}]}] + } } - c1: { - a: { - b: {} - c: a & b - } + a: { + b: {} + c: a & b + } } // indirection d1: { - a: b: c: d: { h: int, t: r } - r: a.b + a: b: c: d: {h: int, t: r} + r: a.b - x: a.b.c + x: a.b.c } d2: { - x: a.b.c + x: a.b.c - r: a.b - a: b: c: d: { h: int, t: r } + r: a.b + a: b: c: d: {h: int, t: r} } d3: { - config: { - a: b: c: indirect - indirect: [a.b, null][i] - i: int | *1 - } - x: config & { i: 0 } + config: { + a: b: c: indirect + indirect: [a.b, null][i] + i: int | *1 + } + x: config & {i: 0} } - // combining structural with reference cycles e1: { - a: a - a: c: a + a: a + a: c: a - b: c: b - b: b + b: c: b + b: b } e2: { - a: {a} - a: c: a + a: {a} + a: c: a - b: c: b - b: {b} + b: c: b + b: {b} } e3: { - a: [a] - a: c: a + a: [a] + a: c: a - b: [b] - b: c: b + b: [b] + b: c: b } e4: { - a: [a | {}] - a: [[{c: 1}]] + a: [a | {}] + a: [[{c: 1}]] - b: [[{c: 1}]] - b: [b | {}] + b: [[{c: 1}]] + b: [b | {}] } - e5: { - a: c: a | int - a: a | int + a: c: a | int + a: a | int - b: b | int - b: c: b | int + b: b | int + b: c: b | int } - // validating values nestedList: { - v1e: { - x: [x | int, 1] - y: x & [[[2], 1], 1] - } - - v2e: { - y: x & [[[2], 1], 1] - x: [x | int, 1] - } - - v1: { - x: [x | int, 1] - y: x & [[[2, 1], 1], 1] - } - - v2: { - y: x & [[[2, 1], 1], 1] - x: [x | int, 1] - } + v1e: { + x: [x | int, 1] + y: x & [[[2], 1], 1] + } + + v2e: { + y: x & [[[2], 1], 1] + x: [x | int, 1] + } + + v1: { + x: [x | int, 1] + y: x & [[[2, 1], 1], 1] + } + + v2: { + y: x & [[[2, 1], 1], 1] + x: [x | int, 1] + } } v3: { - list: { - head: int - tail: list | null - } - - myList: list - myList: { - head: 2 - tail: { - head: 3 - tail: { - head: 4 - } - } - } + list: { + head: int + tail: list | null + } + + myList: list + myList: { + head: 2 + tail: { + head: 3 + tail: { + head: 4 + } + } + } } v4: { - list: { - head: int - tail: list | 1 - } - - myList: list - myList: { - head: 2 - tail: head: 3 - } + list: { + head: int + tail: list | 1 + } + + myList: list + myList: { + head: 2 + tail: head: 3 + } } v5: { - list: { - head: int - tail: list | {} - } - - myList: list - myList: { - head: 2 - tail: head: 3 - } + list: { + head: int + tail: list | {} + } + + myList: list + myList: { + head: 2 + tail: head: 3 + } } - - // Example from "The Logic of Type Feature Structures" (Bob Carpenter)/ z1: { - y: { - f: h: g - g: _ - } - x: { - f: _ - g: f - } - z: x & y + y: { + f: h: g + g: _ + } + x: { + f: _ + g: f + } + z: x & y } - // Ensure these are NOT treated as structural errors. n1: a: b: int -n2: n1 & { a: n1 } -n3: n1 & { n1 } -n4: n1 & { x: n1 & { y: n1 & { z: int }}} - - +n2: n1 & {a: n1} +n3: n1 & {n1} +n4: n1 & {x: n1 & {y: n1 & {z: int}}} -- out/eval -- Errors: a1.f.0: structural cycle @@ -426,30 +417,30 @@ b12b.#list.tail.tail: structural cycle b13.root.a.0.0: structural cycle b14.root.b.1.1: structural cycle b4.b.0: conflicting values 1 and [y] (mismatched types int and list): - ./in.cue:53:8 - ./in.cue:53:15 - ./in.cue:54:11 - ./in.cue:54:12 + ./in.cue:53:5 + ./in.cue:53:12 + ./in.cue:54:8 + ./in.cue:54:9 b4.b.0.0: structural cycle b4.x.y.0: structural cycle b6.b.a.0: conflicting values 1 and [1] (mismatched types int and list): - ./in.cue:63:8 - ./in.cue:63:16 - ./in.cue:63:17 - ./in.cue:64:12 + ./in.cue:63:5 + ./in.cue:63:13 + ./in.cue:63:14 + ./in.cue:64:9 b6.b.a.0.0: conflicting values 1 and [1] (mismatched types int and list): - ./in.cue:63:8 - ./in.cue:63:16 - ./in.cue:63:17 - ./in.cue:64:12 + ./in.cue:63:5 + ./in.cue:63:13 + ./in.cue:63:14 + ./in.cue:64:9 b6.b.a.0.0: structural cycle b6.x.a.0: structural cycle b7.a.0: structural cycle b7.b.0.0: conflicting values 1 and [a] (mismatched types int and list): - ./in.cue:68:8 - ./in.cue:68:14 - ./in.cue:69:8 - ./in.cue:69:9 + ./in.cue:68:5 + ./in.cue:68:11 + ./in.cue:69:5 + ./in.cue:69:6 b7.b.0.0.0: structural cycle c1.a.c.c: structural cycle d1.a.b.c.d.t: structural cycle @@ -461,72 +452,72 @@ e1.b.c: structural cycle e2.a.c: structural cycle e2.b.c: structural cycle e3.a: conflicting values [a] and {c:a} (mismatched types list and struct): - ./in.cue:304:8 - ./in.cue:305:8 + ./in.cue:302:5 + ./in.cue:303:5 e3.a.0: conflicting values [a] and {c:a} (mismatched types list and struct): - ./in.cue:304:8 - ./in.cue:304:9 - ./in.cue:305:8 + ./in.cue:302:5 + ./in.cue:302:6 + ./in.cue:303:5 e3.a.0: structural cycle e3.a.c: conflicting values [a] and {c:a} (mismatched types list and struct): - ./in.cue:304:8 - ./in.cue:305:8 - ./in.cue:305:11 + ./in.cue:302:5 + ./in.cue:303:5 + ./in.cue:303:8 e3.a.c: structural cycle e3.b: conflicting values [b] and {c:b} (mismatched types list and struct): - ./in.cue:307:8 - ./in.cue:308:8 + ./in.cue:305:5 + ./in.cue:306:5 e3.b.0: conflicting values [b] and {c:b} (mismatched types list and struct): - ./in.cue:307:8 - ./in.cue:307:9 - ./in.cue:308:8 + ./in.cue:305:5 + ./in.cue:305:6 + ./in.cue:306:5 e3.b.0: structural cycle e3.b.c: conflicting values [b] and {c:b} (mismatched types list and struct): - ./in.cue:307:8 - ./in.cue:308:8 - ./in.cue:308:11 + ./in.cue:305:5 + ./in.cue:306:5 + ./in.cue:306:8 e3.b.c: structural cycle e4.a.0: 4 errors in empty disjunction: e4.a.0: conflicting values [{c:1}] and {} (mismatched types list and struct): - ./in.cue:312:13 - ./in.cue:313:9 + ./in.cue:310:10 + ./in.cue:311:6 e4.a.0.0: 2 errors in empty disjunction: e4.a.0.0: conflicting values [[{c:1}]] and {c:1} (mismatched types list and struct): - ./in.cue:313:8 - ./in.cue:313:10 + ./in.cue:311:5 + ./in.cue:311:7 e4.a.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct): - ./in.cue:312:9 - ./in.cue:312:13 - ./in.cue:313:9 + ./in.cue:310:6 + ./in.cue:310:10 + ./in.cue:311:6 e4.b.0: 4 errors in empty disjunction: e4.b.0: conflicting values [{c:1}] and {} (mismatched types list and struct): - ./in.cue:315:9 - ./in.cue:316:13 + ./in.cue:313:6 + ./in.cue:314:10 e4.b.0.0: 2 errors in empty disjunction: e4.b.0.0: conflicting values [(b|{})] and {c:1} (mismatched types list and struct): - ./in.cue:315:10 - ./in.cue:316:8 + ./in.cue:313:7 + ./in.cue:314:5 e4.b.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct): - ./in.cue:315:9 - ./in.cue:316:9 - ./in.cue:316:13 + ./in.cue:313:6 + ./in.cue:314:6 + ./in.cue:314:10 nestedList.v1e.y.0: 4 errors in empty disjunction: nestedList.v1e.y.0: conflicting values int and [[2],1] (mismatched types int and list): - ./in.cue:332:17 - ./in.cue:333:17 + ./in.cue:328:11 + ./in.cue:329:11 nestedList.v1e.y.0.0: 2 errors in empty disjunction: nestedList.v1e.y.0.0: conflicting values int and [2] (mismatched types int and list): - ./in.cue:332:17 - ./in.cue:333:18 + ./in.cue:328:11 + ./in.cue:329:12 nestedList.v1e.y.0.0: incompatible list lengths (1 and 2) nestedList.v2e.y.0: 4 errors in empty disjunction: nestedList.v2e.y.0: conflicting values int and [[2],1] (mismatched types int and list): - ./in.cue:337:17 - ./in.cue:338:17 + ./in.cue:333:11 + ./in.cue:334:11 nestedList.v2e.y.0.0: 2 errors in empty disjunction: nestedList.v2e.y.0.0: conflicting values int and [2] (mismatched types int and list): - ./in.cue:337:18 - ./in.cue:338:17 + ./in.cue:333:12 + ./in.cue:334:11 nestedList.v2e.y.0.0: incompatible list lengths (1 and 2) p2.#T.a.b.link: structural cycle p3.#U.#T.a.b.link: structural cycle @@ -535,9 +526,9 @@ p6.#U.#T.a.0.link: structural cycle z1.z.f.h.h: structural cycle z1.z.g.h: structural cycle cycle error: - ./in.cue:141:10 + ./in.cue:141:6 d3.config.0: structural cycle: - ./in.cue:279:19 + ./in.cue:278:13 Result: (_|_){ @@ -624,10 +615,10 @@ Result: // [eval] 0: (_|_){ // [eval] b4.b.0: conflicting values 1 and [y] (mismatched types int and list): - // ./in.cue:53:8 - // ./in.cue:53:15 - // ./in.cue:54:11 - // ./in.cue:54:12 + // ./in.cue:53:5 + // ./in.cue:53:12 + // ./in.cue:54:8 + // ./in.cue:54:9 0: (_|_){ // [structural cycle] b4.b.0.0: structural cycle } @@ -665,16 +656,16 @@ Result: // [eval] 0: (_|_){ // [eval] b6.b.a.0: conflicting values 1 and [1] (mismatched types int and list): - // ./in.cue:63:8 - // ./in.cue:63:16 - // ./in.cue:63:17 - // ./in.cue:64:12 + // ./in.cue:63:5 + // ./in.cue:63:13 + // ./in.cue:63:14 + // ./in.cue:64:9 0: (_|_){ // [eval] b6.b.a.0.0: conflicting values 1 and [1] (mismatched types int and list): - // ./in.cue:63:8 - // ./in.cue:63:16 - // ./in.cue:63:17 - // ./in.cue:64:12 + // ./in.cue:63:5 + // ./in.cue:63:13 + // ./in.cue:63:14 + // ./in.cue:64:9 // b6.b.a.0.0: structural cycle } } @@ -698,10 +689,10 @@ Result: // [eval] 0: (_|_){ // [eval] b7.b.0.0: conflicting values 1 and [a] (mismatched types int and list): - // ./in.cue:68:8 - // ./in.cue:68:14 - // ./in.cue:69:8 - // ./in.cue:69:9 + // ./in.cue:68:5 + // ./in.cue:68:11 + // ./in.cue:69:5 + // ./in.cue:69:6 0: (_|_){ // [structural cycle] b7.b.0.0.0: structural cycle } @@ -811,10 +802,10 @@ Result: // [structural cycle] #list: (_|_){ // [structural cycle] cycle error: - // ./in.cue:141:10 + // ./in.cue:141:6 tail: (_|_){ // [structural cycle] cycle error: - // ./in.cue:141:10 + // ./in.cue:141:6 tail: (_|_){ // [structural cycle] b12b.#list.tail.tail: structural cycle } @@ -822,7 +813,7 @@ Result: } list1: (_|_){ // [structural cycle] cycle error: - // ./in.cue:141:10 + // ./in.cue:141:6 tail: (struct){ tail: (struct){ } @@ -1148,19 +1139,19 @@ Result: // [structural cycle] c: (_|_){ // [structural cycle] d3.config.0: structural cycle: - // ./in.cue:279:19 + // ./in.cue:278:13 } } } indirect: (_|_){ // [structural cycle] d3.config.0: structural cycle: - // ./in.cue:279:19 + // ./in.cue:278:13 } i: (int){ |(*(int){ 1 }, (int){ int }) } } x: (_|_){ // [structural cycle] d3.config.0: structural cycle: - // ./in.cue:279:19 + // ./in.cue:278:13 i: (int){ 0 } } } @@ -1198,39 +1189,39 @@ Result: // [eval] a: (_|_){ // [eval] e3.a: conflicting values [a] and {c:a} (mismatched types list and struct): - // ./in.cue:304:8 - // ./in.cue:305:8 + // ./in.cue:302:5 + // ./in.cue:303:5 c: (_|_){ // [eval] e3.a.c: conflicting values [a] and {c:a} (mismatched types list and struct): - // ./in.cue:304:8 - // ./in.cue:305:8 - // ./in.cue:305:11 + // ./in.cue:302:5 + // ./in.cue:303:5 + // ./in.cue:303:8 // e3.a.c: structural cycle } 0: (_|_){ // [eval] e3.a.0: conflicting values [a] and {c:a} (mismatched types list and struct): - // ./in.cue:304:8 - // ./in.cue:304:9 - // ./in.cue:305:8 + // ./in.cue:302:5 + // ./in.cue:302:6 + // ./in.cue:303:5 // e3.a.0: structural cycle } } b: (_|_){ // [eval] e3.b: conflicting values [b] and {c:b} (mismatched types list and struct): - // ./in.cue:307:8 - // ./in.cue:308:8 + // ./in.cue:305:5 + // ./in.cue:306:5 c: (_|_){ // [eval] e3.b.c: conflicting values [b] and {c:b} (mismatched types list and struct): - // ./in.cue:307:8 - // ./in.cue:308:8 - // ./in.cue:308:11 + // ./in.cue:305:5 + // ./in.cue:306:5 + // ./in.cue:306:8 // e3.b.c: structural cycle } 0: (_|_){ // [eval] e3.b.0: conflicting values [b] and {c:b} (mismatched types list and struct): - // ./in.cue:307:8 - // ./in.cue:307:9 - // ./in.cue:308:8 + // ./in.cue:305:5 + // ./in.cue:305:6 + // ./in.cue:306:5 // e3.b.0: structural cycle } } @@ -1242,16 +1233,16 @@ Result: 0: (_|_){ // [eval] e4.a.0: 4 errors in empty disjunction: // e4.a.0: conflicting values [{c:1}] and {} (mismatched types list and struct): - // ./in.cue:312:13 - // ./in.cue:313:9 + // ./in.cue:310:10 + // ./in.cue:311:6 // e4.a.0.0: 2 errors in empty disjunction: // e4.a.0.0: conflicting values [[{c:1}]] and {c:1} (mismatched types list and struct): - // ./in.cue:313:8 - // ./in.cue:313:10 + // ./in.cue:311:5 + // ./in.cue:311:7 // e4.a.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct): - // ./in.cue:312:9 - // ./in.cue:312:13 - // ./in.cue:313:9 + // ./in.cue:310:6 + // ./in.cue:310:10 + // ./in.cue:311:6 0: (struct){ c: (int){ 1 } } @@ -1262,16 +1253,16 @@ Result: 0: (_|_){ // [eval] e4.b.0: 4 errors in empty disjunction: // e4.b.0: conflicting values [{c:1}] and {} (mismatched types list and struct): - // ./in.cue:315:9 - // ./in.cue:316:13 + // ./in.cue:313:6 + // ./in.cue:314:10 // e4.b.0.0: 2 errors in empty disjunction: // e4.b.0.0: conflicting values [(b|{})] and {c:1} (mismatched types list and struct): - // ./in.cue:315:10 - // ./in.cue:316:8 + // ./in.cue:313:7 + // ./in.cue:314:5 // e4.b.0.0: conflicting values [{c:1}] and {} (mismatched types list and struct): - // ./in.cue:315:9 - // ./in.cue:316:9 - // ./in.cue:316:13 + // ./in.cue:313:6 + // ./in.cue:314:6 + // ./in.cue:314:10 0: (struct){ c: (int){ 1 } } @@ -1299,12 +1290,12 @@ Result: 0: (_|_){ // [eval] nestedList.v1e.y.0: 4 errors in empty disjunction: // nestedList.v1e.y.0: conflicting values int and [[2],1] (mismatched types int and list): - // ./in.cue:332:17 - // ./in.cue:333:17 + // ./in.cue:328:11 + // ./in.cue:329:11 // nestedList.v1e.y.0.0: 2 errors in empty disjunction: // nestedList.v1e.y.0.0: conflicting values int and [2] (mismatched types int and list): - // ./in.cue:332:17 - // ./in.cue:333:18 + // ./in.cue:328:11 + // ./in.cue:329:12 // nestedList.v1e.y.0.0: incompatible list lengths (1 and 2) 0: (#list){ 0: (int){ 2 } @@ -1321,12 +1312,12 @@ Result: 0: (_|_){ // [eval] nestedList.v2e.y.0: 4 errors in empty disjunction: // nestedList.v2e.y.0: conflicting values int and [[2],1] (mismatched types int and list): - // ./in.cue:337:17 - // ./in.cue:338:17 + // ./in.cue:333:11 + // ./in.cue:334:11 // nestedList.v2e.y.0.0: 2 errors in empty disjunction: // nestedList.v2e.y.0.0: conflicting values int and [2] (mismatched types int and list): - // ./in.cue:337:18 - // ./in.cue:338:17 + // ./in.cue:333:12 + // ./in.cue:334:11 // nestedList.v2e.y.0.0: incompatible list lengths (1 and 2) 0: (#list){ 0: (int){ 2 } diff --git a/cue/testdata/cycle/with_defaults.txtar b/cue/testdata/cycle/with_defaults.txtar index 74f31e558..cfa9e206c 100644 --- a/cue/testdata/cycle/with_defaults.txtar +++ b/cue/testdata/cycle/with_defaults.txtar @@ -1,6 +1,6 @@ -- in.cue -- range1: { - min: *1 | int + min: *1 | int range: >min range: 8 } @@ -9,7 +9,7 @@ range2: { max: int & >min } rg: range2 & { -// min: 1 + // min: 1 max: 8 } -- out/eval -- diff --git a/cue/testdata/definitions/comprehensions.txtar b/cue/testdata/definitions/comprehensions.txtar index 469e8b135..6c3e092c6 100644 --- a/cue/testdata/definitions/comprehensions.txtar +++ b/cue/testdata/definitions/comprehensions.txtar @@ -1,18 +1,18 @@ -- in.cue -- issue595: { - // NOTE: this should eval with an EVAL error, not - // an incomplete error. See Issue #595. - #cfgs: [{ - name: "foo" - }] - for cfg in #cfgs { - files: cfg.nam - } + // NOTE: this should eval with an EVAL error, not + // an incomplete error. See Issue #595. + #cfgs: [{ + name: "foo" + }] + for cfg in #cfgs { + files: cfg.nam + } } -- out/eval -- Errors: issue595.files: undefined field: nam: - ./in.cue:8:20 + ./in.cue:8:14 Result: (_|_){ @@ -26,7 +26,7 @@ Result: } files: (_|_){ // [eval] issue595.files: undefined field: nam: - // ./in.cue:8:20 + // ./in.cue:8:14 } } } diff --git a/cue/testdata/definitions/defembed.txtar b/cue/testdata/definitions/defembed.txtar index eb94b026d..e6bbe7a99 100644 --- a/cue/testdata/definitions/defembed.txtar +++ b/cue/testdata/definitions/defembed.txtar @@ -1,6 +1,6 @@ -- in.cue -- a: { - #A + #A } a: c: 1 @@ -10,7 +10,7 @@ a: c: 1 Errors: a: field not allowed: c: ./in.cue:1:4 - ./in.cue:2:5 + ./in.cue:2:2 ./in.cue:5:4 ./in.cue:7:5 @@ -23,7 +23,7 @@ Result: c: (_|_){ // [eval] a: field not allowed: c: // ./in.cue:1:4 - // ./in.cue:2:5 + // ./in.cue:2:2 // ./in.cue:5:4 // ./in.cue:7:5 } diff --git a/cue/testdata/definitions/dynamic.txtar b/cue/testdata/definitions/dynamic.txtar index 02561bac4..49a6485d9 100644 --- a/cue/testdata/definitions/dynamic.txtar +++ b/cue/testdata/definitions/dynamic.txtar @@ -3,7 +3,6 @@ a: "foo" "\(a)": 3 } - -- out/eval -- (struct){ #A: (#struct){ diff --git a/cue/testdata/definitions/embed.txtar b/cue/testdata/definitions/embed.txtar index 15167ccd1..26b79e995 100644 --- a/cue/testdata/definitions/embed.txtar +++ b/cue/testdata/definitions/embed.txtar @@ -14,77 +14,76 @@ deployment: foo: spec: replicas: 1 #TypeMeta: {} recloseSimple: { - #foo: {} - a: {#foo} & {b: int} + #foo: {} + a: {#foo} & {b: int} } // Reclosing reclose1: { - #D: { - x: int - y: int - } - #a: { - #D - b: { - c: int - } - } + #D: { + x: int + y: int + } + #a: { + #D + b: { + c: int + } + } - z: #a.b - z: d: 3 // don't allow this + z: #a.b + z: d: 3 // don't allow this } reclose2: { - #D: { - x: int - y: int - } - a: { - #D - b: { // keep open - c: int - } - } + #D: { + x: int + y: int + } + a: { + #D + b: {// keep open + c: int + } + } - z: a.b - z: d: 3 // allow this + z: a.b + z: d: 3 // allow this } reclose3: { - #Step: { - (#A | #B) - #Common - } - #Common: { - Name: string - } - #A: { - #Common - Something: int - } - #B: { - #Common - Else: int - } - x: #Step - x: #A & { - Name: "a" - Something: 4 - } + #Step: { + (#A | #B) + #Common + } + #Common: { + Name: string + } + #A: { + #Common + Something: int + } + #B: { + #Common + Else: int + } + x: #Step + x: #A & { + Name: "a" + Something: 4 + } } - -- out/eval -- Errors: reclose1.z: field not allowed: d: - ./in.cue:28:8 - ./in.cue:33:6 - ./in.cue:34:6 + ./in.cue:28:6 + ./in.cue:33:5 + ./in.cue:34:5 recloseSimple.a: field not allowed: b: - ./in.cue:16:9 + ./in.cue:16:8 + ./in.cue:17:5 ./in.cue:17:6 - ./in.cue:17:7 - ./in.cue:17:16 + ./in.cue:17:15 Result: (_|_){ @@ -114,10 +113,10 @@ Result: // [eval] b: (_|_){ // [eval] recloseSimple.a: field not allowed: b: - // ./in.cue:16:9 + // ./in.cue:16:8 + // ./in.cue:17:5 // ./in.cue:17:6 - // ./in.cue:17:7 - // ./in.cue:17:16 + // ./in.cue:17:15 } } } @@ -139,9 +138,9 @@ Result: c: (int){ int } d: (_|_){ // [eval] reclose1.z: field not allowed: d: - // ./in.cue:28:8 - // ./in.cue:33:6 - // ./in.cue:34:6 + // ./in.cue:28:6 + // ./in.cue:33:5 + // ./in.cue:34:5 } } } diff --git a/cue/testdata/definitions/files.txtar b/cue/testdata/definitions/files.txtar index a695acbe5..f2a394d2e 100644 --- a/cue/testdata/definitions/files.txtar +++ b/cue/testdata/definitions/files.txtar @@ -20,14 +20,12 @@ light: #theme & { #Config: { console: dark | *light } - -- box.cue -- package foo #Config & { console: dark } - -- out/eval -- (#struct){ #theme: (#struct){ diff --git a/cue/testdata/definitions/hidden.txtar b/cue/testdata/definitions/hidden.txtar index 399e55b4e..09687a63f 100644 --- a/cue/testdata/definitions/hidden.txtar +++ b/cue/testdata/definitions/hidden.txtar @@ -2,43 +2,40 @@ cue eval ./pkg:foo -- cue.mod/module.cue -- module: "example.com" - -- in.cue -- package foo import "example.com/pkg" #def: { - _name: d: int + _name: d: int } -d: pkg.#D & { _name: d: int, _val: f: 4 } +d: pkg.#D & {_name: d: int, _val: f: 4} // TODO: this should fail, as the _name restricting it is in this // package. e: pkg.#D & #def & { - // This should fail as c is disallowed by the _name defined - // in this package - _name: c: int + // This should fail as c is disallowed by the _name defined + // in this package + _name: c: int - // This should not fail, as this is a different _val - _val: g: int + // This should not fail, as this is a different _val + _val: g: int } -f: pkg.#D & { _val: f: 4 } +f: pkg.#D & {_val: f: 4} g: f._val - -- pkg/bar.cue -- package pkg -#D: { _val: f: 3 } - +#D: {_val: f: 3} -- out/eval -- Errors: e._name: field not allowed: c: - ./in.cue:6:10 + ./in.cue:6:9 ./in.cue:13:13 - ./in.cue:16:10 + ./in.cue:16:9 Result: (_|_){ @@ -69,9 +66,9 @@ Result: d: (int){ int } c: (_|_){ // [eval] e._name: field not allowed: c: - // ./in.cue:6:10 + // ./in.cue:6:9 // ./in.cue:13:13 - // ./in.cue:16:10 + // ./in.cue:16:9 } } _val(:foo): (struct){ diff --git a/cue/testdata/definitions/issue271.txtar b/cue/testdata/definitions/issue271.txtar index 63cecf21d..5a1ab4cfc 100644 --- a/cue/testdata/definitions/issue271.txtar +++ b/cue/testdata/definitions/issue271.txtar @@ -1,7 +1,7 @@ -- in.cue -- #T: [_]: _ #T: close({"a": string}) -x: #T +x: #T x: { a: "hello" b: "foo" @@ -11,7 +11,7 @@ Errors: x: field not allowed: b: ./in.cue:1:5 ./in.cue:2:11 - ./in.cue:3:4 + ./in.cue:3:5 ./in.cue:6:2 Result: @@ -27,7 +27,7 @@ Result: // [eval] x: field not allowed: b: // ./in.cue:1:5 // ./in.cue:2:11 - // ./in.cue:3:4 + // ./in.cue:3:5 // ./in.cue:6:2 } } diff --git a/cue/testdata/definitions/issue317.txtar b/cue/testdata/definitions/issue317.txtar index ba30973fc..0daf9d22b 100644 --- a/cue/testdata/definitions/issue317.txtar +++ b/cue/testdata/definitions/issue317.txtar @@ -18,23 +18,23 @@ s: #T & { #Container: { Env: [Name=string]: { - name: string - value: string + name: string + value: string } } #Deployment: { - #Containers: [Name=string]: #Container - containers: [ for c in #Containers { c } ] // Problem is here. + #Containers: [Name=string]: #Container + + containers: [ for c in #Containers {c}] // Problem is here. } Something: { - #Deployment - #Containers: { - // Does not allow entries other than value. Either add ... or embed - "a thing": Env: foobar: value: "foo" - } + #Deployment + #Containers: { + // Does not allow entries other than value. Either add ... or embed + "a thing": Env: foobar: value: "foo" + } } x: Something & #Deployment - -- out/eval -- (struct){ #T: (#struct){ diff --git a/cue/testdata/definitions/issue320.txtar b/cue/testdata/definitions/issue320.txtar index ef7fc0524..e644440c1 100644 --- a/cue/testdata/definitions/issue320.txtar +++ b/cue/testdata/definitions/issue320.txtar @@ -4,7 +4,7 @@ #More } -#More: [=~ "^x-"]: _ +#More: [=~"^x-"]: _ foo: #Foo & { x: "hello" diff --git a/cue/testdata/definitions/issue342.txtar b/cue/testdata/definitions/issue342.txtar index 43c7ece4e..1929d1572 100644 --- a/cue/testdata/definitions/issue342.txtar +++ b/cue/testdata/definitions/issue342.txtar @@ -19,7 +19,7 @@ X: { // Validate(concrete) after Fill() on "#Simple.ref" from a "dynamic" key will succeed "test_2_\(var)": #Simple - + // Validate(concrete) after Fill() on Complex.ref from a "dynamic" key will fail "test_3_\(var)": #Complex diff --git a/cue/testdata/definitions/issue359.txtar b/cue/testdata/definitions/issue359.txtar index 691c772d2..3e8700953 100644 --- a/cue/testdata/definitions/issue359.txtar +++ b/cue/testdata/definitions/issue359.txtar @@ -1,39 +1,38 @@ -- in.cue -- #simple: { - peso: *1|int - edad: *2|int + peso: *1 | int + edad: *2 | int } // Second struct is not considered closed, as expected good: #simple & { - peso: 4 + peso: 4 } - #complex: { - things: [string]: #simple + things: [string]: #simple } // Still, no closedness issue in the second struct #many: #complex & { - things: hola: peso: 2 - things: sol: peso: 3 + things: hola: peso: 2 + things: sol: peso: 3 } // Inner struct in second struct IS considered closed: why? -bad: #many & { - things: hola: peso: 2 +bad: #many & { + things: hola: peso: 2 } // non-definition equivalent many: #complex & { - things: hola: peso: 2 - things: sol: peso: 3 + things: hola: peso: 2 + things: sol: peso: 3 } // Now inner struct on second struct is NOT considered closed -notbad: many & { - things: hola: peso: 2 +notbad: many & { + things: hola: peso: 2 } -- out/eval -- (struct){ diff --git a/cue/testdata/definitions/issue367.txtar b/cue/testdata/definitions/issue367.txtar index 8e648420d..08ac643a5 100644 --- a/cue/testdata/definitions/issue367.txtar +++ b/cue/testdata/definitions/issue367.txtar @@ -2,7 +2,7 @@ TODO: l4 should be allowed -- in.cue -- #def1: l1: ["l2"]: {l3: int, l4: 26} -#special1: #def1 & {l1: l2: l3: <100} +#special1: #def1 & {l1: l2: l3: <100} instance: #special1 & {l1: l2: l3: 34} -- out/eval -- (struct){ diff --git a/cue/testdata/definitions/issue370.txtar b/cue/testdata/definitions/issue370.txtar index a4a962d46..1c7ea6f3b 100644 --- a/cue/testdata/definitions/issue370.txtar +++ b/cue/testdata/definitions/issue370.txtar @@ -3,21 +3,21 @@ package x #C1: { - name: string + name: string } #C2: { - #C1 - age: int + #C1 + age: int } c1: #C1 & { - name: "cueckoo" + name: "cueckoo" } c2: #C2 & { - c1 - age: 5 + c1 + age: 5 } -- out/eval -- (struct){ diff --git a/cue/testdata/definitions/issue419.txtar b/cue/testdata/definitions/issue419.txtar index e2afe01fa..9920c74e1 100644 --- a/cue/testdata/definitions/issue419.txtar +++ b/cue/testdata/definitions/issue419.txtar @@ -12,7 +12,7 @@ l: [...#X] l: [ - {b: "bar"} + {b: "bar"}, ] -- out/eval -- (struct){ diff --git a/cue/testdata/definitions/issue483.txtar b/cue/testdata/definitions/issue483.txtar index 769980abd..3fec20918 100644 --- a/cue/testdata/definitions/issue483.txtar +++ b/cue/testdata/definitions/issue483.txtar @@ -1,14 +1,14 @@ -- in.cue -- out: { - instance + instance } instance: #Type & { - alpha: bravo: charlie: true + alpha: bravo: charlie: true } #Type: #Root & { - alpha?: bravo?: charlie?: bool + alpha?: bravo?: charlie?: bool } -#Root: { ... } +#Root: {...} -- out/eval -- (struct){ out: (#struct){ diff --git a/cue/testdata/definitions/issue493.txtar b/cue/testdata/definitions/issue493.txtar index da75387aa..6fca2be11 100644 --- a/cue/testdata/definitions/issue493.txtar +++ b/cue/testdata/definitions/issue493.txtar @@ -1,7 +1,7 @@ -- in.cue -- #Artifact: { - body: _ - other: [string]: int + body: _ + other: [string]: int } #App: #Artifact @@ -9,7 +9,7 @@ #Both: #App | #Atom -t1: #Both & {body: 3} +t1: #Both & {body: 3} -- out/eval -- (struct){ #Artifact: (#struct){ diff --git a/cue/testdata/definitions/issue496.txtar b/cue/testdata/definitions/issue496.txtar index aefa15e50..5501a9af1 100644 --- a/cue/testdata/definitions/issue496.txtar +++ b/cue/testdata/definitions/issue496.txtar @@ -1,14 +1,13 @@ -- in.cue -- -#A : _ +#A: _ #N: #A & { - _E: { - name: "hello" - } + _E: { + name: "hello" + } } l: #N - -- out/eval -- (struct){ #A: (_){ _ } diff --git a/cue/testdata/definitions/issue497.txtar b/cue/testdata/definitions/issue497.txtar index 8cae7848e..71ccc621f 100644 --- a/cue/testdata/definitions/issue497.txtar +++ b/cue/testdata/definitions/issue497.txtar @@ -1,14 +1,13 @@ -- in.cue -- -#A : _ +#A: _ #N: #A & { - f: j: { - n: "hi" - } + f: j: { + n: "hi" + } } l: #N - -- out/eval -- (struct){ #A: (_){ _ } diff --git a/cue/testdata/definitions/list.txtar b/cue/testdata/definitions/list.txtar index ca1808527..be8b28e4f 100644 --- a/cue/testdata/definitions/list.txtar +++ b/cue/testdata/definitions/list.txtar @@ -1,9 +1,9 @@ -- in.cue -- c: #R & { - w: [{}, {b: int}] + w: [{}, {b: int}] } #R: { - w: [{}, ...] + w: [{}, ...] } -- out/eval -- (struct){ diff --git a/cue/testdata/definitions/visibility.txtar b/cue/testdata/definitions/visibility.txtar index 7ef357d84..7791322cf 100644 --- a/cue/testdata/definitions/visibility.txtar +++ b/cue/testdata/definitions/visibility.txtar @@ -3,11 +3,11 @@ name: string } foo: #foo & { - // These should all be allowed. - _name: "foo" - _#name: "bar" + // These should all be allowed. + _name: "foo" + _#name: "bar" - #name: "baz" + #name: "baz" } -- out/eval -- (struct){ diff --git a/cue/testdata/disjunctions/defembed.txtar b/cue/testdata/disjunctions/defembed.txtar index e3caa117f..9b338f99b 100644 --- a/cue/testdata/disjunctions/defembed.txtar +++ b/cue/testdata/disjunctions/defembed.txtar @@ -3,31 +3,30 @@ Interaction between defaults, embedding and disjunctions. // TODO: at the moment, using a default will select it. -- in.cue -- x: { - // All of these resolve to *2 | 3 - m1: (1 | (*2 | 3)) & (>=2 & <=3) - m2: (1 | (*2 | 3)) & (2 | 3) - m3: (*1 | *(*2 | 3)) & (2 | 3) + // All of these resolve to *2 | 3 + m1: (1 | (*2 | 3)) & (>=2 & <=3) + m2: (1 | (*2 | 3)) & (2 | 3) + m3: (*1 | *(*2 | 3)) & (2 | 3) } y1: x & { - {m4: x.m1+x.m2+x.m3} + {m4: x.m1 + x.m2 + x.m3} } y2: { - x - {m4: y2.m1+y2.m2+y2.m3} + x + {m4: y2.m1 + y2.m2 + y2.m3} } Y=y3: { - x - {m4: Y.m1+Y.m2+Y.m3} + x + {m4: Y.m1 + Y.m2 + Y.m3} } y4: x & { - {m4: y4.m1+y4.m2+y4.m3} + {m4: y4.m1 + y4.m2 + y4.m3} } // Second disjunct in embedding is not possible because of previous declaration // of `b`, so it should be resolved to {a: 1}. b: (*"a" | "b") | "c" {a: b} | {b: int} - -- out/eval -- (struct){ x: (struct){ diff --git a/cue/testdata/disjunctions/elimination.txtar b/cue/testdata/disjunctions/elimination.txtar index 164635b50..c69d2b861 100644 --- a/cue/testdata/disjunctions/elimination.txtar +++ b/cue/testdata/disjunctions/elimination.txtar @@ -12,176 +12,174 @@ import "struct" // // It should be recursively disabled. disambiguateClosed: { - b: #Def & a - a: #Def - #Def: { {x: true} | {y: true} } + b: #Def & a + a: #Def + #Def: {{x: true} | {y: true}} } // Checks should never be disabled for field matching. alwaysCheckMatchers1: { - b: {[=~"^xxxx$"]: int} | null - b: {c: string} | null - b: c: "yyyyy" + b: {[=~"^xxxx$"]: int} | null + b: {c: string} | null + b: c: "yyyyy" } alwaysCheckPatterns2: { - a: #X - a: b + a: #X + a: b - b: #X - b: c: "yyyyy" + b: #X + b: c: "yyyyy" - #X: string | { - c: string - {[=~"^xxxx$"]: int} - } + #X: string | { + c: string + {[=~"^xxxx$"]: int} + } } nestedNonMonotonic: resolved: n1: { - x: { a: struct.MinFields(2) } | null - x: { a: c: 1 } | null - x: { a: d: 1 } | null + x: {a: struct.MinFields(2)} | null + x: {a: c: 1} | null + x: {a: d: 1} | null } nestedNonMonotonic: resolved: n2: { - x: { a: b: struct.MinFields(2) } | null - x: { a: b: c: 1 } | null - x: { a: b: d: 1 } | null + x: {a: b: struct.MinFields(2)} | null + x: {a: b: c: 1} | null + x: {a: b: d: 1} | null } nestedNonMonotonic: eliminated: n1: p1: { - x: { a: struct.MaxFields(1) } | null - x: { a: c: 1 } | null - x: { a: d: 1 } | null + x: {a: struct.MaxFields(1)} | null + x: {a: c: 1} | null + x: {a: d: 1} | null } nestedNonMonotonic: eliminated: n1: p2: { - x: { a: c: 1 } | null - x: { a: struct.MaxFields(1) } | null - x: { a: d: 1 } | null + x: {a: c: 1} | null + x: {a: struct.MaxFields(1)} | null + x: {a: d: 1} | null } nestedNonMonotonic: eliminated: n1: p2: { - x: { a: c: 1 } | null - x: { a: d: 1 } | null - x: { a: struct.MaxFields(1) } | null + x: {a: c: 1} | null + x: {a: d: 1} | null + x: {a: struct.MaxFields(1)} | null } nestedNonMonotonic: eliminated: n2: p1: { - x: { a: b: struct.MaxFields(1) } | null - x: { a: b: c: 1 } | null - x: { a: b: d: 1 } | null + x: {a: b: struct.MaxFields(1)} | null + x: {a: b: c: 1} | null + x: {a: b: d: 1} | null } nestedNonMonotonic: eliminated: n2: p2: { - x: { a: b: c: 1 } | null - x: { a: b: struct.MaxFields(1) } | null - x: { a: b: d: 1 } | null + x: {a: b: c: 1} | null + x: {a: b: struct.MaxFields(1)} | null + x: {a: b: d: 1} | null } nestedNonMonotonic: eliminated: n2: p2: { - x: { a: b: c: 1 } | null - x: { a: b: d: 1 } | null - x: { a: b: struct.MaxFields(1) } | null + x: {a: b: c: 1} | null + x: {a: b: d: 1} | null + x: {a: b: struct.MaxFields(1)} | null } -nestedNonMonotonic: incomplete: a: n1: p1: { - x: { a: struct.MinFields(2) } | null - x: { a: c: 1 } | null +nestedNonMonotonic: incomplete: a: n1: p1: { + x: {a: struct.MinFields(2)} | null + x: {a: c: 1} | null } -nestedNonMonotonic: incomplete: a: n1: p2: { - x: { a: c: 1 } | null - x: { a: struct.MinFields(2) } | null +nestedNonMonotonic: incomplete: a: n1: p2: { + x: {a: c: 1} | null + x: {a: struct.MinFields(2)} | null } -nestedNonMonotonic: incomplete: a: n2: p1: { - x: { a: b: struct.MinFields(2) } | null - x: { a: b: c: 1 } | null +nestedNonMonotonic: incomplete: a: n2: p1: { + x: {a: b: struct.MinFields(2)} | null + x: {a: b: c: 1} | null } -nestedNonMonotonic: incomplete: a: n2: p2: { - x: { a: b: c: 1 } | null - x: { a: b: struct.MinFields(2) } | null +nestedNonMonotonic: incomplete: a: n2: p2: { + x: {a: b: c: 1} | null + x: {a: b: struct.MinFields(2)} | null } - nestedNonMonotonic: incomplete: b: n1: p1: { - x: { a: struct.MinFields(3) } | null - x: { a: c: 1 } | null - x: { a: d: 1 } | null + x: {a: struct.MinFields(3)} | null + x: {a: c: 1} | null + x: {a: d: 1} | null } nestedNonMonotonic: incomplete: b: n1: p2: { - x: { a: c: 1 } | null - x: { a: struct.MinFields(3) } | null - x: { a: d: 1 } | null + x: {a: c: 1} | null + x: {a: struct.MinFields(3)} | null + x: {a: d: 1} | null } nestedNonMonotonic: incomplete: b: n1: p3: { - x: { a: c: 1 } | null - x: { a: d: 1 } | null - x: { a: struct.MinFields(3) } | null + x: {a: c: 1} | null + x: {a: d: 1} | null + x: {a: struct.MinFields(3)} | null } nestedNonMonotonic: incomplete: b: n2: p1: { - x: { a: b: struct.MinFields(3) } | null - x: { a: b: c: 1 } | null - x: { a: b: d: 1 } | null + x: {a: b: struct.MinFields(3)} | null + x: {a: b: c: 1} | null + x: {a: b: d: 1} | null } nestedNonMonotonic: incomplete: b: n2: p1: { - x: { a: b: c: 1 } | null - x: { a: b: struct.MinFields(3) } | null - x: { a: b: d: 1 } | null + x: {a: b: c: 1} | null + x: {a: b: struct.MinFields(3)} | null + x: {a: b: d: 1} | null } nestedNonMonotonic: incomplete: b: n2: p1: { - x: { a: b: c: 1 } | null - x: { a: b: d: 1 } | null - x: { a: b: struct.MinFields(3) } | null + x: {a: b: c: 1} | null + x: {a: b: d: 1} | null + x: {a: b: struct.MinFields(3)} | null } preserveClosedness: small: p1: { - #A: #B & {a: string} - #B: { - *{} | {a: string} - *{} | {b: int} - } + #A: #B & {a: string} + #B: { + *{} | {a: string} + *{} | {b: int} + } } preserveClosedness: small: p2: { - #A: #B & {a: string} - #B: { - {a: string} | *{} - *{} | {b: int} - } + #A: #B & {a: string} + #B: { + {a: string} | *{} + *{} | {b: int} + } } preserveClosedness: medium: p1: { - #A: #B & {a: string} - #B: { - *{} | {a: string} | {b: string} - *{} | {c: int} | {d: string} - } + #A: #B & {a: string} + #B: { + *{} | {a: string} | {b: string} + *{} | {c: int} | {d: string} + } } preserveClosedness: medium: p2: { - #A: #B & {a: string} - #B: { - {a: string} | *{} | {b: string} - *{} | {c: int} | {d: string} - } + #A: #B & {a: string} + #B: { + {a: string} | *{} | {b: string} + *{} | {c: int} | {d: string} + } } preserveClosedness: medium: p3: { - #A: #B & {a: string} - #B: { - {a: string} | {b: string} | *{} - *{} | {c: int} | {d: string} - } + #A: #B & {a: string} + #B: { + {a: string} | {b: string} | *{} + *{} | {c: int} | {d: string} + } } - -- out/eval -- (struct){ disambiguateClosed: (struct){ @@ -263,9 +261,9 @@ preserveClosedness: medium: p3: { x: ((null|struct)){ |((struct){ a: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.a.n1.p1.x.a: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2): - // ./in.cue:84:13 - // ./in.cue:84:30 - // ./in.cue:85:13 + // ./in.cue:84:12 + // ./in.cue:84:29 + // ./in.cue:85:9 c: (int){ 1 } } }, (null){ null }) } @@ -274,9 +272,9 @@ preserveClosedness: medium: p3: { x: ((null|struct)){ |((struct){ a: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.a.n1.p2.x.a: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2): - // ./in.cue:90:13 - // ./in.cue:89:13 - // ./in.cue:90:30 + // ./in.cue:90:12 + // ./in.cue:89:9 + // ./in.cue:90:29 c: (int){ 1 } } }, (null){ null }) } @@ -288,9 +286,9 @@ preserveClosedness: medium: p3: { a: (struct){ b: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.a.n2.p1.x.a.b: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2): - // ./in.cue:94:16 - // ./in.cue:94:33 - // ./in.cue:95:16 + // ./in.cue:94:15 + // ./in.cue:94:32 + // ./in.cue:95:12 c: (int){ 1 } } } @@ -301,9 +299,9 @@ preserveClosedness: medium: p3: { a: (struct){ b: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.a.n2.p2.x.a.b: invalid value {c:1} (does not satisfy struct.MinFields(2)): len(fields) < MinFields(2) (1 < 2): - // ./in.cue:100:16 - // ./in.cue:99:16 - // ./in.cue:100:33 + // ./in.cue:100:15 + // ./in.cue:99:12 + // ./in.cue:100:32 c: (int){ 1 } } } @@ -317,10 +315,10 @@ preserveClosedness: medium: p3: { x: ((null|struct)){ |((struct){ a: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.b.n1.p1.x.a: invalid value {c:1,d:1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): - // ./in.cue:105:13 - // ./in.cue:105:30 - // ./in.cue:106:13 - // ./in.cue:107:13 + // ./in.cue:104:12 + // ./in.cue:104:29 + // ./in.cue:105:9 + // ./in.cue:106:9 c: (int){ 1 } d: (int){ 1 } } @@ -330,10 +328,10 @@ preserveClosedness: medium: p3: { x: ((null|struct)){ |((struct){ a: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.b.n1.p2.x.a: invalid value {c:1,d:1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): - // ./in.cue:112:13 - // ./in.cue:111:13 - // ./in.cue:112:30 - // ./in.cue:113:13 + // ./in.cue:111:12 + // ./in.cue:110:9 + // ./in.cue:111:29 + // ./in.cue:112:9 c: (int){ 1 } d: (int){ 1 } } @@ -343,10 +341,10 @@ preserveClosedness: medium: p3: { x: ((null|struct)){ |((struct){ a: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.b.n1.p3.x.a: invalid value {c:1,d:1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): - // ./in.cue:119:13 - // ./in.cue:117:13 - // ./in.cue:118:13 - // ./in.cue:119:30 + // ./in.cue:118:12 + // ./in.cue:116:9 + // ./in.cue:117:9 + // ./in.cue:118:29 c: (int){ 1 } d: (int){ 1 } } @@ -359,16 +357,16 @@ preserveClosedness: medium: p3: { a: (struct){ b: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.b.n2.p1.x.a.b: invalid value {c:1,d:1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): - // ./in.cue:137:16 - // ./in.cue:123:16 - // ./in.cue:124:16 - // ./in.cue:125:16 - // ./in.cue:129:16 - // ./in.cue:130:16 - // ./in.cue:131:16 - // ./in.cue:135:16 - // ./in.cue:136:16 - // ./in.cue:137:33 + // ./in.cue:136:15 + // ./in.cue:122:15 + // ./in.cue:123:12 + // ./in.cue:124:12 + // ./in.cue:128:12 + // ./in.cue:129:15 + // ./in.cue:130:12 + // ./in.cue:134:12 + // ./in.cue:135:12 + // ./in.cue:136:32 c: (int){ 1 } d: (int){ 1 } } diff --git a/cue/testdata/disjunctions/embed.txtar b/cue/testdata/disjunctions/embed.txtar index ac238c2df..5e525554c 100644 --- a/cue/testdata/disjunctions/embed.txtar +++ b/cue/testdata/disjunctions/embed.txtar @@ -4,63 +4,62 @@ // make it resolve to `{a: 2}`. default: { - y: *1 | {a: 2} - y + y: *1 | {a: 2} + y } unambiguous: { - y: 1 | {a: 2} - y + y: 1 | {a: 2} + y } forDefault: { - y: *1 | {a: 2} - for x in [1] {y} + y: *1 | {a: 2} + for x in [1] {y} } // Carry over default to first disjunct. openDefault: { - #y: *1 | {a: 2} - #y + #y: *1 | {a: 2} + #y } openAmbiguous: { - #y: 1 | {a: 2} - #y + #y: 1 | {a: 2} + #y } forceStruct: { - #y: 1 | {a: 2} - #y - {} + #y: 1 | {a: 2} + #y + {} } defaultsMulti: { - a: { - #def: { - *{} | {a: string} | {b: string} - *{} | {c: string} | {d: string} - } + a: { + #def: { + *{} | {a: string} | {b: string} + *{} | {c: string} | {d: string} + } - a: #def & {a: "foo"} - } + a: #def & {a: "foo"} + } - b: { - #def: { - *{} | {a: string} | {b: string} - *{} | {c: string} | {d: string} - *{} | {d: string} | {e: string} - } + b: { + #def: { + *{} | {a: string} | {b: string} + *{} | {c: string} | {d: string} + *{} | {d: string} | {e: string} + } - a: #def & {a: "foo", e: "bar"} - } + a: #def & {a: "foo", e: "bar"} + } } nested: { a: 1 | 2 | *( (3 | 4 | *( 5 | 6 | *7)) & ( 3 | 4 | ( *7 | 8 ))) } - -- out/eval -- (struct){ default: (struct){ diff --git a/cue/testdata/disjunctions/errors.txtar b/cue/testdata/disjunctions/errors.txtar index e1b49ff92..09838b68d 100644 --- a/cue/testdata/disjunctions/errors.txtar +++ b/cue/testdata/disjunctions/errors.txtar @@ -1,59 +1,58 @@ -- in.cue -- issue570: { - results: #DecodeOutput - results: result: "hello" + results: #DecodeOutput + results: result: "hello" - #Output: { - result: _ - } | { - error: string - } + #Output: { + result: _ + } | { + error: string + } - #DecodeOutput: #Output & { - result?: [... string] - ... - } + #DecodeOutput: #Output & { + result?: [... string] + ... + } } issue516: { - #Def: { - match: metrics: string: {} - } | {} + #Def: { + match: metrics: string: {} + } | {} - x: #Def - x: match: metrics: "foo": {} + x: #Def + x: match: metrics: "foo": {} } // issue #465 explicitDefaultError: { - a: string | *_|_ + a: string | *_|_ - if a != "" { - } + if a != "" { + } } - -- out/eval -- Errors: issue516.x: 2 errors in empty disjunction: issue516.x: field not allowed: match: - ./in.cue:20:9 - ./in.cue:22:8 - ./in.cue:23:8 + ./in.cue:20:6 + ./in.cue:22:5 + ./in.cue:23:5 issue516.x.match.metrics: field not allowed: foo: - ./in.cue:19:25 - ./in.cue:22:8 - ./in.cue:23:24 + ./in.cue:19:19 + ./in.cue:22:5 + ./in.cue:23:21 issue570.results: 2 errors in empty disjunction: issue570.results: field not allowed: result: - ./in.cue:2:14 - ./in.cue:3:14 - ./in.cue:7:9 - ./in.cue:11:20 - ./in.cue:12:9 + ./in.cue:2:11 + ./in.cue:3:11 + ./in.cue:7:6 + ./in.cue:11:17 + ./in.cue:12:3 issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): - ./in.cue:2:14 - ./in.cue:3:22 - ./in.cue:12:18 + ./in.cue:2:11 + ./in.cue:3:19 + ./in.cue:12:12 Result: (_|_){ @@ -63,22 +62,22 @@ Result: results: (_|_){ // [eval] issue570.results: 2 errors in empty disjunction: // issue570.results: field not allowed: result: - // ./in.cue:2:14 - // ./in.cue:3:14 - // ./in.cue:7:9 - // ./in.cue:11:20 - // ./in.cue:12:9 + // ./in.cue:2:11 + // ./in.cue:3:11 + // ./in.cue:7:6 + // ./in.cue:11:17 + // ./in.cue:12:3 // issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): - // ./in.cue:2:14 - // ./in.cue:3:22 - // ./in.cue:12:18 + // ./in.cue:2:11 + // ./in.cue:3:19 + // ./in.cue:12:12 result: (_|_){ // [eval] issue570.results: field not allowed: result: - // ./in.cue:2:14 - // ./in.cue:3:14 - // ./in.cue:7:9 - // ./in.cue:11:20 - // ./in.cue:12:9 + // ./in.cue:2:11 + // ./in.cue:3:11 + // ./in.cue:7:6 + // ./in.cue:11:17 + // ./in.cue:12:3 } error: (string){ string } } @@ -108,25 +107,25 @@ Result: x: (_|_){ // [eval] issue516.x: 2 errors in empty disjunction: // issue516.x: field not allowed: match: - // ./in.cue:20:9 - // ./in.cue:22:8 - // ./in.cue:23:8 + // ./in.cue:20:6 + // ./in.cue:22:5 + // ./in.cue:23:5 // issue516.x.match.metrics: field not allowed: foo: - // ./in.cue:19:25 - // ./in.cue:22:8 - // ./in.cue:23:24 + // ./in.cue:19:19 + // ./in.cue:22:5 + // ./in.cue:23:21 match: (_|_){ // [eval] issue516.x: field not allowed: match: - // ./in.cue:20:9 - // ./in.cue:22:8 - // ./in.cue:23:8 + // ./in.cue:20:6 + // ./in.cue:22:5 + // ./in.cue:23:5 } } } explicitDefaultError: (_|_){ // [incomplete] explicitDefaultError: non-concrete value string in operand to !=: - // ./in.cue:30:8 - // ./in.cue:28:8 + // ./in.cue:30:5 + // ./in.cue:28:5 a: (string){ string } } } diff --git a/cue/testdata/disjunctions/incomplete.txtar b/cue/testdata/disjunctions/incomplete.txtar index 9aa3bb571..75017d1f9 100644 --- a/cue/testdata/disjunctions/incomplete.txtar +++ b/cue/testdata/disjunctions/incomplete.txtar @@ -2,54 +2,53 @@ import "encoding/yaml" issue700: { - a:y: "y" - test1: *a.x | 1 - test2: *a.y | 1 + a: y: "y" + test1: *a.x | 1 + test2: *a.y | 1 } lookup: { - x: { - name: "Hello" - } - y: x.a - ok1: *x.a | x - ok2: x | *x.a - ok3: x.a | *x - ok4: *x | x.a - ok5: x | x.a - ok5: x.a | x - allFail1: x.a | x.b - allFail2: x.a | x.b + x: { + name: "Hello" + } + y: x.a + ok1: *x.a | x + ok2: x | *x.a + ok3: x.a | *x + ok4: *x | x.a + ok5: x | x.a + ok5: x.a | x + allFail1: x.a | x.b + allFail2: x.a | x.b } func: { - s: string - ok1: yaml.MarshalStream(s) | yaml.Marshal(s) + s: string + ok1: yaml.MarshalStream(s) | yaml.Marshal(s) } issue782: { - a: { - inner: string - interpolation: *"\(inner)" | string - interpolation: "override" - } - b: { - inner: string - interpolation: string | *"\(inner)" - interpolation: "override" - } - c: { - inner: string - interpolation: "\(inner)" | string - interpolation: "override" - } - d: { - inner: string - interpolation: string | "\(inner)" - interpolation: "override" - } + a: { + inner: string + interpolation: *"\(inner)" | string + interpolation: "override" + } + b: { + inner: string + interpolation: string | *"\(inner)" + interpolation: "override" + } + c: { + inner: string + interpolation: "\(inner)" | string + interpolation: "override" + } + d: { + inner: string + interpolation: string | "\(inner)" + interpolation: "override" + } } - -- out/eval -- (struct){ issue700: (struct){ @@ -65,7 +64,7 @@ issue782: { } y: (_|_){ // [incomplete] lookup.y: undefined field: a: - // ./in.cue:13:10 + // ./in.cue:13:14 } ok1: (struct){ name: (string){ "Hello" } @@ -85,12 +84,12 @@ issue782: { allFail1: (_|_){ // [incomplete] lookup.allFail1: 1 errors in empty disjunction: // lookup.allFail1: undefined field: a: - // ./in.cue:20:18 + // ./in.cue:20:14 } allFail2: (_|_){ // [incomplete] lookup.allFail2: 1 errors in empty disjunction: // lookup.allFail2: undefined field: a: - // ./in.cue:21:18 + // ./in.cue:21:14 } } func: (struct){ @@ -98,7 +97,7 @@ issue782: { ok1: (_|_){ // [incomplete] func.ok1: 1 errors in empty disjunction: // func.ok1: non-concrete argument 0: - // ./in.cue:26:10 + // ./in.cue:26:7 } } issue782: (struct){ diff --git a/cue/testdata/disjunctions/operands.txtar b/cue/testdata/disjunctions/operands.txtar index bb7c72835..478b6e930 100644 --- a/cue/testdata/disjunctions/operands.txtar +++ b/cue/testdata/disjunctions/operands.txtar @@ -1,43 +1,41 @@ # This file tests disjunctions used as operands. -- in.cue -- - -list: *[1] | [2] +list: *[1] | [2] condition: *true | false -num: *1 | 2 -object: *{ a: 1 } | { a: 2 } +num: *1 | 2 +object: *{a: 1} | {a: 2} forLoop: [ - for e in list { - "count: \(e)" - } + for e in list { + "count: \(e)" + }, ] conditional: { - if condition { - a: 3 - } - if num < 5 { - b: 3 - } + if condition { + a: 3 + } + if num < 5 { + b: 3 + } } selector: { - a: object.a + a: object.a } index: { - a: list[0] + a: list[0] } binOp: { - a: num + 4 + a: num + 4 } unaryOp: { - a: -num + a: -num } - -- out/eval -- (struct){ list: (list){ |(*(#list){ diff --git a/cue/testdata/disjunctions/specdeviation.txtar b/cue/testdata/disjunctions/specdeviation.txtar index 605639b06..42418dab7 100644 --- a/cue/testdata/disjunctions/specdeviation.txtar +++ b/cue/testdata/disjunctions/specdeviation.txtar @@ -16,7 +16,6 @@ Proof: p: 2 | int // value after removing default. -- in.cue -- - Q: *1 | int q: *Q | int // 1 as expected @@ -31,38 +30,37 @@ r: (*3 | (*1 | 2)) & (1 | 2) // outer disjunction. s: (3 | (*1 | 2)) & (1 | 2) -s1: #Size & { min: 5 } +s1: #Size & {min: 5} -#Size : { - max: >min | *min - res: uint | * 0 - min: >res | *(1 + res) +#Size: { + max: >min | *min + res: uint | *0 + min: >res | *(1 + res) } staged: { - c: ("a" | "b") & (*(*"a" | string) | string) - d: (*(*"a" | string) | string) & ("a" | "b") + c: ("a" | "b") & (*(*"a" | string) | string) + d: (*(*"a" | string) | string) & ("a" | "b") } issue763a: { - #A: { - v: "a" | "b" | "c" // change to string to fix - } + #A: { + v: "a" | "b" | "c" // change to string to fix + } - h: [string]: #A + h: [string]: #A - h: [=~"^b"]: #A & { - v: *h.a.v | string - } + h: [=~"^b"]: #A & { + v: *h.a.v | string + } - h: a: { - v: *"a" | string - } + h: a: { + v: *"a" | string + } - h: baa: _ - h: boo: _ + h: baa: _ + h: boo: _ } - -- out/eval -- (struct){ Q: (int){ |(*(int){ 1 }, (int){ int }) } diff --git a/cue/testdata/eval/basictypes.txtar b/cue/testdata/eval/basictypes.txtar index 75020fd70..6eb8a4d8a 100644 --- a/cue/testdata/eval/basictypes.txtar +++ b/cue/testdata/eval/basictypes.txtar @@ -1,14 +1,14 @@ -- in.cue -- top: { - a: {_} - b: _ + a: {_} + b: _ } scalar: { - a: {string} - b: string - c: {{{number}}} - d: number + a: {string} + b: string + c: {{{number}}} + d: number } -- out/eval -- (struct){ diff --git a/cue/testdata/eval/bounds.txtar b/cue/testdata/eval/bounds.txtar index 7607f881f..ee2143031 100644 --- a/cue/testdata/eval/bounds.txtar +++ b/cue/testdata/eval/bounds.txtar @@ -8,65 +8,64 @@ b2: int & <5.5 b3: <10 & <=5 b4: >=20 & >20 b5: >=21 & >20 -b6: int & >5 & <= 6 +b6: int & >5 & <=6 simplifyExpr: { - less1: <(<3) - less2: <(<=3) - less3: <=(<3) - less4: <=(<=3) - less5: <(!=3) - less6: <=(!=3) + less1: <(<3) + less2: <(<=3) + less3: <=(<3) + less4: <=(<=3) + less5: <(!=3) + less6: <=(!=3) - gtr1: >(>3) - gtr2: >(>=3) - gtr3: >=(>3) - gtr4: >=(>=3) - gtr5: >(!=3) - gtr6: >=(!=3) + gtr1: >(>3) + gtr2: >(>=3) + gtr3: >=(>3) + gtr4: >=(>=3) + gtr5: >(!=3) + gtr6: >=(!=3) - lg1: <(>3) - lg2: <(>=3) - lg3: <=(>3) - lg4: <=(>=3) + lg1: <(>3) + lg2: <(>=3) + lg3: <=(>3) + lg4: <=(>=3) - gl1: >(<3) - gl2: >(<=3) - gl3: >=(<3) - gl4: >=(<=3) + gl1: >(<3) + gl2: >(<=3) + gl3: >=(<3) + gl4: >=(<=3) - ne1: !=(!=3) - ne2: !=(<3) - ne3: !=(<=3) - ne4: !=(>3) - ne5: !=(>=3) + ne1: !=(!=3) + ne2: !=(<3) + ne3: !=(<=3) + ne4: !=(>3) + ne5: !=(>=3) - s: string - n: number - i: int - f: float - b: bytes - basic1: <(i) - basic2: >(n) - basic3: >=(s) - basic4: <=(f) - basic5: <=(b) + s: string + n: number + i: int + f: float + b: bytes + basic1: <(i) + basic2: >(n) + basic3: >=(s) + basic4: <=(f) + basic5: <=(b) - // Do NOT interpret this the same as `!= type`. - bne1: !=(s) - bne2: !=(n) - bne3: !=(n) - bne4: !=(i) - bne5: !=(b) + // Do NOT interpret this the same as `!= type`. + bne1: !=(s) + bne2: !=(n) + bne3: !=(n) + bne4: !=(i) + bne5: !=(b) - e1: <(=~"foo") - e2: >(null) + e1: <(=~"foo") + e2: >(null) } - -- out/eval -- Errors: simplifyExpr.e2: cannot use null for bound >: - ./in.cue:62:11 + ./in.cue:62:8 Result: (_|_){ @@ -119,31 +118,31 @@ Result: basic5: (bytes){ bytes } bne1: (_|_){ // [incomplete] simplifyExpr.bne1: non-concrete value s for bound !=: - // ./in.cue:55:14 + // ./in.cue:55:11 } bne2: (_|_){ // [incomplete] simplifyExpr.bne2: non-concrete value n for bound !=: - // ./in.cue:56:14 + // ./in.cue:56:11 } bne3: (_|_){ // [incomplete] simplifyExpr.bne3: non-concrete value n for bound !=: - // ./in.cue:57:14 + // ./in.cue:57:11 } bne4: (_|_){ // [incomplete] simplifyExpr.bne4: non-concrete value i for bound !=: - // ./in.cue:58:14 + // ./in.cue:58:11 } bne5: (_|_){ // [incomplete] simplifyExpr.bne5: non-concrete value b for bound !=: - // ./in.cue:59:14 + // ./in.cue:59:11 } e1: (_|_){ // [incomplete] simplifyExpr.e1: non-concrete value =~"foo" for bound <: - // ./in.cue:61:11 + // ./in.cue:61:8 } e2: (_|_){ // [eval] simplifyExpr.e2: cannot use null for bound >: - // ./in.cue:62:11 + // ./in.cue:62:8 } } } diff --git a/cue/testdata/eval/bulk.txtar b/cue/testdata/eval/bulk.txtar index 473119830..45bb59099 100644 --- a/cue/testdata/eval/bulk.txtar +++ b/cue/testdata/eval/bulk.txtar @@ -2,7 +2,7 @@ a: { foo: a: 1 [X = =~"foo"]: { - b: 1 + b: 1 name: X } } @@ -13,31 +13,30 @@ d: a & { } t1: { - #a: { - [>"e" & <"z"]: int - } - b: #a & { f: 4 } - c: #a & { z: 4 } + #a: { + [>"e" & <"z"]: int + } + b: #a & {f: 4} + c: #a & {z: 4} } t2: { - #a: { - ["x" | "y"]: int - } - b: #a & { x: 4 } - c: #a & { z: 4 } + #a: { + ["x" | "y"]: int + } + b: #a & {x: 4} + c: #a & {z: 4} } - -- out/eval -- Errors: t1.c: field not allowed: z: - ./in.cue:15:7 - ./in.cue:19:6 - ./in.cue:19:13 + ./in.cue:15:6 + ./in.cue:19:5 + ./in.cue:19:11 t2.c: field not allowed: z: - ./in.cue:23:7 - ./in.cue:27:6 - ./in.cue:27:13 + ./in.cue:23:6 + ./in.cue:27:5 + ./in.cue:27:11 Result: (_|_){ @@ -72,9 +71,9 @@ Result: // [eval] z: (_|_){ // [eval] t1.c: field not allowed: z: - // ./in.cue:15:7 - // ./in.cue:19:6 - // ./in.cue:19:13 + // ./in.cue:15:6 + // ./in.cue:19:5 + // ./in.cue:19:11 } } } @@ -89,9 +88,9 @@ Result: // [eval] z: (_|_){ // [eval] t2.c: field not allowed: z: - // ./in.cue:23:7 - // ./in.cue:27:6 - // ./in.cue:27:13 + // ./in.cue:23:6 + // ./in.cue:27:5 + // ./in.cue:27:11 } } } diff --git a/cue/testdata/eval/closed_disjunction.txtar b/cue/testdata/eval/closed_disjunction.txtar index ea34b4328..7a964656d 100644 --- a/cue/testdata/eval/closed_disjunction.txtar +++ b/cue/testdata/eval/closed_disjunction.txtar @@ -1,33 +1,33 @@ -- in.cue -- #A: { - b?: int - *{} | {c?: int} | {d?: int} | {e?: int} + b?: int + *{} | {c?: int} | {d?: int} | {e?: int} } a: #A & { - b: 3 - c: 3 + b: 3 + c: 3 } b: #A & { - c: 3 - d: 4 + c: 3 + d: 4 } -- out/eval -- Errors: b: 2 errors in empty disjunction: b: field not allowed: c: ./in.cue:1:5 - ./in.cue:3:5 - ./in.cue:3:6 + ./in.cue:3:2 + ./in.cue:3:3 ./in.cue:11:4 - ./in.cue:12:5 + ./in.cue:12:2 b: field not allowed: d: ./in.cue:1:5 - ./in.cue:3:5 - ./in.cue:3:11 + ./in.cue:3:2 + ./in.cue:3:8 ./in.cue:11:4 - ./in.cue:13:5 + ./in.cue:13:2 Result: (_|_){ @@ -45,31 +45,31 @@ Result: // [eval] b: 2 errors in empty disjunction: // b: field not allowed: c: // ./in.cue:1:5 - // ./in.cue:3:5 - // ./in.cue:3:6 + // ./in.cue:3:2 + // ./in.cue:3:3 // ./in.cue:11:4 - // ./in.cue:12:5 + // ./in.cue:12:2 // b: field not allowed: d: // ./in.cue:1:5 - // ./in.cue:3:5 - // ./in.cue:3:11 + // ./in.cue:3:2 + // ./in.cue:3:8 // ./in.cue:11:4 - // ./in.cue:13:5 + // ./in.cue:13:2 c: (_|_){ // [eval] b: field not allowed: c: // ./in.cue:1:5 - // ./in.cue:3:5 - // ./in.cue:3:35 + // ./in.cue:3:2 + // ./in.cue:3:32 // ./in.cue:11:4 - // ./in.cue:12:5 + // ./in.cue:12:2 } d: (_|_){ // [eval] b: field not allowed: d: // ./in.cue:1:5 - // ./in.cue:3:5 - // ./in.cue:3:35 + // ./in.cue:3:2 + // ./in.cue:3:32 // ./in.cue:11:4 - // ./in.cue:13:5 + // ./in.cue:13:2 } } } diff --git a/cue/testdata/eval/closedness.txtar b/cue/testdata/eval/closedness.txtar index 59c86ca19..e7a864814 100644 --- a/cue/testdata/eval/closedness.txtar +++ b/cue/testdata/eval/closedness.txtar @@ -2,60 +2,59 @@ -- in.cue -- #E: { - c: int + c: int } #A: { - b: int - q: { - #E - d: int - } + b: int + q: { + #E + d: int + } } a: #A & { - b: 3 - q: { - c: 2 - e: 43 - } + b: 3 + q: { + c: 2 + e: 43 + } } // `a` is evaluated through the comprehension first. Ensure that // this does not bypass closedness checks. issue852: { - #A: { - [=~"^a-z$"]: string - } + #A: { + [=~"^a-z$"]: string + } - a: #A + a: #A - a: Foo: "foo" + a: Foo: "foo" - for k, v in a { - b: "\(k)": v - } + for k, v in a { + b: "\(k)": v + } } dynamic: { - #D: { - key: "foo" - (key): int - } - d: #D & { foo: 3 } + #D: { + key: "foo" + (key): int + } + d: #D & {foo: 3} } - -- out/eval -- Errors: a.q: field not allowed: e: ./in.cue:1:5 - ./in.cue:6:8 - ./in.cue:7:9 + ./in.cue:6:5 + ./in.cue:7:3 ./in.cue:11:4 - ./in.cue:15:9 + ./in.cue:15:3 issue852.a: field not allowed: Foo: - ./in.cue:30:15 - ./in.cue:22:7 - ./in.cue:26:6 - ./in.cue:28:6 + ./in.cue:30:14 + ./in.cue:22:6 + ./in.cue:26:5 + ./in.cue:28:5 Result: (_|_){ @@ -80,29 +79,29 @@ Result: e: (_|_){ // [eval] a.q: field not allowed: e: // ./in.cue:1:5 - // ./in.cue:6:8 - // ./in.cue:7:9 + // ./in.cue:6:5 + // ./in.cue:7:3 // ./in.cue:11:4 - // ./in.cue:15:9 + // ./in.cue:15:3 } } } issue852: (_|_){ // [eval] issue852.a: field not allowed: Foo: - // ./in.cue:30:15 - // ./in.cue:22:7 - // ./in.cue:26:6 - // ./in.cue:28:6 + // ./in.cue:30:14 + // ./in.cue:22:6 + // ./in.cue:26:5 + // ./in.cue:28:5 #A: (#struct){ } a: (_|_){ // [eval] Foo: (_|_){ // [eval] issue852.a: field not allowed: Foo: - // ./in.cue:30:15 - // ./in.cue:22:7 - // ./in.cue:26:6 - // ./in.cue:28:6 + // ./in.cue:30:14 + // ./in.cue:22:6 + // ./in.cue:26:5 + // ./in.cue:28:5 } } } diff --git a/cue/testdata/eval/comprehensions.txtar b/cue/testdata/eval/comprehensions.txtar index 8202dfbcb..db4b3572d 100644 --- a/cue/testdata/eval/comprehensions.txtar +++ b/cue/testdata/eval/comprehensions.txtar @@ -1,7 +1,7 @@ -- in.cue -- import "strings" -a: { x: 10, y: 100, z: 50 } +a: {x: 10, y: 100, z: 50} b: { for k, v in a if v <= 50 { "\(k)": v @@ -17,20 +17,19 @@ b: { } c: { - for k, v in a let y = v+10 if y > 50 { - "\(k)": y - } + for k, v in a let y = v + 10 if y > 50 { + "\(k)": y + } } A: X: run: "dfoo" if true { A: X: { - run: string - files: "\(strings.Join([ run ], "\n"))" + run: string + files: "\(strings.Join([ run], "\n"))" } } - -- out/eval -- (struct){ a: (struct){ diff --git a/cue/testdata/eval/conflicts.txtar b/cue/testdata/eval/conflicts.txtar index ce8408f2e..5b716bad1 100644 --- a/cue/testdata/eval/conflicts.txtar +++ b/cue/testdata/eval/conflicts.txtar @@ -3,32 +3,31 @@ i: int s: string t0: { - v: i & s + v: i & s } t1: { - #d1: { - a: b: 3 - } + #d1: { + a: b: 3 + } - #d2: { - a: b: 4 - } + #d2: { + a: b: 4 + } - x: #d1 & #d2 + x: #d1 & #d2 } - -- out/eval -- Errors: t0.v: conflicting values int and string (mismatched types int and string): ./in.cue:1:4 ./in.cue:2:4 - ./in.cue:5:12 + ./in.cue:5:9 t1.x.a.b: conflicting values 4 and 3: - ./in.cue:10:15 - ./in.cue:14:15 - ./in.cue:17:8 - ./in.cue:17:14 + ./in.cue:10:9 + ./in.cue:14:9 + ./in.cue:17:5 + ./in.cue:17:11 Result: (_|_){ @@ -41,7 +40,7 @@ Result: // [eval] t0.v: conflicting values int and string (mismatched types int and string): // ./in.cue:1:4 // ./in.cue:2:4 - // ./in.cue:5:12 + // ./in.cue:5:9 } } t1: (_|_){ @@ -62,10 +61,10 @@ Result: // [eval] b: (_|_){ // [eval] t1.x.a.b: conflicting values 4 and 3: - // ./in.cue:10:15 - // ./in.cue:14:15 - // ./in.cue:17:8 - // ./in.cue:17:14 + // ./in.cue:10:9 + // ./in.cue:14:9 + // ./in.cue:17:5 + // ./in.cue:17:11 } } } diff --git a/cue/testdata/eval/cycles_ref.txtar b/cue/testdata/eval/cycles_ref.txtar index a1d1bbbc5..d37862964 100644 --- a/cue/testdata/eval/cycles_ref.txtar +++ b/cue/testdata/eval/cycles_ref.txtar @@ -3,10 +3,9 @@ a: b + 100 b: a - 100 a: 200 - -c: d & { b: 2 } +c: d & {b: 2} d: e -e: { a: 1 } +e: {a: 1} e: c -- out/eval -- (struct){ diff --git a/cue/testdata/eval/disjunctions.txtar b/cue/testdata/eval/disjunctions.txtar index 7a550de71..867139b53 100644 --- a/cue/testdata/eval/disjunctions.txtar +++ b/cue/testdata/eval/disjunctions.txtar @@ -1,137 +1,136 @@ -- in.cue -- -a: *1 | int +a: *1 | int aa: *1 | *2 | int b: { name: "int" - val: int + val: int } | { name: "str" - val: string + val: string } -d: b & { val: 3 } -c: b & { name: "int", val: 3 } -e: b & { val: "foo" } -f: b & { name: "str", val: 3 } +d: b & {val: 3} +c: b & {name: "int", val: 3} +e: b & {val: "foo"} +f: b & {name: "str", val: 3} // Disjunct elimination based on type. e1: { - a: null | {bar: 2} - b: (a&{}).bar + a: null | {bar: 2} + b: (a & {}).bar } d1: { - a: (null | {c: 1}) & {} - b: {} & (null | {c: 1}) + a: (null | {c: 1}) & {} + b: {} & (null | {c: 1}) } d2: { - a: ([...] | {c: 1}) & {} - b: {} & ([...] | {c: 1}) + a: ([...] | {c: 1}) & {} + b: {} & ([...] | {c: 1}) } d3: { - a: (string | {c: 1}) & {} - b: {} & (string | {c: 1}) + a: (string | {c: 1}) & {} + b: {} & (string | {c: 1}) } d4: { - a: (string | {c: 1}) & {} - b: {} & (string | {c: 1}) + a: (string | {c: 1}) & {} + b: {} & (string | {c: 1}) } d5: { - a: (number | {c: 1}) & {} - b: {} & (number | {c: 1}) + a: (number | {c: 1}) & {} + b: {} & (number | {c: 1}) } d6: { - a: (int | {c: 1}) & {} - b: {} & (int | {c: 1}) + a: (int | {c: 1}) & {} + b: {} & (int | {c: 1}) } t10: { - schema: test - schema: string | {name: string} - #A: {string | {name: string}} + schema: test + schema: string | {name: string} + #A: {string | {name: string}} - test: name: "Test" - test: #A + test: name: "Test" + test: #A } t10: { - schema: string | {name: string} - schema: test - #A: {string | {name: string}} + schema: string | {name: string} + schema: test + #A: {string | {name: string}} - test: name: "Test" - test: #A + test: name: "Test" + test: #A } t10: { - #A: {string | {name: string}} + #A: {string | {name: string}} - test: name: "Test" - test: #A + test: name: "Test" + test: #A - schema: string | {name: string} - schema: test + schema: string | {name: string} + schema: test } t11: { - a: #A - a: b + a: #A + a: b - b: #A & ["b"] - #A: ["a" | "b"] | {} + b: #A & ["b"] + #A: ["a" | "b"] | {} } t11: { - b: #A & ["b"] - #A: ["a" | "b"] | {} + b: #A & ["b"] + #A: ["a" | "b"] | {} - a: b - a: #A + a: b + a: #A } cross: { - a: *"word" | string - a: string | *"word" + a: *"word" | string + a: string | *"word" } - d100: { - // Should we allow a selector to imply a struct or list? Would be convenient. - // This would be a spec change. Disallow for now. - i: null | {bar: 2} - j: i.bar + // Should we allow a selector to imply a struct or list? Would be convenient. + // This would be a spec change. Disallow for now. + i: null | {bar: 2} + j: i.bar } issue641: { - #A: { - type: "a" - x: "" - } + #A: { + type: "a" + x: "" + } - #B: { - type: "b" - x: string - } + #B: { + type: "b" + x: string + } - #C: { - b: #A | #B - } + #C: { + b: #A | #B + } - e: [string]: #C & { - b: #A | #B - } + e: [string]: #C & { + b: #A | #B + } - e: foobar: #C & { - b: #B & { - x: "foobar" - } - } + e: foobar: #C & { + b: #B & { + x: "foobar" + } + } } -- out/eval -- Errors: @@ -139,11 +138,11 @@ f: 2 errors in empty disjunction: f.name: conflicting values "int" and "str": ./in.cue:5:8 ./in.cue:15:4 - ./in.cue:15:16 + ./in.cue:15:15 f.val: conflicting values 3 and string (mismatched types int and string): - ./in.cue:9:7 + ./in.cue:9:8 ./in.cue:15:4 - ./in.cue:15:28 + ./in.cue:15:27 Result: (_|_){ @@ -174,17 +173,17 @@ Result: // f.name: conflicting values "int" and "str": // ./in.cue:5:8 // ./in.cue:15:4 - // ./in.cue:15:16 + // ./in.cue:15:15 // f.val: conflicting values 3 and string (mismatched types int and string): - // ./in.cue:9:7 + // ./in.cue:9:8 // ./in.cue:15:4 - // ./in.cue:15:28 + // ./in.cue:15:27 name: (string){ "str" } val: (_|_){ // [eval] f.val: conflicting values 3 and string (mismatched types int and string): - // ./in.cue:9:7 + // ./in.cue:9:8 // ./in.cue:15:4 - // ./in.cue:15:28 + // ./in.cue:15:27 } } e1: (struct){ @@ -273,7 +272,7 @@ Result: }) } j: (_|_){ // [incomplete] d100.j: unresolved disjunction null | {bar:2} (type (null|struct)): - // ./in.cue:107:6 + // ./in.cue:106:5 } } issue641: (struct){ diff --git a/cue/testdata/eval/dynamic_field.txtar b/cue/testdata/eval/dynamic_field.txtar index b35259381..68d2e3b94 100644 --- a/cue/testdata/eval/dynamic_field.txtar +++ b/cue/testdata/eval/dynamic_field.txtar @@ -10,23 +10,23 @@ X="\(b)": { c: X withError: { - issue799: {key: int32} & {"\(1&2)": 123} + issue799: {key: int32} & {"\(1 & 2)": 123} } parenExprRefParent: { - a: (x): {} - x: "foo" + a: (x): {} + x: "foo" } parenExprRefEqual: { - (x): {} - x: "foo" + (x): {} + x: "foo" } -- out/eval -- Errors: invalid interpolation: conflicting values 2 and 1: + ./in.cue:12:28 ./in.cue:12:31 - ./in.cue:12:34 - ./in.cue:12:36 + ./in.cue:12:35 Result: (_|_){ @@ -41,9 +41,9 @@ Result: // [eval] issue799: (_|_){ // [eval] invalid interpolation: conflicting values 2 and 1: + // ./in.cue:12:28 // ./in.cue:12:31 - // ./in.cue:12:34 - // ./in.cue:12:36 + // ./in.cue:12:35 key: (int){ &(>=-2147483648, <=2147483647, int) } } } diff --git a/cue/testdata/eval/embed.txtar b/cue/testdata/eval/embed.txtar index 7fe090c26..8db01dbc6 100644 --- a/cue/testdata/eval/embed.txtar +++ b/cue/testdata/eval/embed.txtar @@ -1,31 +1,30 @@ -- in.cue -- #A: { - Common - ... + Common + ... } Common: { - a: int - b: int + a: int + b: int } x: #A x: { - c: int + c: int } #B: { - if true { - a: int - } - ... + if true { + a: int + } + ... } y: #B y: { - c: int + c: int } - -- out/eval -- (struct){ #A: (#struct){ diff --git a/cue/testdata/eval/errunifiy.txtar b/cue/testdata/eval/errunifiy.txtar index f818cbb3f..b24e78ec3 100644 --- a/cue/testdata/eval/errunifiy.txtar +++ b/cue/testdata/eval/errunifiy.txtar @@ -6,7 +6,6 @@ a: "t" b: _|_ b: "t" - -- out/eval -- Errors: explicit error (_|_ literal) in source: diff --git a/cue/testdata/eval/expressions.txtar b/cue/testdata/eval/expressions.txtar index 0b7f376d3..dce272d1a 100644 --- a/cue/testdata/eval/expressions.txtar +++ b/cue/testdata/eval/expressions.txtar @@ -3,7 +3,6 @@ a: 1 b: 1 + 2 c: 3 - 1 d: 5 rem 3 - -- out/eval -- (struct){ a: (int){ 1 } diff --git a/cue/testdata/eval/fields.txtar b/cue/testdata/eval/fields.txtar index 7ebce1718..7390dfa5b 100644 --- a/cue/testdata/eval/fields.txtar +++ b/cue/testdata/eval/fields.txtar @@ -1,9 +1,9 @@ -- in.cue -- bulkToSelf: { - a: { - foo: [string]: int - foo: bar: "3" // error - } + a: { + foo: [string]: int + foo: bar: "3" // error + } } intField: { (2): string @@ -28,8 +28,8 @@ intField: { -- out/eval -- Errors: bulkToSelf.a.foo.bar: conflicting values "3" and int (mismatched types string and int): - ./in.cue:3:24 - ./in.cue:4:19 + ./in.cue:3:18 + ./in.cue:4:18 intField: integer fields not supported: ./in.cue:8:3 @@ -44,8 +44,8 @@ Result: // [eval] bar: (_|_){ // [eval] bulkToSelf.a.foo.bar: conflicting values "3" and int (mismatched types string and int): - // ./in.cue:3:24 - // ./in.cue:4:19 + // ./in.cue:3:18 + // ./in.cue:4:18 } } } diff --git a/cue/testdata/eval/github.txtar b/cue/testdata/eval/github.txtar index ab1ac6ad4..ab3c88ff8 100644 --- a/cue/testdata/eval/github.txtar +++ b/cue/testdata/eval/github.txtar @@ -339,7 +339,6 @@ _#tempCueckooGitDir: """ _#curl: "curl -f -s" -- cue.mod/module.cue -- module: "mod.com" - -- cue.mod/pkg/github.com/SchemaStore/schemastore/src/schemas/json/github-workflow.cue -- package json diff --git a/cue/testdata/eval/incomplete.txtar b/cue/testdata/eval/incomplete.txtar index 89c3dd9cb..61ef80ab3 100644 --- a/cue/testdata/eval/incomplete.txtar +++ b/cue/testdata/eval/incomplete.txtar @@ -1,29 +1,28 @@ -- in.cue -- s: string -e1: s + s -e2: >"bar" & s // okay -e3: >s & "foo" // okay +e1: s + s +e2: >"bar" & s // okay +e3: >s & "foo" // okay e3b: >s e4: >e1 & s e5: =5 + a: c - b + b: c - a + c: a+b & >=5 } -a: int +a: int okay: (>10 & "bar" } @@ -31,7 +30,7 @@ okay: (>10 & 10 & 10 * 2) & 0 -issue405: >=100 <=200 - +issue405: >=100 <= 200 -- out/eval -- permanentlyIncompleteOperands.a: invalid operand string ('+' requires concrete value): - ./in.cue:3:8 + ./in.cue:3:5 permanentlyIncompleteOperandsNested.a: invalid operand int ('+' requires concrete value): - ./in.cue:8:9 + ./in.cue:8:6 permanentlyIncompleteOperandsDisjunct.a: invalid operand int ('+' requires concrete value): - ./in.cue:12:9 + ./in.cue:12:6 issue680: invalid operand >10 ('*' requires concrete value): - ./in.cue:16:12 + ./in.cue:15:12 issue405: invalid operand >=100 ('<=' requires concrete value): - ./in.cue:18:11 + ./in.cue:17:11 -- out/compile -- permanentlyIncompleteOperands.a: invalid operand string ('+' requires concrete value): - ./in.cue:3:8 + ./in.cue:3:5 permanentlyIncompleteOperandsNested.a: invalid operand int ('+' requires concrete value): - ./in.cue:8:9 + ./in.cue:8:6 permanentlyIncompleteOperandsDisjunct.a: invalid operand int ('+' requires concrete value): - ./in.cue:12:9 + ./in.cue:12:6 issue680: invalid operand >10 ('*' requires concrete value): - ./in.cue:16:12 + ./in.cue:15:12 issue405: invalid operand >=100 ('<=' requires concrete value): - ./in.cue:18:11 + ./in.cue:17:11 --- in.cue { permanentlyIncompleteOperands: { diff --git a/cue/testdata/eval/issue349.txtar b/cue/testdata/eval/issue349.txtar index 9921a918f..1c6265aeb 100644 --- a/cue/testdata/eval/issue349.txtar +++ b/cue/testdata/eval/issue349.txtar @@ -1,13 +1,13 @@ -- in.cue -- ex: { - "aaa": "aaa", - "list": "list", - "zzz": "zzz", - "AAA": "AAA", - "html": "html", - "HTML": "html", - "ZZZ": "ZZZ", - "Html": "html", + "aaa": "aaa" + "list": "list" + "zzz": "zzz" + "AAA": "AAA" + "html": "html" + "HTML": "html" + "ZZZ": "ZZZ" + "Html": "html" } -- out/eval -- (struct){ diff --git a/cue/testdata/eval/issue494.txtar b/cue/testdata/eval/issue494.txtar index ba3fdad10..dbe4787a5 100644 --- a/cue/testdata/eval/issue494.txtar +++ b/cue/testdata/eval/issue494.txtar @@ -1,7 +1,7 @@ -- in.cue -- -_Q : [{pos: 0},{pos: 1}] +_Q: [{pos: 0}, {pos: 1}] -a: [rn=string]: _Q[0:len(a[rn])] +a: [rn=string]: _Q[0:len(a[rn])] a: ben: [{}] b: [rn=string]: _Q[0:1] @@ -10,7 +10,7 @@ b: ben: [{}] c: [rn=string]: [...{l: len(a[rn])}] c: ben: [{}] -#d: [rn=string]: [...{pos:uint}] & _Q[0:len(#d[rn])] +#d: [rn=string]: [...{pos: uint}] & _Q[0:len(#d[rn])] #d: ben: [{}] d: #d diff --git a/cue/testdata/eval/issue500.txtar b/cue/testdata/eval/issue500.txtar index 7beacec6f..ca17a55dd 100644 --- a/cue/testdata/eval/issue500.txtar +++ b/cue/testdata/eval/issue500.txtar @@ -10,7 +10,7 @@ b: strings.Join(["t", "e", "s", "t"][1:], "") c: ["t", "e", "s", "t"][1:] d: strings.Join(c, "") -e: strings.Join(["a"] + ["b"], "") +e: strings.Join(["a"]+["b"], "") f: ["a"] + ["b"] g: strings.Join(f, "") @@ -19,7 +19,6 @@ h: strings.Join(3*["a"], "") i: 3 * ["b"] j: strings.Join(i, "") - -- out/eval -- (struct){ a: (string){ "est" } diff --git a/cue/testdata/eval/issue545.txtar b/cue/testdata/eval/issue545.txtar index 7e6fa6055..f72bec842 100644 --- a/cue/testdata/eval/issue545.txtar +++ b/cue/testdata/eval/issue545.txtar @@ -4,39 +4,37 @@ title: Simplification of validators. package main import ( - "strings" - "time" + "strings" + "time" ) t1: { - #Test: { - #HTTP: =~"^http://" - #SSH: !~"^ssh://" - #USER: strings.MinRunes(3) - source: #HTTP | #SSH | #USER | #Test - } + #Test: { + #HTTP: =~"^http://" + #SSH: !~"^ssh://" + #USER: strings.MinRunes(3) + source: #HTTP | #SSH | #USER | #Test + } - foo: #Test & { - source: "http://blablabla" - } + foo: #Test & { + source: "http://blablabla" + } - bar: #Test & { - source: foo - } + bar: #Test & { + source: foo + } } t2: { - str: "foo" - a: =~str - b: =~"foo" - c: a & b & a & b + str: "foo" + a: =~str + b: =~"foo" + c: a & b & a & b - d: time.Time - e: time.Time() - f: d & e & d & e + d: time.Time + e: time.Time() + f: d & e & d & e } - - -- out/eval -- (struct){ t1: (struct){ diff --git a/cue/testdata/eval/issue599.txtar b/cue/testdata/eval/issue599.txtar index 006893f8f..e773c6f82 100644 --- a/cue/testdata/eval/issue599.txtar +++ b/cue/testdata/eval/issue599.txtar @@ -2,62 +2,62 @@ package deps a: { - #A: { - n: string - depends_on: [...#AnyA] - } + #A: { + n: string + depends_on: [...#AnyA] + } - #AnyA: { - n: string - depends_on: [...#AnyA] - ... - } + #AnyA: { + n: string + depends_on: [...#AnyA] + ... + } - #A1: { - #A - x: int - y: z: string // Comment to avoid error - } + #A1: { + #A + x: int + y: z: string // Comment to avoid error + } - #A2: { - #A - i: string - } + #A2: { + #A + i: string + } - s: [Name=string]: #AnyA & { n: Name } + s: [Name=string]: #AnyA & {n: Name} - s: foo: #A1 & { - x: 10 - y: z: "z" // Comment to avoid error - } + s: foo: #A1 & { + x: 10 + y: z: "z" // Comment to avoid error + } - s: bar: #A2 & { - i: "hello bar" - depends_on: [s.foo] - } + s: bar: #A2 & { + i: "hello bar" + depends_on: [s.foo] + } } b: { - #A: { - f: {...} - } + #A: { + f: {...} + } - #A1: { - #A - // f: {...} // Uncomment to fix - } + #A1: { + #A + // f: {...} // Uncomment to fix + } - #C: { - d: {...} - } + #C: { + d: {...} + } - s: [string]: #A1 + s: [string]: #A1 - s: foo: { - f: #C & { - d: foo: "bar" - } - } + s: foo: { + f: #C & { + d: foo: "bar" + } + } } -- out/eval -- (struct){ diff --git a/cue/testdata/eval/let.txtar b/cue/testdata/eval/let.txtar index e7e9c382e..f5b243fff 100644 --- a/cue/testdata/eval/let.txtar +++ b/cue/testdata/eval/let.txtar @@ -1,28 +1,28 @@ -- in.cue -- -let A = 3 * 3 + let A = 3 * 3 let B = A + A let C = B + B let D = C + C let E = D + D let F = E + E b: { - let G = F + F - let H = G + G - let I = H + H - let J = I + I - let K = J + J - let L = K + K - let M = L + L - let N = M + M - let O = N + N - let P = O + O - let Q = P + P - let R = Q + Q - let S = R + R - let T = S + S + let G = F + F + let H = G + G + let I = H + H + let J = I + I + let K = J + J + let L = K + K + let M = L + L + let N = M + M + let O = N + N + let P = O + O + let Q = P + P + let R = Q + Q + let S = R + R + let T = S + S - a: T - b: F + a: T + b: F } -- out/eval -- (struct){ diff --git a/cue/testdata/eval/lists.txtar b/cue/testdata/eval/lists.txtar index 96276d26c..c2ce84f83 100644 --- a/cue/testdata/eval/lists.txtar +++ b/cue/testdata/eval/lists.txtar @@ -6,8 +6,7 @@ a: [1, 2, 3, d] b: a[3] d: 5 -c: [for x in [[1, 2]][0] { x + d }] - +c: [ for x in [[1, 2]][0] {x + d}] -- out/eval -- (struct){ a: (#list){ diff --git a/cue/testdata/eval/merge.txtar b/cue/testdata/eval/merge.txtar index c45b86677..6c80373c2 100644 --- a/cue/testdata/eval/merge.txtar +++ b/cue/testdata/eval/merge.txtar @@ -4,20 +4,20 @@ TODO: allow dynamic fields -- in.cue -- key: "app01" manifests: [ - { - deployment: #map: [string]: { name: string, image: string, desc: string } - deployment: #map: "\(key)": name: "app01" - }, - { - deployment: #map: app01: image: "image01" - // TODO: allow - // deployment: #map: "\("app03")": image: "image01" - } + { + deployment: #map: [string]: {name: string, image: string, desc: string} + deployment: #map: "\(key)": name: "app01" + }, + { + deployment: #map: app01: image: "image01" + // TODO: allow + // deployment: #map: "\("app03")": image: "image01" + }, ] // unify results: _ for _, manifest in manifests { - results: manifest + results: manifest } -- out/eval -- (struct){ diff --git a/cue/testdata/eval/resolve_basic.txtar b/cue/testdata/eval/resolve_basic.txtar index 744e31c67..8fe3a502b 100644 --- a/cue/testdata/eval/resolve_basic.txtar +++ b/cue/testdata/eval/resolve_basic.txtar @@ -1,14 +1,13 @@ -- in.cue -- - a: 1 - b: a + 1 - d: { - x: _ - y: b + x - } - e: d & { - x: 5 - } - +a: 1 +b: a + 1 +d: { + x: _ + y: b + x +} +e: d & { + x: 5 +} -- out/eval -- (struct){ a: (int){ 1 } @@ -17,8 +16,8 @@ x: (_){ _ } y: (_|_){ // [incomplete] d.y: non-concrete value _ in operand to +: - // ./in.cue:5:6 - // ./in.cue:4:6 + // ./in.cue:5:5 + // ./in.cue:4:5 } } e: (struct){ diff --git a/cue/testdata/eval/resolve_env.txtar b/cue/testdata/eval/resolve_env.txtar index 45c8bb39e..311483a31 100644 --- a/cue/testdata/eval/resolve_env.txtar +++ b/cue/testdata/eval/resolve_env.txtar @@ -1,13 +1,13 @@ -- in.cue -- a: { - d: int - b: { - c: d - } + d: int + b: { + c: d + } } x: { - d: 2 - b: a.b.c // should be int, not 2 + d: 2 + b: a.b.c // should be int, not 2 } a1: y: 5 a1: a2: a3: a4: a5: a1.y diff --git a/cue/testdata/eval/selectors.txtar b/cue/testdata/eval/selectors.txtar index b0550d99b..e131d3cf6 100644 --- a/cue/testdata/eval/selectors.txtar +++ b/cue/testdata/eval/selectors.txtar @@ -2,19 +2,19 @@ a: 1 b: a + 1 d: { - x: _ - y: b + x + x: _ + y: b + x } e: d & { - x: 5 + x: 5 } f: { - a: "foo-bar": 3 - b: a."foo-bar" + a: "foo-bar": 3 + b: a."foo-bar" } g: { - a: "foo-bar": c: 3 - b: a."foo-bar".c + a: "foo-bar": c: 3 + b: a."foo-bar".c } -- out/eval -- (struct){ @@ -24,8 +24,8 @@ g: { x: (_){ _ } y: (_|_){ // [incomplete] d.y: non-concrete value _ in operand to +: - // ./in.cue:5:6 - // ./in.cue:4:6 + // ./in.cue:5:5 + // ./in.cue:4:5 } } e: (struct){ diff --git a/cue/testdata/eval/structs.txtar b/cue/testdata/eval/structs.txtar index de12aa6e9..5069f55a3 100644 --- a/cue/testdata/eval/structs.txtar +++ b/cue/testdata/eval/structs.txtar @@ -2,7 +2,6 @@ import "struct" v: {a: struct.MaxFields(2) & {}}.a - -- out/eval -- (struct){ v: (struct){ diff --git a/cue/testdata/eval/unify.txtar b/cue/testdata/eval/unify.txtar index 2ac87ed2f..a74646222 100644 --- a/cue/testdata/eval/unify.txtar +++ b/cue/testdata/eval/unify.txtar @@ -1,16 +1,16 @@ -- in.cue -- a: d: { - #base - #info: {...} - Y: #info.X + #base + #info: {...} + Y: #info.X } #base: { - #info: {...} + #info: {...} } a: [Name=string]: {#info: { - X: "foo" + X: "foo" }} -- out/eval -- (struct){ diff --git a/cue/testdata/export/007.txtar b/cue/testdata/export/007.txtar index 014871ebf..c1dddc8b9 100644 --- a/cue/testdata/export/007.txtar +++ b/cue/testdata/export/007.txtar @@ -1,10 +1,10 @@ -- in.cue -- { - #a: {b: 2.0, s: "abc"} - b: #a.b - c: #a.c - d: #a["d"] - e: #a.t[2:3] + #a: {b: 2.0, s: "abc"} + b: #a.b + c: #a.c + d: #a["d"] + e: #a.t[2:3] } -- out/def -- #a: { @@ -32,11 +32,11 @@ e: _|_ // undefined field "t" -- out/eval -- Errors: c: undefined field: c: - ./in.cue:4:9 + ./in.cue:4:8 d: undefined field: d: - ./in.cue:5:9 + ./in.cue:5:8 e: undefined field: t: - ./in.cue:6:9 + ./in.cue:6:8 Result: (_|_){ @@ -48,14 +48,14 @@ Result: b: (float){ 2.0 } c: (_|_){ // [eval] c: undefined field: c: - // ./in.cue:4:9 + // ./in.cue:4:8 } d: (_|_){ // [eval] d: undefined field: d: - // ./in.cue:5:9 + // ./in.cue:5:8 } e: (_|_){ // [eval] e: undefined field: t: - // ./in.cue:6:9 + // ./in.cue:6:8 } } diff --git a/cue/testdata/export/032.txtar b/cue/testdata/export/032.txtar index 844339dbf..722595263 100644 --- a/cue/testdata/export/032.txtar +++ b/cue/testdata/export/032.txtar @@ -3,7 +3,7 @@ -- in.cue -- { [string]: _ - foo: 3 + foo: 3 } -- out/def -- foo: 3 diff --git a/cue/testdata/interpolation/incomplete.txtar b/cue/testdata/interpolation/incomplete.txtar index a9f684697..d41d5a126 100644 --- a/cue/testdata/interpolation/incomplete.txtar +++ b/cue/testdata/interpolation/incomplete.txtar @@ -4,9 +4,9 @@ Issue #553 a: "foo" b: "boo" commands: { - #c: { - help: "help!" - } + #c: { + help: "help!" + } } out: """ a is \(a) diff --git a/cue/testdata/interpolation/scalars.txtar b/cue/testdata/interpolation/scalars.txtar index 23cce03f1..222e9b5fb 100644 --- a/cue/testdata/interpolation/scalars.txtar +++ b/cue/testdata/interpolation/scalars.txtar @@ -4,12 +4,12 @@ bool1: "1+1=2: \(true)" bool2: "1+1=1: \(false)" // one replacement character -b1: 'a\xED\x95a' +b1: 'a\xED\x95a' bytes1s: "\(b1)" bytes1b: '\(b1)' // two replacement characters -b2: 'a\x80\x95a' +b2: 'a\x80\x95a' bytes2s: "\(b2)" bytes2b: '\(b2)' diff --git a/cue/testdata/lists/020_list_compilefail.txtar b/cue/testdata/lists/020_list_compilefail.txtar index 65ec7ff58..f8ddc88bb 100644 --- a/cue/testdata/lists/020_list_compilefail.txtar +++ b/cue/testdata/lists/020_list_compilefail.txtar @@ -4,13 +4,12 @@ l3: <=2 * [] l4: <=2 * [int] l5: <=2 * (int * [int]) -b: <=5 * [int] +b: <=5 * [int] b: [1, 2, ...] c: (>=3 & <=5) * [int] c: [1, 2, ...] d: >=2 * [int] d: [1, 2, ...] - -- out/compile -- l3: invalid operand <=2 ('*' requires concrete value): ./in.cue:1:5 @@ -19,7 +18,7 @@ l4: invalid operand <=2 ('*' requires concrete value): l5: invalid operand <=2 ('*' requires concrete value): ./in.cue:3:5 b: invalid operand <=5 ('*' requires concrete value): - ./in.cue:4:4 + ./in.cue:4:5 d: invalid operand >=2 ('*' requires concrete value): ./in.cue:8:4 --- in.cue @@ -64,6 +63,6 @@ l4: invalid operand <=2 ('*' requires concrete value): l5: invalid operand <=2 ('*' requires concrete value): ./in.cue:3:5 b: invalid operand <=5 ('*' requires concrete value): - ./in.cue:4:4 + ./in.cue:4:5 d: invalid operand >=2 ('*' requires concrete value): ./in.cue:8:4 diff --git a/cue/testdata/packages/embed.txtar b/cue/testdata/packages/embed.txtar index c9a3379e5..454f818ba 100644 --- a/cue/testdata/packages/embed.txtar +++ b/cue/testdata/packages/embed.txtar @@ -2,24 +2,23 @@ cue eval ./pkg:foo -- cue.mod/module.cue -- module: "example.com" - -- in.cue -- package foo import "example.com/pkg:bar" + bar z: 3 - -- pkg/bar.cue -- package bar import "example.com/pkg:baz" + foo: { - baz - y: 2 + baz + y: 2 } foo - -- pkg/baz.cue -- package baz diff --git a/cue/testdata/packages/issue398.txtar b/cue/testdata/packages/issue398.txtar index 5dfe8d874..9dd0c68d8 100644 --- a/cue/testdata/packages/issue398.txtar +++ b/cue/testdata/packages/issue398.txtar @@ -2,16 +2,21 @@ module: "example.com" -- foo.cue -- package foo + import "example.com/pkg:bar" + bar zz: 3 -- pkg/bar.cue -- package bar + import "example.com/pkg:baz" + baz yy: 2 -- pkg/baz.cue -- package baz + xx: 1 -- out/eval -- (struct){ diff --git a/cue/testdata/packages/sub.txtar b/cue/testdata/packages/sub.txtar index add9bae9c..192042433 100644 --- a/cue/testdata/packages/sub.txtar +++ b/cue/testdata/packages/sub.txtar @@ -2,20 +2,18 @@ cue eval ./pkg:foo -- cue.mod/module.cue -- module: "example.com" - -- in.cue -- package test import pkg2 "example.com/foo/pkg1" + #pkg1: pkg2.Object "Hello \(#pkg1)!" - -- foo/pkg1/file.cue -- package pkg1 Object: "World" - -- out/eval -- (string){ "Hello World!" diff --git a/cue/testdata/references/errors.txtar b/cue/testdata/references/errors.txtar index e7f185d76..9e2946b2e 100644 --- a/cue/testdata/references/errors.txtar +++ b/cue/testdata/references/errors.txtar @@ -1,41 +1,41 @@ -- references.cue -- - missingField: { - a: {} - r: a.b + a: {} + r: a.b } missingFieldClosed: { - #a: {} - r: #a.b + #a: {} + r: #a.b } missingFieldNested: { - a: {} - // Must refer to `b` in error - r: a.b.c + a: {} + // Must refer to `b` in error + r: a.b.c } missingFieldNestedClosed: { - #a: {} - // Must refer to `d` in error - r: #a.d.c + #a: {} + + // Must refer to `d` in error + r: #a.d.c } missingFieldNestedInInterpolation: { - a: {} - // Must refer to `b` in error - r1: "\(a.b.c)" - // Must refer to `d` in error: in case only one error is shown for a - // a location, ensure it doesn't alphabetically sort and pick `c` instead. - r2: "\(a.d.c)" + a: {} + // Must refer to `b` in error + r1: "\(a.b.c)" + // Must refer to `d` in error: in case only one error is shown for a + // a location, ensure it doesn't alphabetically sort and pick `c` instead. + r2: "\(a.d.c)" } -- out/eval -- Errors: missingFieldClosed.r: undefined field: b: - ./references.cue:9:11 + ./references.cue:8:8 missingFieldNestedClosed.r: undefined field: d: - ./references.cue:21:11 + ./references.cue:21:8 Result: (_|_){ @@ -45,7 +45,7 @@ Result: } r: (_|_){ // [incomplete] missingField.r: undefined field: b: - // ./references.cue:4:10 + // ./references.cue:3:7 } } missingFieldClosed: (_|_){ @@ -54,7 +54,7 @@ Result: } r: (_|_){ // [eval] missingFieldClosed.r: undefined field: b: - // ./references.cue:9:11 + // ./references.cue:8:8 } } missingFieldNested: (struct){ @@ -62,7 +62,7 @@ Result: } r: (_|_){ // [incomplete] missingFieldNested.r: undefined field: b: - // ./references.cue:15:10 + // ./references.cue:14:7 } } missingFieldNestedClosed: (_|_){ @@ -71,7 +71,7 @@ Result: } r: (_|_){ // [eval] missingFieldNestedClosed.r: undefined field: d: - // ./references.cue:21:11 + // ./references.cue:21:8 } } missingFieldNestedInInterpolation: (struct){ @@ -79,13 +79,13 @@ Result: } r1: (_|_){ // [incomplete] missingFieldNestedInInterpolation.r1: invalid interpolation: undefined field: b: - // ./references.cue:27:9 - // ./references.cue:27:14 + // ./references.cue:27:6 + // ./references.cue:27:11 } r2: (_|_){ // [incomplete] missingFieldNestedInInterpolation.r2: invalid interpolation: undefined field: d: - // ./references.cue:30:9 - // ./references.cue:30:14 + // ./references.cue:30:6 + // ./references.cue:30:11 } } } diff --git a/cue/testdata/references/incomplete.txtar b/cue/testdata/references/incomplete.txtar index 8efe5032d..ca67e9213 100644 --- a/cue/testdata/references/incomplete.txtar +++ b/cue/testdata/references/incomplete.txtar @@ -1,40 +1,39 @@ -- in.cue -- comprehensions: { - a: {} - b: { - if a.b { - } - } - c: { - for x in a.b { x } - } + a: {} + b: { + if a.b { + } + } + c: { + for x in a.b {x} + } } openStruct: { - a: {} - b: a.c + a: {} + b: a.c } selectFromTop: { - top: _ - a: top.foo + top: _ + a: top.foo } indexOnTop: { - top: _ - a: top[2] + top: _ + a: top[2] } incompleteIndex: { - top: _ - a: [1][top] + top: _ + a: [1][top] } - -- out/eval -- Errors: incompleteIndex.a: invalid index top (invalid type _): - ./in.cue:29:8 - ./in.cue:29:12 + ./in.cue:29:7 + ./in.cue:29:11 Result: (_|_){ @@ -44,11 +43,11 @@ Result: } b: (_|_){ // [incomplete] comprehensions.b: undefined field: b: - // ./in.cue:4:14 + // ./in.cue:4:8 } c: (_|_){ // [incomplete] comprehensions.c: undefined field: b: - // ./in.cue:8:20 + // ./in.cue:8:14 } } openStruct: (struct){ @@ -56,21 +55,21 @@ Result: } b: (_|_){ // [incomplete] openStruct.b: undefined field: c: - // ./in.cue:14:10 + // ./in.cue:14:7 } } selectFromTop: (struct){ top: (_){ _ } a: (_|_){ // [incomplete] selectFromTop.a: top.foo undefined as top is incomplete (type _): - // ./in.cue:19:8 + // ./in.cue:19:7 } } indexOnTop: (struct){ top: (_){ _ } a: (_|_){ // [incomplete] indexOnTop.a: top[2] undefined as top is incomplete (type _): - // ./in.cue:24:8 + // ./in.cue:24:7 } } incompleteIndex: (_|_){ @@ -78,8 +77,8 @@ Result: top: (_){ _ } a: (_|_){ // [eval] incompleteIndex.a: invalid index top (invalid type _): - // ./in.cue:29:8 - // ./in.cue:29:12 + // ./in.cue:29:7 + // ./in.cue:29:11 } } } diff --git a/cue/testdata/references/index.txtar b/cue/testdata/references/index.txtar index 2fbcbe608..d2d5143c6 100644 --- a/cue/testdata/references/index.txtar +++ b/cue/testdata/references/index.txtar @@ -4,57 +4,57 @@ stringIndex: {foo: "bar"}["foo"] stringOfNumberIndex: {"3": 3}["3"] -indexToDefault: (*[0] | {})[0] +indexToDefault: (*[0] | {})[0] outOfBoundsDisjunction: (*[] | {})[1] // Ensure these are errors. -indexDoesNotDistribute: (*[] | [1])[0] +indexDoesNotDistribute: (*[] | [1])[0] doesNotDistributeType: { - l: [] - a: (*l | {"3": 3})["3"] + l: [] + a: (*l | {"3": 3})["3"] } stringIndexToList: [2][""] indexOutOfBounds2: 2[2] -booleanIndex: [][true] +booleanIndex: [][true] indexOutOfBounds3: [1, 2, 3][4] -negativeIndex: [1, 2, 3][-1] +negativeIndex: [1, 2, 3][-1] varIndexTooLarge: { - n: 3 - a: [1, 2, 3][n] + n: 3 + a: [1, 2, 3][n] } varNegativeIndex: { - n: -1 - a: [1, 2, 3][n] + n: -1 + a: [1, 2, 3][n] } -- out/eval -- Errors: outOfBoundsDisjunction: invalid list index 1 (out of bounds): ./in.cue:7:36 indexDoesNotDistribute: index out of range [0] with length 0: - ./in.cue:10:41 + ./in.cue:10:37 doesNotDistributeType.a: invalid list index "3" (type string): - ./in.cue:13:24 + ./in.cue:13:21 stringIndexToList: invalid list index "" (type string): ./in.cue:16:24 indexOutOfBounds2: invalid operand 2 (found int, want list or struct): ./in.cue:17:20 booleanIndex: invalid index true (invalid type bool): - ./in.cue:18:15 - ./in.cue:18:18 + ./in.cue:18:20 + ./in.cue:18:23 indexOutOfBounds3: invalid list index 4 (out of bounds): ./in.cue:19:30 negativeIndex: invalid index -1 (index must be non-negative): - ./in.cue:20:16 - ./in.cue:20:26 + ./in.cue:20:20 + ./in.cue:20:30 varIndexTooLarge.a: index out of range [3] with length 3: - ./in.cue:24:18 + ./in.cue:24:15 varNegativeIndex.a: index n out of range [-1]: - ./in.cue:29:8 - ./in.cue:28:8 - ./in.cue:29:18 + ./in.cue:29:5 + ./in.cue:28:5 + ./in.cue:29:15 Result: (_|_){ @@ -69,7 +69,7 @@ Result: } indexDoesNotDistribute: (_|_){ // [eval] indexDoesNotDistribute: index out of range [0] with length 0: - // ./in.cue:10:41 + // ./in.cue:10:37 } doesNotDistributeType: (_|_){ // [eval] @@ -77,7 +77,7 @@ Result: } a: (_|_){ // [eval] doesNotDistributeType.a: invalid list index "3" (type string): - // ./in.cue:13:24 + // ./in.cue:13:21 } } stringIndexToList: (_|_){ @@ -90,8 +90,8 @@ Result: } booleanIndex: (_|_){ // [eval] booleanIndex: invalid index true (invalid type bool): - // ./in.cue:18:15 - // ./in.cue:18:18 + // ./in.cue:18:20 + // ./in.cue:18:23 } indexOutOfBounds3: (_|_){ // [eval] indexOutOfBounds3: invalid list index 4 (out of bounds): @@ -99,15 +99,15 @@ Result: } negativeIndex: (_|_){ // [eval] negativeIndex: invalid index -1 (index must be non-negative): - // ./in.cue:20:16 - // ./in.cue:20:26 + // ./in.cue:20:20 + // ./in.cue:20:30 } varIndexTooLarge: (_|_){ // [eval] n: (int){ 3 } a: (_|_){ // [eval] varIndexTooLarge.a: index out of range [3] with length 3: - // ./in.cue:24:18 + // ./in.cue:24:15 } } varNegativeIndex: (_|_){ @@ -115,9 +115,9 @@ Result: n: (int){ -1 } a: (_|_){ // [eval] varNegativeIndex.a: index n out of range [-1]: - // ./in.cue:29:8 - // ./in.cue:28:8 - // ./in.cue:29:18 + // ./in.cue:29:5 + // ./in.cue:28:5 + // ./in.cue:29:15 } } } diff --git a/cue/testdata/references/labels.txtar b/cue/testdata/references/labels.txtar index a81d59f0e..1d345ea72 100644 --- a/cue/testdata/references/labels.txtar +++ b/cue/testdata/references/labels.txtar @@ -3,7 +3,7 @@ // direct a: [X=string]: X -a: bar: _ +a: bar: _ // in struct b: [X=string]: {X} @@ -20,70 +20,68 @@ d: bar: {} // nested e: [X=string]: [Y=string]: X + Y -e: foo: bar: _ +e: foo: bar: _ // Field aliases bar: 3 f1: C="foo\(bar)": { - name: "xx" - foo: C.name + name: "xx" + foo: C.name } // nested f1: D="foo\(bar)": E="foo\(bar)baz": { - name: "xx" - a: D["foo\(bar)baz"].name - b: E.name + name: "xx" + a: D["foo\(bar)baz"].name + b: E.name } // Combo c1: C="foo\(bar)": [D=string]: { - name: D - foo: C.x.name + name: D + foo: C.x.name } c1: foo3: x: _ emptyLabel: { - "": 1 - a: emptyLabel[""] + "": 1 + a: emptyLabel[""] } underscore: a: { - // Issue #1454 - foo: #Foo - foo: "_": "bar" - #Foo: [=~""]: string + // Issue #1454 + foo: #Foo + foo: "_": "bar" + #Foo: [=~""]: string } underscore: c: { - foo: "_": "any" - foo: [=~""]: string + foo: "_": "any" + foo: [=~""]: string } underscore: d: { - bar: "_": "any" - #bar: [string]: string - bar: #bar + bar: "_": "any" + #bar: [string]: string + bar: #bar } underscore: e: { - baz: "_h": "any" - #baz: [=~"_"]: string - baz: #baz + baz: "_h": "any" + #baz: [=~"_"]: string + baz: #baz } - // TODO: support. Also not yet supported in old implementation. // c10: { -// C=[string]: { -// name: "x" -// foo: C.name -// } +// C=[string]: { +// name: "x" +// foo: C.name +// } // } // c2: c1 & { x: _ } - -- out/eval -- (struct){ a: (struct){ diff --git a/cue/testdata/references/let.txtar b/cue/testdata/references/let.txtar index 7a0ad177c..447520b98 100644 --- a/cue/testdata/references/let.txtar +++ b/cue/testdata/references/let.txtar @@ -15,27 +15,27 @@ a3: b: c: 100*A3[0] + A3[0] a4list: [{4}] let A4 = a4list -a4: [ for x in A4 { v: 404 } ] +a4: [ for x in A4 {v: 404}] a5list: [{5}] let A5 = a5list -a5: b: [ for x in A5 { v: 505 } ] +a5: b: [ for x in A5 {v: 505}] a6list: [{6}] let A6 = a6list -a6: b: c: [ for x in A6 { v: 606 } ] +a6: b: c: [ for x in A6 {v: 606}] a7list: [{7}] let A7 = a7list -a7: { for x in A7 { v: 707 } } +a7: {for x in A7 {v: 707}} a8list: [{8}] let A8 = a8list -a8: b: { for x in A8 { v: 808 } } +a8: b: {for x in A8 {v: 808}} a9list: [{9}] let A9 = a9list -a9: b: c: { for x in A9 { v: 909 } } +a9: b: c: {for x in A9 {v: 909}} // Issue #609: // When a let value resolved to an incomplete value, it should pass this @@ -43,39 +43,38 @@ a9: b: c: { for x in A9 { v: 909 } } // a gobbling of this incomplete status. The problem seemed to be not // exclusive to the use of let, though. incompleteLet: { - input: [1,2,3,4,5] + input: [1, 2, 3, 4, 5] - last: { - min: list.Min(input) - max: list.Max(input) - } + last: { + min: list.Min(input) + max: list.Max(input) + } - bar: { - let mn = last.min - let mx = list.max + bar: { + let mn = last.min + let mx = list.max - min: mn - max: mx - } + min: mn + max: mx + } - x: { - if list.max < 0 { - } - } + x: { + if list.max < 0 { + } + } } issue1116: { - a: { - #a: ["a", "b"] - let List = #a - List[len(List)-1] - } - b: { - let List = #a - List[len(List)-1] - #a: ["a", "b"] - } + a: { + #a: ["a", "b"] + let List = #a + List[len(List)-1] + } + b: { + let List = #a + List[len(List)-1] + #a: ["a", "b"] + } } - -- out/compile -- --- in.cue { @@ -302,12 +301,12 @@ issue1116: { min: (int){ 1 } max: (_|_){ // [incomplete] incompleteLet.bar.max: undefined field: max: - // ./in.cue:54:23 + // ./in.cue:54:17 } } x: (_|_){ // [incomplete] incompleteLet.x: undefined field: max: - // ./in.cue:61:17 + // ./in.cue:61:11 } } issue1116: (struct){ diff --git a/cue/testdata/references/letcycle.txtar b/cue/testdata/references/letcycle.txtar index 4047eb287..8ce2634e0 100644 --- a/cue/testdata/references/letcycle.txtar +++ b/cue/testdata/references/letcycle.txtar @@ -1,65 +1,65 @@ -- in.cue -- cycles: { - a: { - let A = { c: B } - let B = A - out: A - } + a: { + let A = {c: B} + let B = A + out: A + } - b: { - let A = { c: B } - let B = { A.c } - out: A - } + b: { + let A = {c: B} + let B = {A.c} + out: A + } - issue1042: { - #FullAdder: { - // IN - a: bool - b: bool - c: bool - // OUT - sum: bool - carry: bool - } + issue1042: { + #FullAdder: { + // IN + a: bool + b: bool + c: bool + // OUT + sum: bool + carry: bool + } - #Add16: { - a: [bool] * 16 - b: [bool] * 16 - out: [bool] * 16 + #Add16: { + a: [bool] * 16 + b: [bool] * 16 + out: [bool] * 16 - let fulladders = [ - for i in list.Range(0, 4, 1) { - #FullAdder & {"a": a[i], "b": b[i], c: carries[i]} - } - ] - let carries = [ - false, - for i in list.Range(0, 4, 1) { fulladders[i].carry } - ] - out: [ - for i in list.Range(0, 4, 1) { fulladders[i].sum } - ] - } - } + let fulladders = [ + for i in list.Range(0, 4, 1) { + #FullAdder & {"a": a[i], "b": b[i], c: carries[i]} + }, + ] + let carries = [ + false, + for i in list.Range(0, 4, 1) {fulladders[i].carry}, + ] + out: [ + for i in list.Range(0, 4, 1) {fulladders[i].sum}, + ] + } + } } -- out/compile -- cycles.a.let[].c.c: cyclic references in let clause or alias: - ./in.cue:3:18 + ./in.cue:3:15 cycles.b.let[].c.c: cyclic references in let clause or alias: - ./in.cue:9:18 + ./in.cue:9:15 cycles.issue1042.#Add16.let[]: reference "list" not found: - ./in.cue:31:18 + ./in.cue:31:14 cycles.issue1042.#Add16.let[].for[].c.for[]: reference "list" not found: - ./in.cue:31:18 + ./in.cue:31:14 cycles.issue1042.#Add16.let[].for[].c.for[].for[].c: cyclic references in let clause or alias: - ./in.cue:32:50 + ./in.cue:32:45 cycles.issue1042.#Add16.let[]: reference "list" not found: - ./in.cue:37:18 + ./in.cue:37:14 cycles.issue1042.#Add16.let[].for[].c: reference "list" not found: - ./in.cue:37:18 + ./in.cue:37:14 cycles.issue1042.#Add16.out: reference "list" not found: - ./in.cue:40:18 + ./in.cue:40:14 --- in.cue { cycles: { @@ -98,18 +98,18 @@ cycles.issue1042.#Add16.out: reference "list" not found: } -- out/eval -- cycles.a.let[].c.c: cyclic references in let clause or alias: - ./in.cue:3:18 + ./in.cue:3:15 cycles.b.let[].c.c: cyclic references in let clause or alias: - ./in.cue:9:18 + ./in.cue:9:15 cycles.issue1042.#Add16.let[]: reference "list" not found: - ./in.cue:31:18 + ./in.cue:31:14 cycles.issue1042.#Add16.let[].for[].c.for[]: reference "list" not found: - ./in.cue:31:18 + ./in.cue:31:14 cycles.issue1042.#Add16.let[].for[].c.for[].for[].c: cyclic references in let clause or alias: - ./in.cue:32:50 + ./in.cue:32:45 cycles.issue1042.#Add16.let[]: reference "list" not found: - ./in.cue:37:18 + ./in.cue:37:14 cycles.issue1042.#Add16.let[].for[].c: reference "list" not found: - ./in.cue:37:18 + ./in.cue:37:14 cycles.issue1042.#Add16.out: reference "list" not found: - ./in.cue:40:18 + ./in.cue:40:14 diff --git a/cue/testdata/references/optional.txtar b/cue/testdata/references/optional.txtar index 7297afbf1..072a36a9b 100644 --- a/cue/testdata/references/optional.txtar +++ b/cue/testdata/references/optional.txtar @@ -1,8 +1,8 @@ -- in.cue -- a: { - foo?: int + foo?: int - b: foo + b: foo } -- out/compile -- --- in.cue @@ -17,7 +17,7 @@ a: { a: (struct){ b: (_|_){ // [incomplete] a.b: cannot reference optional field: foo: - // ./in.cue:4:8 + // ./in.cue:4:5 } } } diff --git a/cue/testdata/references/package.txtar b/cue/testdata/references/package.txtar index d702ca7d1..5f58bbd80 100644 --- a/cue/testdata/references/package.txtar +++ b/cue/testdata/references/package.txtar @@ -1,6 +1,5 @@ -- cue.mod/module.cue -- module: "example.com" - -- in.cue -- package exitcode @@ -11,7 +10,6 @@ import ( a: 1 incomplete: pkg.Settings - -- cue.mod/pkg/foo.com/example/example.cue -- package example @@ -21,7 +19,6 @@ package example // Issue #550 blah: Settings.anyKey Settings: {} - -- out/ -- -- out/eval -- diff --git a/cue/testdata/references/value.txtar b/cue/testdata/references/value.txtar index ff01a657a..3a08d4046 100644 --- a/cue/testdata/references/value.txtar +++ b/cue/testdata/references/value.txtar @@ -4,13 +4,12 @@ structShorthand: X={b: 3, c: X.b} // Note that X and Y are subtly different, as they have different bindings: // one binds to the field, the other to the value. In this case, that does not // make a difference. -fieldAndValue: X=foo: Y={ 3, #sum: X + Y } +fieldAndValue: X=foo: Y={3, #sum: X + Y} -valueCycle: b: X=3+X +valueCycle: b: X=3 + X // Issue #1003 listValueAlias: X = [1, 2, X[0]] - -- out/eval -- (struct){ structShorthand: (struct){ diff --git a/cue/testdata/resolve/011_bounds.txtar b/cue/testdata/resolve/011_bounds.txtar index e1e6e4708..5b2c006a3 100644 --- a/cue/testdata/resolve/011_bounds.txtar +++ b/cue/testdata/resolve/011_bounds.txtar @@ -43,19 +43,19 @@ s23e: >0.0 & <2.0 // no simplification s30: >0 & int floats: { - [string]: float - f1: <10.0 & <=5.0 - f2: <=10.0 & <5.0 - f3: <1.1 & <=1.1 - f4: <=1.1 & <=1.1 - f5: >1.1 & >=1.1 - f6: >=1.1 & >1.1 - f7: >=1.1 & <=1.1 + [string]: float + f1: <10.0 & <=5.0 + f2: <=10.0 & <5.0 + f3: <1.1 & <=1.1 + f4: <=1.1 & <=1.1 + f5: >1.1 & >=1.1 + f6: >=1.1 & >1.1 + f7: >=1.1 & <=1.1 - issue1310: >=2.1 & <=1.0 - fe2: >2.1 & <=2.1 + issue1310: >=2.1 & <=1.0 + fe2: >2.1 & <=2.1 - fe3: float & >2 & <=3 + fe3: float & >2 & <=3 } e1: null & !=null @@ -189,11 +189,11 @@ e9: conflicting values >"a" and <1 (mismatched types string and number): ./in.cue:64:5 ./in.cue:64:12 floats.fe2: incompatible bounds >2.1 and <=2.1: - ./in.cue:51:10 - ./in.cue:51:17 + ./in.cue:51:13 + ./in.cue:51:20 floats.issue1310: incompatible bounds >=2.1 and <=1.0: - ./in.cue:50:16 - ./in.cue:50:24 + ./in.cue:50:13 + ./in.cue:50:21 e3: invalid value 1 (out of bound >1): ./in.cue:58:5 ./in.cue:58:10 @@ -245,13 +245,13 @@ Result: f7: (number){ 1.1 } issue1310: (_|_){ // [eval] floats.issue1310: incompatible bounds >=2.1 and <=1.0: - // ./in.cue:50:16 - // ./in.cue:50:24 + // ./in.cue:50:13 + // ./in.cue:50:21 } fe2: (_|_){ // [eval] floats.fe2: incompatible bounds >2.1 and <=2.1: - // ./in.cue:51:10 - // ./in.cue:51:17 + // ./in.cue:51:13 + // ./in.cue:51:20 } fe3: (float){ &(>2, <=3, float) } } diff --git a/cue/testdata/resolve/048_builtins.txtar b/cue/testdata/resolve/048_builtins.txtar index c41ac20ae..f5ad1383b 100644 --- a/cue/testdata/resolve/048_builtins.txtar +++ b/cue/testdata/resolve/048_builtins.txtar @@ -4,8 +4,8 @@ #evalPartial -- in.cue -- import ( - "list" - "strings" + "list" + "strings" ) a1: { @@ -26,34 +26,33 @@ o3: o1 & {a: "foo", b: "baz"} // Issue #585 stringListErrors: { - a: { - x: [string, ...string] - result: strings.Join(x, " ") - } + a: { + x: [string, ...string] + result: strings.Join(x, " ") + } - b: { - x: [int, ...string] - result: strings.Join(x, " ") - } + b: { + x: [int, ...string] + result: strings.Join(x, " ") + } - c: { - x: [] - result: strings.Join(x, int) - } + c: { + x: [] + result: strings.Join(x, int) + } } decimalListErrors: { - a: { - x: [string] - result: list.Avg(x) - } + a: { + x: [string] + result: list.Avg(x) + } - b: { - x: [int, ...string] - result: list.Avg(x) - } + b: { + x: [int, ...string] + result: list.Avg(x) + } } - -- out/def -- a1: { a: =~"oo" & =~"fo" @@ -102,13 +101,13 @@ a3.a: invalid value "bar" (out of bound =~"fo"): ./in.cue:7:5 ./in.cue:12:14 stringListErrors.b.result: invalid list element 0 in argument 0 to call: cannot use value int (int) as string: - ./in.cue:31:17 - ./in.cue:30:13 + ./in.cue:31:11 + ./in.cue:30:7 stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join: - ./in.cue:36:33 + ./in.cue:36:27 decimalListErrors.a.result: invalid list element 0 in argument 0 to call: cannot use value string (string) as number: - ./in.cue:43:17 - ./in.cue:42:13 + ./in.cue:43:11 + ./in.cue:42:7 Result: (_|_){ @@ -174,8 +173,8 @@ Result: } result: (_|_){ // [incomplete] stringListErrors.a.result: non-concrete value string for element 0 of string list argument 0: - // ./in.cue:26:17 - // ./in.cue:25:13 + // ./in.cue:26:11 + // ./in.cue:25:7 } } b: (_|_){ @@ -185,8 +184,8 @@ Result: } result: (_|_){ // [eval] stringListErrors.b.result: invalid list element 0 in argument 0 to call: cannot use value int (int) as string: - // ./in.cue:31:17 - // ./in.cue:30:13 + // ./in.cue:31:11 + // ./in.cue:30:7 } } c: (_|_){ @@ -195,7 +194,7 @@ Result: } result: (_|_){ // [eval] stringListErrors.c.result: cannot use int (type int) as string in argument 2 to strings.Join: - // ./in.cue:36:33 + // ./in.cue:36:27 } } } @@ -208,8 +207,8 @@ Result: } result: (_|_){ // [eval] decimalListErrors.a.result: invalid list element 0 in argument 0 to call: cannot use value string (string) as number: - // ./in.cue:43:17 - // ./in.cue:42:13 + // ./in.cue:43:11 + // ./in.cue:42:7 } } b: (struct){ @@ -218,8 +217,8 @@ Result: } result: (_|_){ // [incomplete] decimalListErrors.b.result: non-concrete value int for element 0 of number list argument 0: - // ./in.cue:48:17 - // ./in.cue:47:13 + // ./in.cue:48:11 + // ./in.cue:47:7 } } } diff --git a/cue/testdata/scalars/embed.txtar b/cue/testdata/scalars/embed.txtar index 80f9c6c36..ee24f10f4 100644 --- a/cue/testdata/scalars/embed.txtar +++ b/cue/testdata/scalars/embed.txtar @@ -4,106 +4,105 @@ import "strings" intEmbed: { - a1: { - 2 - } - a2: { - v: { - 3 - #foo: a2.v + 1 - } - w: v - x: v.#foo - } - a3: a1 + a2.v + a1: { + 2 + } + a2: { + v: { + 3 + #foo: a2.v + 1 + } + w: v + x: v.#foo + } + a3: a1 + a2.v } listEmbed: { - a1: { - 2 - } - b3: { - [1, 2] - #foo: 1 - } - b4: b3 + b3 - b5: b3[1] - b6: b3[5] - b7: b4[a1] // 1 + a1: { + 2 + } + b3: { + [1, 2] + #foo: 1 + } + b4: b3 + b3 + b5: b3[1] + b6: b3[5] + b7: b4[a1] // 1 } stringEmbed: { - s1: { - "foo" - #bar: "bar" - } - s2: [ s1, { s1.#bar, #baz: 4 } ] - s3: strings.Join(s2, "--") + s1: { + "foo" + #bar: "bar" + } + s2: [ s1, {s1.#bar, #baz: 4}] + s3: strings.Join(s2, "--") } - outPattern: { - sum: { - out: #a + #b - #a: int - #b: int - } - used: sum&{#a: 1, #b: 3} + sum: { + out: #a + #b + #a: int + #b: int + } + used: sum & {#a: 1, #b: 3} } arithmetic: { - sum: { - #a + #b - #a: int - #b: int - } - a1: (sum&{_, #a: 1, #b: 3}) + 2 - a2: 2 + (sum&{_, #a: 1, #b: 3}) - a3: 2 + (2 + (sum&{_, #a: 1, #b: 3})) + sum: { + #a + #b + #a: int + #b: int + } + a1: (sum & {_, #a: 1, #b: 3}) + 2 + a2: 2 + (sum & {_, #a: 1, #b: 3}) + a3: 2 + (2 + (sum & {_, #a: 1, #b: 3})) } defCheck: { - a: { - #def: 1 - } - b: a.#def + a: { + #def: 1 + } + b: a.#def } optionalExists: { - string | { - value?: string + string | { + value?: string - if value != _|_ { - other: int - } - } + if value != _|_ { + other: int + } + } } optionalCheck: { - thing: string | { - value?: string + thing: string | { + value?: string - if value != _|_ { - other: int - } - } + if value != _|_ { + other: int + } + } - thing: { - value: "some string" - other: 3 - } + thing: { + value: "some string" + other: 3 + } } hidden: { - issue794: { - _foo: "foo" - [_foo] - } + issue794: { + _foo: "foo" + [_foo] + } } -- out/eval -- Errors: listEmbed.b6: invalid list index 5 (out of bounds): - ./in.cue:28:12 + ./in.cue:28:9 Result: (_|_){ @@ -140,7 +139,7 @@ Result: b5: (int){ 2 } b6: (_|_){ // [eval] listEmbed.b6: invalid list index 5 (out of bounds): - // ./in.cue:28:12 + // ./in.cue:28:9 } b7: (int){ 1 } } @@ -165,8 +164,8 @@ Result: sum: (struct){ out: (_|_){ // [incomplete] outPattern.sum.out: non-concrete value int in operand to +: - // ./in.cue:44:14 - // ./in.cue:45:13 + // ./in.cue:43:8 + // ./in.cue:44:8 } #a: (int){ int } #b: (int){ int } @@ -180,8 +179,8 @@ Result: arithmetic: (struct){ sum: (_|_){ // [incomplete] arithmetic.sum: non-concrete value int in operand to +: - // ./in.cue:53:9 - // ./in.cue:54:13 + // ./in.cue:52:3 + // ./in.cue:53:7 #a: (int){ int } #b: (int){ int } } diff --git a/cue/testdata/scalars/emptystruct.txtar b/cue/testdata/scalars/emptystruct.txtar index fda3eca8e..2a081e836 100644 --- a/cue/testdata/scalars/emptystruct.txtar +++ b/cue/testdata/scalars/emptystruct.txtar @@ -2,76 +2,75 @@ -- in.cue -- elipsis: { - test1: { - string - #foo: "bar" - } + test1: { + string + #foo: "bar" + } - #Def: { - ... - #foo: string - _ - } - check: test1 & #Def + #Def: { + ... + #foo: string + _ + } + check: test1 & #Def } bulk: { - test1: { - string - #foo: "bar" - } + test1: { + string + #foo: "bar" + } - #Def: { - [string]: int - #foo: string - _ - } - check: test1 & #Def + #Def: { + [string]: int + #foo: string + _ + } + check: test1 & #Def } optional: { - test1: { - string - #foo: "bar" - } + test1: { + string + #foo: "bar" + } - #Def: { - bar?: int - #foo: string - _ - } - check: test1 & #Def + #Def: { + bar?: int + #foo: string + _ + } + check: test1 & #Def } issue783: { - test1: { - string - #foo: "bar" - } - - test2: { - hello: "world" - #foo: "bar" - } + test1: { + string + #foo: "bar" + } + test2: { + hello: "world" + #foo: "bar" + } - #Def1: { - ... - #foo: string - } | { - string - #foo: string - } - check1a: test1 & #Def1 - check1b: test2 & #Def1 + #Def1: { + ... + #foo: string + } | { + string + #foo: string + } + check1a: test1 & #Def1 + check1b: test2 & #Def1 - #Def2: { - ... - #foo: string - _ - } - check2a: test1 & #Def2 - check2b: test2 & #Def2 + #Def2: { + ... + #foo: string + _ + } + check2a: test1 & #Def2 + check2b: test2 & #Def2 } -- out/eval -- (struct){ diff --git a/cue/testdata/scalars/yield.txtar b/cue/testdata/scalars/yield.txtar index 5f0e41ede..97afe4f03 100644 --- a/cue/testdata/scalars/yield.txtar +++ b/cue/testdata/scalars/yield.txtar @@ -1,31 +1,31 @@ // Issue #729 -- in.cue -- ifScalar: { - _#cond: true + _#cond: true - if _#cond {5} + if _#cond {5} } ifScalarConflict: { - _#cond: true + _#cond: true - if _#cond {5} + if _#cond {5} - "soo" + "soo" } ifScalarNested: { - _#cond: true + _#cond: true - if _#cond {{{5}}} + if _#cond {{{5}}} } -- out/eval -- Errors: ifScalarConflict: conflicting values "soo" and 5 (mismatched types string and int): - ./in.cue:10:5 - ./in.cue:10:16 - ./in.cue:12:5 + ./in.cue:10:2 + ./in.cue:10:13 + ./in.cue:12:2 Result: (_|_){ @@ -36,9 +36,9 @@ Result: } ifScalarConflict: (_|_){ // [eval] ifScalarConflict: conflicting values "soo" and 5 (mismatched types string and int): - // ./in.cue:10:5 - // ./in.cue:10:16 - // ./in.cue:12:5 + // ./in.cue:10:2 + // ./in.cue:10:13 + // ./in.cue:12:2 _#cond: (bool){ true } } ifScalarNested: (int){ @@ -72,4 +72,4 @@ Result: } } } -} \ No newline at end of file +} diff --git a/encoding/protobuf/jsonpb/testdata/decoder/base64.txtar b/encoding/protobuf/jsonpb/testdata/decoder/base64.txtar index 7476699d4..cd7f1259b 100644 --- a/encoding/protobuf/jsonpb/testdata/decoder/base64.txtar +++ b/encoding/protobuf/jsonpb/testdata/decoder/base64.txtar @@ -1,6 +1,5 @@ -- schema.cue -- b: [string]: bytes - -- std.cue -- b: hello: "SGVsbG8sIOS4lueVjA==" b: noPad: "SGVsbG8sIOS4lueVjA" @@ -8,16 +7,14 @@ b: bar: "c29tZSBkYXRhIHdpdGggACBhbmQg77u/" // A large one-line text. b: multi: """ - TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz - IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg - dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu - dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo - ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4= - """ - + TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz + IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg + dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu + dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo + ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4= + """ -- url.cue -- -b: bar: "c29tZSBkYXRhIHdpdGggACBhbmQg77u_" - +b: bar: "c29tZSBkYXRhIHdpdGggACBhbmQg77u_" -- out/jsonpb/std.cue -- b: hello: 'Hello, 世界' b: noPad: 'Hello, 世界' diff --git a/encoding/protobuf/jsonpb/testdata/decoder/basic.txtar b/encoding/protobuf/jsonpb/testdata/decoder/basic.txtar index cf8fa7f49..0830e38a2 100644 --- a/encoding/protobuf/jsonpb/testdata/decoder/basic.txtar +++ b/encoding/protobuf/jsonpb/testdata/decoder/basic.txtar @@ -2,21 +2,20 @@ a: int strings: { - c: string - d: "foo" | "bar" + c: string + d: "foo" | "bar" } lists: { - e: [...int] - f: [int, int] - g: [int, int, ...int] - h: [int, int] + e: [...int] + f: [int, int] + g: [int, int, ...int] + h: [int, int] } structs: [string]: { - a: int + a: int } - -- data.json -- { "a": "44", @@ -49,7 +48,7 @@ lists: { f: ["2"] g: ["3", "4", "5"] h: ["3", "4", "5"] // Last element should not be rewritten! -}, +} structs: { field: { a: "1" diff --git a/encoding/protobuf/jsonpb/testdata/decoder/enums.txtar b/encoding/protobuf/jsonpb/testdata/decoder/enums.txtar index deace5f46..78c1f8617 100644 --- a/encoding/protobuf/jsonpb/testdata/decoder/enums.txtar +++ b/encoding/protobuf/jsonpb/testdata/decoder/enums.txtar @@ -1,7 +1,7 @@ -- schema.cue -- enum: [string]: - { "foo", #enumValue: 1 } | - { "bar", #enumValue: 2 } + {"foo", #enumValue: 1} | + {"bar", #enumValue: 2} defEnum: [string]: #foo | #bar @@ -12,19 +12,16 @@ typeEnum: [string]: #Enum #Enum: #foo | #bar - // TODO: consider supporting @symbol(foo) or @json(,symbol=foo) // symbolEnum: [string]: // { 1, @symbol(foo) } | // { 2, @symbol(bar) } +singleEnum: {"single", #enumValue: 1} -singleEnum: { "single", #enumValue: 1 } - -badEnum: { string, #enumValue: 1 } | { "two", #enumValue: 2 } - +badEnum: {string, #enumValue: 1} | {"two", #enumValue: 2} -- data.cue -- -enum: asIs: "foo" +enum: asIs: "foo" enum: asIsUnknown: "foobar" // Convert integers to string @@ -46,7 +43,6 @@ typeEnum: baz: "baz" // unavailable // symbolEnum: baz: "baz" singleEnum: 1 - -- errors.cue -- enum: numNotExists: 3 @@ -55,7 +51,6 @@ enum: numNotExists: 4 enum: tooLarge: 4_111_222_333_444_555_666_777_888_999 badEnum: 1 - -- out/jsonpb/data.cue -- enum: asIs: "foo" enum: asIsUnknown: "foobar" @@ -87,5 +82,5 @@ enum.numNotExists: could not locate integer enum value 4: enum.tooLarge: invalid enum index: 4111222333444555666777888999: greater than max int64: errors.cue:5:17 badEnum: invalid string enum: non-concrete value string: - schema.cue:23:10 - schema.cue:23:12 + schema.cue:21:10 + schema.cue:21:11 diff --git a/encoding/protobuf/jsonpb/testdata/decoder/null.txtar b/encoding/protobuf/jsonpb/testdata/decoder/null.txtar index 89f1e6092..64a55376e 100644 --- a/encoding/protobuf/jsonpb/testdata/decoder/null.txtar +++ b/encoding/protobuf/jsonpb/testdata/decoder/null.txtar @@ -1,3 +1,5 @@ +# TODO(fmt): first line in data.cue indented when it should not be: cuelang.org/issue/722 + -- schema.cue -- a0: int a1: 1 | *2 @@ -18,7 +20,6 @@ a10: null a11: null a12: null - -- data.yaml -- # comment a0 a0: null @@ -54,7 +55,7 @@ a9: null a10: null -- data.cue -- -// comment a0 + // comment a0 a0: null // comment a1 @@ -86,7 +87,6 @@ a9: null // comment a10 a10: null - -- out/jsonpb/data.yaml -- // comment a0 a0: 0 diff --git a/encoding/protobuf/jsonpb/testdata/encoder/enums.txtar b/encoding/protobuf/jsonpb/testdata/encoder/enums.txtar index 427a3dd43..b0d446881 100644 --- a/encoding/protobuf/jsonpb/testdata/encoder/enums.txtar +++ b/encoding/protobuf/jsonpb/testdata/encoder/enums.txtar @@ -1,14 +1,20 @@ -- schema.cue -- -enum: [string]: - { "foo", #enumValue: 1 } | - { "bar", #enumValue: 2 } @protobuf(1,Enum) +enum: { + [string]: + {"foo", #enumValue: 1} | + {"bar", #enumValue: 2} @protobuf(1,Enum) +} -defEnum: [string]: #foo | #bar @protobuf(2,Enum) +defEnum: { + [string]: #foo | #bar @protobuf(2,Enum) +} #foo: 1 #bar: 2 -typeEnum: [string]: #Enum @protobuf(3,Enum) +typeEnum: { + [string]: #Enum @protobuf(3,Enum) +} #Enum: #foo | #bar @@ -17,16 +23,13 @@ typeEnum: [string]: #Enum @protobuf(3,Enum) // { 1, @symbol(foo) } | // { 2, @symbol(bar) } - singleEnum: #single @protobuf(3,Enum) #single: 1 -badEnum: { string, #enumValue: 1 } | { "two", #enumValue: 2 } - - +badEnum: {string, #enumValue: 1} | {"two", #enumValue: 2} -- value.cue -- -enum: asIs: "foo" +enum: asIs: "foo" enum: asIsUnknown: "foobar" // Convert integers to strings @@ -34,19 +37,16 @@ defEnum: foo: 1 defEnum: bar: 2 defEnum: baz: 3 - typeEnum: foo: 1 typeEnum: bar: 2 typeEnum: baz: 3 - // TODO: consider supporting @symbol(foo) or @json(,symbol=foo) // symbolEnum: foo: "foo" // symbolEnum: bar: "bar" // symbolEnum: baz: "baz" singleEnum: 1 - -- out/jsonpb -- enum: asIs: "foo" enum: asIsUnknown: "foobar" diff --git a/encoding/protobuf/jsonpb/testdata/encoder/list.txtar b/encoding/protobuf/jsonpb/testdata/encoder/list.txtar index 403fcd6fe..9f3f4add4 100644 --- a/encoding/protobuf/jsonpb/testdata/encoder/list.txtar +++ b/encoding/protobuf/jsonpb/testdata/encoder/list.txtar @@ -2,22 +2,20 @@ a: [...#D] #D: { - a: int @protobuf(1,int64) + a: int @protobuf(1,int64) } b: [1, ...] // Don't include schema fields if not in value c: [{a: 1}, ...] c: [...#D] - -- value.cue -- // Hello a: [ - {a: 1}, + {a: 1}, ] c: [{a: 1}, {a: 2}] - -- out/jsonpb -- // Hello a: [ diff --git a/encoding/protobuf/jsonpb/testdata/encoder/simple.txtar b/encoding/protobuf/jsonpb/testdata/encoder/simple.txtar index 6f608ae36..2899c70e0 100644 --- a/encoding/protobuf/jsonpb/testdata/encoder/simple.txtar +++ b/encoding/protobuf/jsonpb/testdata/encoder/simple.txtar @@ -1,6 +1,6 @@ -- value.cue -- -a: 1 @protobuf(1, int64) -b: 2 @protobuf(1, int32) +a: 1 @protobuf(1, int64) +b: 2 @protobuf(1, int32) c: 3.4 @protobuf(1, int64) d: "foo\u1234" @@ -11,7 +11,6 @@ f: false t: true notConcrete: string - -- out/jsonpb -- a: "1" @protobuf(1, int64) b: 2 @protobuf(1, int32) diff --git a/encoding/protobuf/jsonpb/testdata/encoder/struct.txtar b/encoding/protobuf/jsonpb/testdata/encoder/struct.txtar index 4aa6d4ba1..f0bb3d041 100644 --- a/encoding/protobuf/jsonpb/testdata/encoder/struct.txtar +++ b/encoding/protobuf/jsonpb/testdata/encoder/struct.txtar @@ -1,23 +1,21 @@ -- schema.cue -- a: { - {b: int @protobuf(1,int64)} + {b: int @protobuf(1,int64)} - c: int @protobuf(1,int64) + c: int @protobuf(1,int64) - {d: int @protobuf(1,int32)} - - e: int @protobuf(1,int32) + {d: int @protobuf(1,int32)} + e: int @protobuf(1,int32) } -- value.cue -- // Hello a: { - b: 1 - c: 2 - d: 3 - e: 4 + b: 1 + c: 2 + d: 3 + e: 4 } - -- out/jsonpb -- // Hello a: { diff --git a/encoding/protobuf/textproto/testdata/decoder/comments.txtar b/encoding/protobuf/textproto/testdata/decoder/comments.txtar index f4fbc7493..32b00f874 100644 --- a/encoding/protobuf/textproto/testdata/decoder/comments.txtar +++ b/encoding/protobuf/textproto/testdata/decoder/comments.txtar @@ -7,10 +7,9 @@ b: [...int] c: [...int32] m: [...#Msg] #Msg: { - x: string - y: string + x: string + y: string } - -- input.textproto -- # file comment diff --git a/encoding/protobuf/textproto/testdata/decoder/enums.txtar b/encoding/protobuf/textproto/testdata/decoder/enums.txtar index 032249b5d..9e58a647b 100644 --- a/encoding/protobuf/textproto/testdata/decoder/enums.txtar +++ b/encoding/protobuf/textproto/testdata/decoder/enums.txtar @@ -1,8 +1,8 @@ -- foo.cue -- #MyEnum: - #Val1 | - #Val2 | - #Val3 + #Val1 | + #Val2 | + #Val3 #Val1: 1 #Val2: 2 @@ -10,7 +10,6 @@ a0: #MyEnum a1: [...#MyEnum] - -- input.textproto -- a0: Val1 a1: Val1 diff --git a/encoding/protobuf/textproto/testdata/decoder/errors.txtar b/encoding/protobuf/textproto/testdata/decoder/errors.txtar index 3f173d40e..4bcbfc13c 100644 --- a/encoding/protobuf/textproto/testdata/decoder/errors.txtar +++ b/encoding/protobuf/textproto/testdata/decoder/errors.txtar @@ -2,7 +2,6 @@ # This is a protobuf bug. Can't do much about it. -- errors.cue -- a: int - -- input.textproto -- // Silent nights diff --git a/encoding/protobuf/textproto/testdata/decoder/list.txtar b/encoding/protobuf/textproto/testdata/decoder/list.txtar index 5a0969ffa..49dc23083 100644 --- a/encoding/protobuf/textproto/testdata/decoder/list.txtar +++ b/encoding/protobuf/textproto/testdata/decoder/list.txtar @@ -14,8 +14,6 @@ int3: [...int] string1: [...string] float1: [...number] - - -- input.textproto -- empty1: [] empty2: [ # foo diff --git a/encoding/protobuf/textproto/testdata/decoder/map.txtar b/encoding/protobuf/textproto/testdata/decoder/map.txtar index 0dbf2b50c..525e79d1f 100644 --- a/encoding/protobuf/textproto/testdata/decoder/map.txtar +++ b/encoding/protobuf/textproto/testdata/decoder/map.txtar @@ -1,11 +1,9 @@ -- map.cue -- map: {[string]: int} @protobuf(1,map[string]int) - implicit: [string]: string intMap: {[string]: int} @protobuf(1,map[int]int) - -- input.textproto -- map: { key: "foo" diff --git a/encoding/protobuf/textproto/testdata/decoder/scalar.txtar b/encoding/protobuf/textproto/testdata/decoder/scalar.txtar index e39c3f873..57e7c416e 100644 --- a/encoding/protobuf/textproto/testdata/decoder/scalar.txtar +++ b/encoding/protobuf/textproto/testdata/decoder/scalar.txtar @@ -4,8 +4,6 @@ nan: number t: bool f: bool - - -- input.textproto -- inf: inf nan: nan diff --git a/encoding/protobuf/textproto/testdata/decoder/simple.txtar b/encoding/protobuf/textproto/testdata/decoder/simple.txtar index fb4645e01..863e9d1da 100644 --- a/encoding/protobuf/textproto/testdata/decoder/simple.txtar +++ b/encoding/protobuf/textproto/testdata/decoder/simple.txtar @@ -2,21 +2,20 @@ -- foo.cue -- #MyEnum: "Default" | "Variant1" | "Variant100" -f1: string -f2: int64 -fa: [...uint64] -fb: [...int32] -fc: [...number] -pairs: [...#Pair] -bbbb: bytes // optional +f1: string +f2: int64 +fa: [...uint64] +fb: [...int32] +fc: [...number] +pairs: [...#Pair] +bbbb: bytes // optional // extensions 100 to max; #Pair: { - key: string - value: string + key: string + value: string } - -- input.textproto -- f1: "dsfadsafsaf" f2: 234 # value comment diff --git a/encoding/protobuf/textproto/testdata/encoder/enum.txtar b/encoding/protobuf/textproto/testdata/encoder/enum.txtar index a77c7d0db..f19d08ed3 100644 --- a/encoding/protobuf/textproto/testdata/encoder/enum.txtar +++ b/encoding/protobuf/textproto/testdata/encoder/enum.txtar @@ -1,15 +1,20 @@ -- schema.cue -- -enum: [string]: - { "foo", #enumValue: 1 } | - { "bar", #enumValue: 2 } @protobuf(1,Enum) +enum: { + [string]: + {"foo", #enumValue: 1} | + {"bar", #enumValue: 2} @protobuf(1,Enum) +} -defEnum: [string]: #FOO | #BAR @protobuf(2,Enum) +defEnum: { + [string]: #FOO | #BAR @protobuf(2,Enum) +} #FOO: 1 #BAR: 2 - -typeEnum: [string]: #Enum @protobuf(3,Enum) +typeEnum: { + [string]: #Enum @protobuf(3,Enum) +} #Enum: #FOO | #BAR | 3 @@ -18,14 +23,11 @@ typeEnum: [string]: #Enum @protobuf(3,Enum) // { 1, @symbol(foo) } | // { 2, @symbol(bar) } - singleEnum: #single @protobuf(3,Enum) #single: 1 -badEnum: { string, #enumValue: 1 } | { "two", #enumValue: 2 } - - +badEnum: {string, #enumValue: 1} | {"two", #enumValue: 2} -- value.cue -- enum: asIs: "foo" @@ -43,7 +45,6 @@ typeEnum: baz: 3 // symbolEnum: baz: "baz" singleEnum: 1 - -- out/jsonpb -- enum: asIs: "foo" enum: asIsUnknown: "foobar" diff --git a/encoding/protobuf/textproto/testdata/encoder/list.txtar b/encoding/protobuf/textproto/testdata/encoder/list.txtar index 9ad92137f..fea7c1ada 100644 --- a/encoding/protobuf/textproto/testdata/encoder/list.txtar +++ b/encoding/protobuf/textproto/testdata/encoder/list.txtar @@ -1,13 +1,13 @@ -- value.cue -- // List comment -intList: [ 1, 2, 3 ] +intList: [ 1, 2, 3] structList: [{ - foo: 1 - bar: 2 + foo: 1 + bar: 2 }, { - foo: 3 - bar: 4 + foo: 3 + bar: 4 }] -- out/encode -- # List comment diff --git a/encoding/protobuf/textproto/testdata/encoder/map.txtar b/encoding/protobuf/textproto/testdata/encoder/map.txtar index 793b1d046..fefef62ac 100644 --- a/encoding/protobuf/textproto/testdata/encoder/map.txtar +++ b/encoding/protobuf/textproto/testdata/encoder/map.txtar @@ -7,14 +7,13 @@ m: "1": "one" // Doc 1 intMap: _ @protobuf(1,map[int]string) // Doc 2 -intMap: { "1": "one" } +intMap: {"1": "one"} // Doc 3 (seems not to be supported by proto) intMap: "2": "two" intMap: { - // Doc inner (seems not to be supported by proto) - "3": "three" + // Doc inner (seems not to be supported by proto) + "3": "three" } - -- out/encode -- m: { key: "foo" diff --git a/encoding/protobuf/textproto/testdata/encoder/simple.txtar b/encoding/protobuf/textproto/testdata/encoder/simple.txtar index bccaa005e..df3fda0af 100644 --- a/encoding/protobuf/textproto/testdata/encoder/simple.txtar +++ b/encoding/protobuf/textproto/testdata/encoder/simple.txtar @@ -11,7 +11,6 @@ f: false t: true notConcrete: string - -- out/encode -- a: 1 b: 2 diff --git a/internal/core/dep/testdata/alias.txtar b/internal/core/dep/testdata/alias.txtar index be5f21d00..4af7c660c 100644 --- a/internal/core/dep/testdata/alias.txtar +++ b/internal/core/dep/testdata/alias.txtar @@ -1,5 +1,7 @@ +# TODO(fmt): line 1 let incorrectly indented: cuelang.org/issue/1544 + -- in.cue -- -let X = Y + let X = Y let Y = c + d a: b: X diff --git a/internal/core/dep/testdata/call.txtar b/internal/core/dep/testdata/call.txtar index 4082fbe3b..836330494 100644 --- a/internal/core/dep/testdata/call.txtar +++ b/internal/core/dep/testdata/call.txtar @@ -2,7 +2,7 @@ import "encoding/json" // The reference to string needs to be included even for Visit. -a: b: json.Marshal({ #a: str }) +a: b: json.Marshal({#a: str}) str: "x:y:z" -- out/dependencies/field -- diff --git a/internal/core/dep/testdata/composed.txtar b/internal/core/dep/testdata/composed.txtar index 78cfeaf55..929b5ceb4 100644 --- a/internal/core/dep/testdata/composed.txtar +++ b/internal/core/dep/testdata/composed.txtar @@ -1,11 +1,11 @@ -- in.cue -- t1: {$id: "foo"} & { - ref: t1.stdout - cmd: ["sh", "-c", "echo hello"] - stdout: string + ref: t1.stdout + cmd: ["sh", "-c", "echo hello"] + stdout: string } a: b: {$id: "foo"} & { - text: t1.stdout + text: t1.stdout } -- out/dependencies/field -- -- out/dependencies/all -- diff --git a/internal/core/dep/testdata/dynamic.txtar b/internal/core/dep/testdata/dynamic.txtar index 3c42ae7ce..f81782091 100644 --- a/internal/core/dep/testdata/dynamic.txtar +++ b/internal/core/dep/testdata/dynamic.txtar @@ -1,26 +1,26 @@ -- in.cue -- first: { - out: [1, 2] + out: [1, 2] } ignore: { - x: 1 - y: a.c + x: 1 + y: a.c } middle: { - for x in first.out { - ignore.y + for x in first.out { + ignore.y - "la\(x)": ignore & { - seq: x+1 - val: "foo\(x)" - out: ignore.x - } - } + "la\(x)": ignore & { + seq: x + 1 + val: "foo\(x)" + out: ignore.x + } + } } a: { - b: [ for x in middle { x } ] - c: {} + b: [ for x in middle {x}] + c: {} } -- out/dependencies/field -- middle diff --git a/internal/core/dep/testdata/field.txtar b/internal/core/dep/testdata/field.txtar index 42af8630f..41d3a4045 100644 --- a/internal/core/dep/testdata/field.txtar +++ b/internal/core/dep/testdata/field.txtar @@ -1,10 +1,10 @@ -- in.cue -- a: b: { - { [pattern]: c } - { "\(name)": c } - regular: c - optional?: c - ... + {[pattern]: c} + {"\(name)": c} + regular: c + optional?: c + ... } pattern: =~"^Foo" diff --git a/internal/core/dep/testdata/list.txtar b/internal/core/dep/testdata/list.txtar index 3ae09cecd..0d174bbe4 100644 --- a/internal/core/dep/testdata/list.txtar +++ b/internal/core/dep/testdata/list.txtar @@ -1,7 +1,7 @@ -- in.cue -- // Note: in dynamic mode, [d] does not get picked up // because the disjunction is not resolved. -a: b: [ d, ...e ] & [ 1, 2, ... ] +a: b: [ d, ...e] & [ 1, 2, ...] d: int e: int diff --git a/internal/core/dep/testdata/listcomprehension.txtar b/internal/core/dep/testdata/listcomprehension.txtar index b4908a407..cf6a48dac 100644 --- a/internal/core/dep/testdata/listcomprehension.txtar +++ b/internal/core/dep/testdata/listcomprehension.txtar @@ -1,5 +1,5 @@ -- in.cue -- -a: b: [ for x in c if x.a > 0 { x.a + d } ] +a: b: [ for x in c if x.a > 0 {x.a + d}] c: [{a: 1}, {a: 3}] d: 2 diff --git a/internal/core/dep/testdata/self.txtar b/internal/core/dep/testdata/self.txtar index c8c82140a..158ec5264 100644 --- a/internal/core/dep/testdata/self.txtar +++ b/internal/core/dep/testdata/self.txtar @@ -1,15 +1,15 @@ -- in.cue -- a: b: { - for x in b {} + for x in b {} - x: { - c: m - d: y - e: f - f: 1 - g: b.x - } - y: 3 + x: { + c: m + d: y + e: f + f: 1 + g: b.x + } + y: 3 } m: 3 diff --git a/internal/core/dep/testdata/selfref.txtar b/internal/core/dep/testdata/selfref.txtar index 63b7ddcc2..fafc2afd6 100644 --- a/internal/core/dep/testdata/selfref.txtar +++ b/internal/core/dep/testdata/selfref.txtar @@ -3,7 +3,7 @@ a: { command: alias: { // TODO: fix inner referene. - val: (instance & { enabled: true }).value + val: (instance & {enabled: true}).value echo: cmd: val } @@ -18,7 +18,7 @@ a: { } } - instance: #combined & { enabled: true } + instance: #combined & {enabled: true} } -- out/dependencies/field -- -- out/dependencies/all -- diff --git a/internal/core/dep/testdata/structcomprehension.txtar b/internal/core/dep/testdata/structcomprehension.txtar index 594866c7c..5553a840c 100644 --- a/internal/core/dep/testdata/structcomprehension.txtar +++ b/internal/core/dep/testdata/structcomprehension.txtar @@ -1,10 +1,10 @@ -- in.cue -- a: b: { - for i, x in c - let y = x - if y > 0 { - "\(e)\(i)": x + d - } + for i, x in c + let y = x + if y > 0 { + "\(e)\(i)": x + d + } } c: [1, 2] diff --git a/internal/core/export/testdata/adt.txtar b/internal/core/export/testdata/adt.txtar index a53bddd1f..e46831e05 100644 --- a/internal/core/export/testdata/adt.txtar +++ b/internal/core/export/testdata/adt.txtar @@ -9,8 +9,8 @@ d1: "foo\(bar)": int bar: "bar" d2: C="foo\(bar)": { - name: "xx" - foo: C.name + name: "xx" + foo: C.name } bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)' @@ -34,13 +34,13 @@ l5: [1, 3] & { } #foo: int -l6: [1, #foo] & { +l6: [1, #foo] & { [1, 3] #foo: int } -n1: 1.0 +n1: 1.0 n10: 10 // Ignored comment. @@ -50,51 +50,52 @@ t: true // Dangling comment. -e1: n1 & n1 & \w)(?P\w)"#, "afloat afoot from") -t9: regexp.FindAllNamedSubmatch(#"f(?P\w)(?P\w)"#, "afloat afoot from", -1) +t1: regexp.Find(#"f\w\w"#, "afoot") +t2: regexp.Find(#"f\w\w"#, "bar") +t3: regexp.FindAll(#"f\w\w"#, "afoot afloat from", 2) +t4: regexp.FindAll(#"f\w\w"#, "bla bla", -1) +t5: regexp.FindSubmatch(#"f(\w)(\w)"#, "afloat afoot from") +t6: regexp.FindAllSubmatch(#"f(\w)(\w)"#, "afloat afoot from", -1) +t7: regexp.FindAllSubmatch(#"f(\w)(\w)"#, "aglom", -1) +t8: regexp.FindNamedSubmatch(#"f(?P\w)(?P\w)"#, "afloat afoot from") +t9: regexp.FindAllNamedSubmatch(#"f(?P\w)(?P\w)"#, "afloat afoot from", -1) t10: regexp.FindAllNamedSubmatch(#"f(?Poptional)?"#, "fbla", -1) t11: regexp.FindAllNamedSubmatch(#"f(?P\w)(?P\w)"#, "aglom", -1) t12: regexp.Valid & "valid" @@ -29,11 +29,11 @@ t13: invalid value "invalid)" (does not satisfy regexp.Valid): error in call to ./in.cue:15:6 ./in.cue:15:21 error in call to regexp.Find: no match: - ./in.cue:4:5 + ./in.cue:4:6 error in call to regexp.FindAll: no match: - ./in.cue:6:5 + ./in.cue:6:6 error in call to regexp.FindAllSubmatch: no match: - ./in.cue:9:5 + ./in.cue:9:6 error in call to regexp.FindAllNamedSubmatch: no match: ./in.cue:13:6 diff --git a/pkg/strings/testdata/gen.txtar b/pkg/strings/testdata/gen.txtar index 1609559da..4c1fe3286 100644 --- a/pkg/strings/testdata/gen.txtar +++ b/pkg/strings/testdata/gen.txtar @@ -3,15 +3,15 @@ -- in.cue -- import "strings" -t1: strings.Join(["Hello", "World!"], " ") -t2: strings.Join([1, 2], " ") -t3: strings.ByteAt("a", 0) -t4: strings.ByteSlice("Hello", 2, 5) -t5: strings.SliceRunes("✓ Hello", 0, 3) -t6: strings.Runes("Café") -t7: strings.ToCamel("AlphaBeta") -t8: strings.ToTitle("alpha") -t9: strings.MaxRunes(3) & "foo" +t1: strings.Join(["Hello", "World!"], " ") +t2: strings.Join([1, 2], " ") +t3: strings.ByteAt("a", 0) +t4: strings.ByteSlice("Hello", 2, 5) +t5: strings.SliceRunes("✓ Hello", 0, 3) +t6: strings.Runes("Café") +t7: strings.ToCamel("AlphaBeta") +t8: strings.ToTitle("alpha") +t9: strings.MaxRunes(3) & "foo" t10: strings.MaxRunes(3) & "quux" t11: strings.MinRunes(1) & "e" t12: strings.MaxRunes(0) & "e" @@ -23,8 +23,8 @@ t17: strings.MinRunes(10) & "hello" -- out/strings -- Errors: t2: invalid list element 0 in argument 0 to call: cannot use value 1 (int) as string: - ./in.cue:4:5 - ./in.cue:4:19 + ./in.cue:4:6 + ./in.cue:4:20 t10: invalid value "quux" (does not satisfy strings.MaxRunes(3)): ./in.cue:12:6 ./in.cue:12:23 diff --git a/pkg/text/tabwriter/testdata/gen.txtar b/pkg/text/tabwriter/testdata/gen.txtar index 1b4709b07..1a52a6382 100644 --- a/pkg/text/tabwriter/testdata/gen.txtar +++ b/pkg/text/tabwriter/testdata/gen.txtar @@ -4,12 +4,12 @@ import "text/tabwriter" t1: tabwriter.Write(""" - a\tb\tc - aaa\tbb\tvv - """) + a\tb\tc + aaa\tbb\tvv + """) t2: tabwriter.Write([ - "a\tb\tc", - "aaa\tbb\tvv"]) + "a\tb\tc", + "aaa\tbb\tvv"]) -- out/tabwriter -- t1: """ a b c diff --git a/pkg/time/testdata/duration.txtar b/pkg/time/testdata/duration.txtar index a95fe3ad4..a5544e1e0 100644 --- a/pkg/time/testdata/duration.txtar +++ b/pkg/time/testdata/duration.txtar @@ -17,16 +17,15 @@ import "time" FormatDuration: [...{ - arg: int - out: time.FormatDuration(arg) + arg: int + out: time.FormatDuration(arg) }] FormatDuration: [ - {arg: 10920000000000}, - {arg: 5000000000}, - {arg: 600000000}, + {arg: 10920000000000}, + {arg: 5000000000}, + {arg: 600000000}, ] - -- out/time -- FormatDuration: [{ arg: 10920000000000 diff --git a/pkg/time/testdata/gen.txtar b/pkg/time/testdata/gen.txtar index f579595cb..1917686a2 100644 --- a/pkg/time/testdata/gen.txtar +++ b/pkg/time/testdata/gen.txtar @@ -18,7 +18,7 @@ parse: { t2: time.Parse(time.RFC3339Date, "2021-02-19") _layout: "01/02 03:04:05PM '06 -0700" - t3: time.Parse(_layout, _layout) + t3: time.Parse(_layout, _layout) } split: { diff --git a/pkg/uuid/testdata/uuid.txtar b/pkg/uuid/testdata/uuid.txtar index 1f269d4a2..4a2aea5a5 100644 --- a/pkg/uuid/testdata/uuid.txtar +++ b/pkg/uuid/testdata/uuid.txtar @@ -6,16 +6,16 @@ sha1: a: uuid.SHA1(uuid.ns.DNS, "cuelang.org") md5: a: uuid.MD5(uuid.ns.URL, "https://cuelang.org") valid: { - a: uuid.Valid - a: "052ef62d-7223-58b6-a551-c1deee46d401" + a: uuid.Valid + a: "052ef62d-7223-58b6-a551-c1deee46d401" } invalid: { - a: uuid.Valid - a: "052EF62D-7223-58B6-A551-C1DEEE46D401" + a: uuid.Valid + a: "052EF62D-7223-58B6-A551-C1DEEE46D401" - b: uuid.Valid - b: "052ef62d_7223_58b6_a551_c1deee46d401" + b: uuid.Valid + b: "052ef62d_7223_58b6_a551_c1deee46d401" } parse: a: uuid.Parse("052ef62d722358b6a551c1deee46d401") @@ -24,17 +24,16 @@ fromInt: a: uuid.FromInt(0x052ef62d_7223_58b6_a551_c1deee46d401) variant: a: uuid.Variant(sha1.a) version: a: uuid.Version(sha1.a) -urn: a: uuid.URN(sha1.a) -toInt: a: uuid.ToInt(sha1.a) - +urn: a: uuid.URN(sha1.a) +toInt: a: uuid.ToInt(sha1.a) -- out/uuid -- Errors: invalid.a: invalid value "052EF62D-7223-58B6-A551-C1DEEE46D401" (does not satisfy uuid.Valid): invalid UUID "052EF62D-7223-58B6-A551-C1DEEE46D401": - ./in.cue:13:8 - ./in.cue:14:8 + ./in.cue:13:5 + ./in.cue:14:5 invalid.b: invalid value "052ef62d_7223_58b6_a551_c1deee46d401" (does not satisfy uuid.Valid): invalid UUID "052ef62d_7223_58b6_a551_c1deee46d401": - ./in.cue:16:8 - ./in.cue:17:8 + ./in.cue:16:5 + ./in.cue:17:5 Result: sha1: { diff --git a/tools/flow/testdata/concrete.txtar b/tools/flow/testdata/concrete.txtar index e995fd426..827a6faf9 100644 --- a/tools/flow/testdata/concrete.txtar +++ b/tools/flow/testdata/concrete.txtar @@ -1,18 +1,18 @@ #IgnoreConcrete: true -- in.cue -- root: { - t1: { - $id: "sequenced" - seq: 1 - text: t2.value - value: "v" - } - t2: { - $id: "sequenced" - seq: 2 - text: t1.value - value: "v" - } + t1: { + $id: "sequenced" + seq: 1 + text: t2.value + value: "v" + } + t2: { + $id: "sequenced" + seq: 2 + text: t1.value + value: "v" + } } -- out/run/errors -- -- out/run/t0 -- diff --git a/tools/flow/testdata/cycle.txtar b/tools/flow/testdata/cycle.txtar index b3d27299e..9b99755a0 100644 --- a/tools/flow/testdata/cycle.txtar +++ b/tools/flow/testdata/cycle.txtar @@ -1,18 +1,18 @@ -- in.cue -- root: { - a: { - $id: "valToOut" - $after: c.$id - } - b: { - $id: "valToOut" - $after: a.$id - out: "foo" - } - c: { - $id: "valToOut" - in: b.out - } + a: { + $id: "valToOut" + $after: c.$id + } + b: { + $id: "valToOut" + $after: a.$id + out: "foo" + } + c: { + $id: "valToOut" + in: b.out + } } -- out/run/errors -- error: cyclic task dependency: @@ -20,9 +20,9 @@ error: cyclic task dependency: task root.c refers to task root.b refers to task root.a: - ./testdata/in.cue:2:5 - ./testdata/in.cue:6:5 - ./testdata/in.cue:11:5 + ./testdata/in.cue:2:2 + ./testdata/in.cue:6:2 + ./testdata/in.cue:11:2 -- out/run/t0 -- graph TD t0("root.a [Waiting]") diff --git a/tools/flow/testdata/dep.txtar b/tools/flow/testdata/dep.txtar index 51059c5a9..597da2aba 100644 --- a/tools/flow/testdata/dep.txtar +++ b/tools/flow/testdata/dep.txtar @@ -12,15 +12,15 @@ indirectTaskRoot: root.indirectTaskValueReference root: { a: { - b: 3 - } + b: 3 + } concreteValueInGeneratedSubfield: { x: { // reference in value of comprehension. - // Even though the referenced value is concrete, we still consider - // this to be a dependency. - for x in [1] { foo: a.b } + // Even though the referenced value is concrete, we still consider + // this to be a dependency. + for x in [1] {foo: a.b} } index: int } @@ -31,7 +31,7 @@ root: { taskRootReference: { $after: indexReference - x: 3 + x: 3 } indirectTaskValueReference: { @@ -45,15 +45,15 @@ root: { } incompleteComprehensionSource: { - x: { for x in indirectTaskRootReference.incomplete {} } + x: {for x in indirectTaskRootReference.incomplete {}} } incompleteList: { - x: [ for x in [1] { incompleteComprehensionSource.x } ] + x: [ for x in [1] {incompleteComprehensionSource.x}] } incompleteGeneratedStruct: { - x: { for x in [1] { foo: incompleteList.x } } + x: {for x in [1] {foo: incompleteList.x}} } } -- out/run/errors -- diff --git a/tools/flow/testdata/dynamic.txtar b/tools/flow/testdata/dynamic.txtar index 51f369bde..9d44d7bae 100644 --- a/tools/flow/testdata/dynamic.txtar +++ b/tools/flow/testdata/dynamic.txtar @@ -1,32 +1,32 @@ -- in.cue -- root: { - a: { - $id: "list" - out: [...int] - } - middle: { - for x in a.out if x > 1 { - "la\(x)": { - $id: "sequenced" - seq: x - val: "foo\(x)" - } - } - } - // Run this after all generated tasks (so far) - b: { - $id: "list" - $after: [ for x in middle { x } ] - out: [...int] - } - after: { - for x in b.out if x > 1 { - "lb\(x)": { - $id: "valToOut" - val: "foo\(x)" - } - } - } + a: { + $id: "list" + out: [...int] + } + middle: { + for x in a.out if x > 1 { + "la\(x)": { + $id: "sequenced" + seq: x + val: "foo\(x)" + } + } + } + // Run this after all generated tasks (so far) + b: { + $id: "list" + $after: [ for x in middle {x}] + out: [...int] + } + after: { + for x in b.out if x > 1 { + "lb\(x)": { + $id: "valToOut" + val: "foo\(x)" + } + } + } } -- out/run/errors -- -- out/run/t0 -- diff --git a/tools/flow/testdata/failure.txtar b/tools/flow/testdata/failure.txtar index 75187981d..019ad7c4f 100644 --- a/tools/flow/testdata/failure.txtar +++ b/tools/flow/testdata/failure.txtar @@ -1,16 +1,16 @@ -- in.cue -- root: { - a: { - $id: "failure" - val: "foo" - out: string - } - b: { - $id: "valToOut" - $after: a - val: "bar" - out: string - } + a: { + $id: "failure" + val: "foo" + out: string + } + b: { + $id: "valToOut" + $after: a + val: "bar" + out: string + } } -- out/run/errors -- error: task failed: failure diff --git a/tools/flow/testdata/hidden.txtar b/tools/flow/testdata/hidden.txtar index 3e90d737d..4dad6f872 100644 --- a/tools/flow/testdata/hidden.txtar +++ b/tools/flow/testdata/hidden.txtar @@ -1,30 +1,30 @@ #FindHiddenTasks: true -- in.cue -- root: { - a: { - $id: "valToOut" - val: "foo" - out: string - } - _b: { - $id: "valToOut" - $after: a - val: "bar" - out: string - } - c: { - $id: "valToOut" - out: a.out + _b.out - } - // These tasks should _not_ run, because they are definitions. - _#c: { - $id: "valToOut" - out: c.out + "baz" - } - #d: { - $id: "valToOut" - out: c.out + "baz" - } + a: { + $id: "valToOut" + val: "foo" + out: string + } + _b: { + $id: "valToOut" + $after: a + val: "bar" + out: string + } + c: { + $id: "valToOut" + out: a.out + _b.out + } + // These tasks should _not_ run, because they are definitions. + _#c: { + $id: "valToOut" + out: c.out + "baz" + } + #d: { + $id: "valToOut" + out: c.out + "baz" + } } -- out/run/errors -- -- out/run/t0 -- diff --git a/tools/flow/testdata/infer.txtar b/tools/flow/testdata/infer.txtar index c598b3ab8..5b642e153 100644 --- a/tools/flow/testdata/infer.txtar +++ b/tools/flow/testdata/infer.txtar @@ -1,22 +1,22 @@ #InferTasks: true -- in.cue -- top0: { - $id: "valToOut" + $id: "valToOut" } top1: { - $id: "valToOut" - $after: top0 + $id: "valToOut" + $after: top0 } top3: { - $id: string // not a task + $id: string // not a task } root: { - t1: { - $id: "valToOut" - $after: [top1, top3] - } + t1: { + $id: "valToOut" + $after: [top1, top3] + } } -- out/run/errors -- -- out/run/t0 -- diff --git a/tools/flow/testdata/par.txtar b/tools/flow/testdata/par.txtar index ee704859d..d16b3f6b6 100644 --- a/tools/flow/testdata/par.txtar +++ b/tools/flow/testdata/par.txtar @@ -1,27 +1,27 @@ -- in.cue -- root: { - a: { - $id: "sequenced" - seq: 2 // terminate at t2 - val: "foo" - out: string - } - b: { - $id: "sequenced" - seq: 3 // terminate at t3 - val: "bar" - out: string - } - c: { - $id: "sequenced" - seq: 1 // terminate at t1 - val: "baz" - out: string - } - d: { - $id: "valToOut" - out: a.out + b.out + c.out - } + a: { + $id: "sequenced" + seq: 2 // terminate at t2 + val: "foo" + out: string + } + b: { + $id: "sequenced" + seq: 3 // terminate at t3 + val: "bar" + out: string + } + c: { + $id: "sequenced" + seq: 1 // terminate at t1 + val: "baz" + out: string + } + d: { + $id: "valToOut" + out: a.out + b.out + c.out + } } -- out/run/errors -- -- out/run/t0 -- diff --git a/tools/flow/testdata/pkg.txtar b/tools/flow/testdata/pkg.txtar index d78780b8f..69205c48e 100644 --- a/tools/flow/testdata/pkg.txtar +++ b/tools/flow/testdata/pkg.txtar @@ -8,21 +8,21 @@ User: "sub" import "example.org/test/sub" root: { - a: { - $id: "valToOut" - val: "foo \(sub.User)" - out: string - } - b: { - $id: "valToOut" - $after: a - val: "bar" - out: string - } - c: { - $id: "valToOut" - out: a.out + b.out - } + a: { + $id: "valToOut" + val: "foo \(sub.User)" + out: string + } + b: { + $id: "valToOut" + $after: a + val: "bar" + out: string + } + c: { + $id: "valToOut" + out: a.out + b.out + } } -- out/run/errors -- -- out/run/t0 -- diff --git a/tools/flow/testdata/simple.txtar b/tools/flow/testdata/simple.txtar index c6a8b0390..5d07125a6 100644 --- a/tools/flow/testdata/simple.txtar +++ b/tools/flow/testdata/simple.txtar @@ -1,20 +1,20 @@ -- in.cue -- root: { - a: { - $id: "valToOut" - val: "foo" - out: string - } - b: { - $id: "valToOut" - $after: a - val: "bar" - out: string - } - c: { - $id: "valToOut" - out: a.out + b.out - } + a: { + $id: "valToOut" + val: "foo" + out: string + } + b: { + $id: "valToOut" + $after: a + val: "bar" + out: string + } + c: { + $id: "valToOut" + out: a.out + b.out + } } -- out/run/errors -- -- out/run/t0 -- diff --git a/tools/flow/testdata/template.txtar b/tools/flow/testdata/template.txtar index 66e1c0bd8..a6090e164 100644 --- a/tools/flow/testdata/template.txtar +++ b/tools/flow/testdata/template.txtar @@ -5,7 +5,7 @@ import "tool/exec" foo: { $id: "tool/http.Do" - method: "GET" + method: "GET" url: string request: body: *bytes | string diff --git a/tools/trim/testdata/comprehensions.txtar b/tools/trim/testdata/comprehensions.txtar index 98a0419eb..1bceb3f13 100644 --- a/tools/trim/testdata/comprehensions.txtar +++ b/tools/trim/testdata/comprehensions.txtar @@ -1,7 +1,9 @@ +# TODO(fmt): comprehension incorrectly indented: cuelang.org/issue/1544 + #Issue: 1299 -- in.cue -- -if true { + if true { a_map: { "first": {} } @@ -9,8 +11,8 @@ if true { a_map: { if true { - // keep. TODO: allow this to be removed if the dominator includes all - // fields unconditionally. + // keep. TODO: allow this to be removed if the dominator includes all + // fields unconditionally. "second": true } } diff --git a/tools/trim/testdata/constraintroots.txtar b/tools/trim/testdata/constraintroots.txtar index 7f47d4b75..cb0fb7ddc 100644 --- a/tools/trim/testdata/constraintroots.txtar +++ b/tools/trim/testdata/constraintroots.txtar @@ -1,3 +1,5 @@ +# TODO(fmt): tabs incorrectly converted to spaces within comments: cuelang.org/issue/1040 + // Issue #716 -- in.cue -- keepPatternConstraintRoot: { @@ -12,13 +14,13 @@ keepPatternConstraintRoot: { // TODO(additional): add once implemented // keepAdditionalRoots: { -// if true { -// deployment: "name": {spec: [1]} -// } +// if true { +// deployment: "name": {spec: [1]} +// } // -// deployment: name: spec: [1] +// deployment: name: spec: [1] // -// deployment: [string]: spec: [1] +// deployment: [string]: spec: [1] // } keepPatternConstraintRootSolo: { @@ -52,8 +54,6 @@ keepPatternConstraintRootDef: { deployment: [string]: spec: [] } - - -- out/trim -- == in.cue keepPatternConstraintRoot: { diff --git a/tools/trim/testdata/defaults.txtar b/tools/trim/testdata/defaults.txtar index 26af8f507..22fec7cef 100644 --- a/tools/trim/testdata/defaults.txtar +++ b/tools/trim/testdata/defaults.txtar @@ -1,56 +1,55 @@ -- in.cue -- domToSub: { - foo: [string]: a: *1 | int - foo: b: a: 1 + foo: [string]: a: *1 | int + foo: b: a: 1 } // Issue #759 subToDom: { - #maybeString: {ip?: string} - something: ip: *"default" | string - something: #maybeString + #maybeString: {ip?: string} + something: ip: *"default" | string + something: #maybeString } // references to definitions of a disjunction should be resolved and counted // as dominator nodes. resolveDefaults: { - #monitor: { - kind: "a" - } | { - kind: "b" - } + #monitor: { + kind: "a" + } | { + kind: "b" + } - monitor: #monitor + monitor: #monitor - monitor: kind: "a" + monitor: kind: "a" } issue781: { - #monitor_check: { - check_name: string - check_interval?: string - } - - #monitor_check: { - check_type: "nginx_config" - } | { - check_type: "docker_running" - vars: { - container_name: string - } - } - - - monitor: { - checks: [...#monitor_check] - } - - monitor: { - checks: [{ - check_type: "nginx_config" - check_name: "nginx_config" - }] - } + #monitor_check: { + check_name: string + check_interval?: string + } + + #monitor_check: { + check_type: "nginx_config" + } | { + check_type: "docker_running" + vars: { + container_name: string + } + } + + monitor: { + checks: [...#monitor_check] + } + + monitor: { + checks: [{ + check_type: "nginx_config" + check_name: "nginx_config" + }] + } } // Issue #801 @@ -59,12 +58,12 @@ issue781: { // to be erased, as the exact match is only there because subordinate value // was first used to select the default. dontEraseDefaultSelection: { - rule: _#Rule & { - verbs: [ "c" ] - } - _#Rule: { - verbs: *["a", "b"] | ["c"] - } + rule: _#Rule & { + verbs: [ "c"] + } + _#Rule: { + verbs: *["a", "b"] | ["c"] + } } -- out/trim -- == in.cue diff --git a/tools/trim/testdata/empty.txtar b/tools/trim/testdata/empty.txtar index e94089669..6a23627c1 100644 --- a/tools/trim/testdata/empty.txtar +++ b/tools/trim/testdata/empty.txtar @@ -5,11 +5,11 @@ deployment: [ID=string]: { } deployment: alertmanager: { - empty: {} - volumes: [{ - name: "alertmanager" - emptyDir: {} - }] + empty: {} + volumes: [{ + name: "alertmanager" + emptyDir: {} + }] } -- out/trim -- == in.cue diff --git a/tools/trim/testdata/issue1087.txtar b/tools/trim/testdata/issue1087.txtar index d33bc0056..0428dba79 100644 --- a/tools/trim/testdata/issue1087.txtar +++ b/tools/trim/testdata/issue1087.txtar @@ -5,7 +5,7 @@ configs: { } shared: { - param: string + param: string derived: configs[param] } diff --git a/tools/trim/testdata/kube1.txtar b/tools/trim/testdata/kube1.txtar index 9e3955ce5..1f028fdb2 100644 --- a/tools/trim/testdata/kube1.txtar +++ b/tools/trim/testdata/kube1.txtar @@ -1,32 +1,31 @@ -- in.cue -- service: [ID=string]: { - ports: [...{ - protocol: *"TCP" | "UDP" - extra: 3 - }] + ports: [...{ + protocol: *"TCP" | "UDP" + extra: 3 + }] } service: a: { - ports: [{ - name: "a" - protocol: "TCP" - key: "bar" - }] + ports: [{ + name: "a" + protocol: "TCP" + key: "bar" + }] } service: a: { - ports: [{ - protocol: "TCP" - key: "bar" - }] + ports: [{ + protocol: "TCP" + key: "bar" + }] } service: a: { - ports: [{ - extra: 3 - }] + ports: [{ + extra: 3 + }] } - -- out/trim -- == in.cue service: [ID=string]: { diff --git a/tools/trim/testdata/optional.txtar b/tools/trim/testdata/optional.txtar index 160b9ae7a..f7ca0513e 100644 --- a/tools/trim/testdata/optional.txtar +++ b/tools/trim/testdata/optional.txtar @@ -17,9 +17,8 @@ a: [{ #A: annotations?: [string]: string b: #B -b: bb: c: 2 // c can be removed, bb not. +b: bb: c: 2 // c can be removed, bb not. #B: bb?: c: 2 - -- out/trim -- == a.cue package pkg diff --git a/tools/trim/testdata/rmimport.txtar b/tools/trim/testdata/rmimport.txtar index f48431f8d..220db840e 100644 --- a/tools/trim/testdata/rmimport.txtar +++ b/tools/trim/testdata/rmimport.txtar @@ -15,14 +15,13 @@ import ( ) #Def: { - y: 5 + y: 5 } x: #Def x: y: a.A -- cue.mod/module.cue -- module: "example.com/blah" - -- out/trim -- == b.cue package b diff --git a/tools/trim/testdata/shared.txtar b/tools/trim/testdata/shared.txtar index 1aef0f149..d286ff779 100644 --- a/tools/trim/testdata/shared.txtar +++ b/tools/trim/testdata/shared.txtar @@ -5,38 +5,36 @@ import "strings" // TODO: this would be okay to normalize. Consider whether // this makes sense, though. a: { - service: [ID=_]: name: "a" + service: [ID=_]: name: "a" - service: foo: shared - service: bar: shared + service: foo: shared + service: bar: shared - shared: name: "a" + shared: name: "a" } issue760: { - service: [ID=_]: { - name: ID - } - service: foo: _shared - service: bar: _shared - _shared: { - name: "foo" // Do not remove! - } + service: [ID=_]: { + name: ID + } + service: foo: _shared + service: bar: _shared + _shared: { + name: "foo" // Do not remove! + } } - issue760: { - service: [ID=_]: { - _service_name: *strings.TrimSuffix(ID, "-suffix") | string - } - service: "a-suffix": _shared - service: "b-suffix": _shared - _shared: { - _service_name: "a" // Do not remove! - } + service: [ID=_]: { + _service_name: *strings.TrimSuffix(ID, "-suffix") | string + } + service: "a-suffix": _shared + service: "b-suffix": _shared + _shared: { + _service_name: "a" // Do not remove! + } } - -- out/trim -- == in.cue import "strings"