// Ensure that disjunction elimination is not done prematurely. // Issue #651 -- in.cue -- import "struct" // Closedness checks should not be triggered too early, or with an improper // subset of StructInfos. Blindly finalizing partial disjuncts will end up // doing a closedness check with not all embeddings present, which can lead to // a field being rejected prematurely. // // It should be recursively disabled. disambiguateClosed: { 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" } alwaysCheckPatterns2: { a: #X a: b b: #X b: c: "yyyyy" #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 } nestedNonMonotonic: resolved: n2: { 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 } nestedNonMonotonic: eliminated: n1: p2: { 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 } nestedNonMonotonic: eliminated: n2: p1: { 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 } nestedNonMonotonic: eliminated: n2: p2: { x: {a: b: c: 1} | null x: {a: b: d: 1} | null x: {a: b: struct.MaxFields(1)} | null } // TODO: should be incomplete. nestedNonMonotonic: incomplete: a: n1: p1: { x: {a: struct.MinFields(2)} | null x: {a: c: 1} | null } // TODO: should be incomplete. 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: 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 } nestedNonMonotonic: incomplete: b: n1: p2: { 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 } nestedNonMonotonic: incomplete: b: n2: p1: { 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 } nestedNonMonotonic: incomplete: b: n2: p1: { 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} } } preserveClosedness: small: p2: { #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} } } preserveClosedness: medium: p2: { #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} } } // If an error occurred in the last disjunction, it may sometimes be propagated // to parent nodes. This, in turn, could lead to references to such field // to fail with that error. noChildError: _ noChildError: issue1608: { myValue: #type & {fieldName: "some string"} #type: fieldName: #subtype #subtype: string | {foo: string} | {bar: #subtype} } noChildError: t1: { #D: {b: string} | {c: #D } o: #D & {b: "test"} } noChildError: t2: { o: #D & {b: "test"} #D: {b: string} | {c: #D } } noChildError: t3: { #D: {a: null} | {b: string} | {c: #D } o: #D & {b: "test"} } noChildError: t4: { o: #D & {b: "test"} #D: {a: null} | {b: string} | {c: #D } } issue1924: t1: { m: a: 2 x: *[m.b] | 2 } issue1924: t2: { m: a: 2 x: *{v: m.b} | 3 } issue1924: t3: { m: a: 2 x: *m.b | 1 } // should eliminate erroneous comprehension and pass issue1838: t1: { p?: [] a: [for k in p {k}] | null } issue1838: t2: { p?: [] a: null | [for k in p {k}] } noHang: { // This should terminate. #T: ["a", #T] | ["d", ...#T] x: #T #X: x #X: #T } issue1940: { #T: ["a", #T] | ["b", #T] | ["c", #T] | ["d", [...#T]] #A: type: #T #B: [string]: #A #C: #B & { x: #A } } -- issue2209full.cue -- // TODO: fix issue2209: simplified: t1: { #SpecFoo: foo: min: 1 #SpecBar: bar: min: 1 spec: bar: {} spec: #SpecFoo | #SpecBar out: { {nullFoo: null} | {nullBar: null} {minFoo: int} | {minBar: int} if X.bar != _|_ { minBar: X.bar.min } X: spec } } issue2209: simplified: t2: { #SpecFoo: foo: {} #SpecBar: bar: x: 1 spec: bar: {} spec: *#SpecFoo | #SpecBar if spec.bar != _|_ { BAZ: spec.bar.x } {f1: int} | {b2: int} {f2: int} | {b2: int} } // This test fails for 0.4 and 0.5. issue2209: simplified: t3: { #A: v: 1 {f1: int} | {b2: int} {f2: int} | {b2: int} BAZ: S.y S: *#A | #B #B: {x: 1, y: 1} S: x: 1 } issue2209: full: { Foo: #Abstract & {spec: foo: {}} Bar: #Abstract & {spec: bar: {}} #Abstract: X={ spec: _#Spec resource: _Thing & {_X: spec: X.spec} } _#Spec: *_#SpecFoo | _#SpecBar _#SpecFoo: { foo: { min: int | *10 max: int | *20 } } _#SpecBar: { bar: { min: int | *30 max: int | *40 } } _Thing: #Constrained & { _X: _ spec: { if _X.spec.foo != _|_ { minFoo: _X.spec.foo.min maxFoo: _X.spec.foo.max } if _X.spec.bar != _|_ { minBar: _X.spec.bar.min maxBar: _X.spec.bar.max } } } #Constrained: #Base & { spec: { minFoo: int | *10 maxFoo: int | *20 minBar?: null maxBar?: null } | { minBar: int | *30 maxBar: int | *40 minFoo?: null maxFoo?: null } spec: *{ fuga?: null } | { hoge?: null } } #Base: { spec: { minFoo?: null | int maxFoo?: null | int minBar?: null | int maxBar?: null | int hoge?: null | bool fuga?: null | bool } } } -- issue2246.cue -- issue2246: simplified: { #FormFoo: fooID: string #FormBar: barID: string #Form: { #FormFoo | #FormBar } data: {fooID: "123"} out1: #Form & data out2: #Form & out1 } issue2246: full: { data: forms: [{ fooID: "00-0000001" }] form1040: (#compute & {in: data}).out #K1: { #_base: common: 3 #FormFoo: { #_base fooID: string } #FormBar: { #_base barID: string } #Form: { #FormFoo | #FormBar } } #Input: { forms: [...#K1.#Form] } #summarizeReturn: { in: #Input out: [for k in in.forms { k.common }] } #compute: { in: #Input out: (#summarizeReturn & {"in": in}).out } } -- issue2263.cue -- issue2263: simplified: { metrics: #Metric #Metric: { #IDSource | {} #TargetAverage | {} } metrics: { id: "foo" avg: 60 } #IDSource: id: string #TargetAverage: avg: number } issue2263: full: { metrics: [...#Metric] metrics: [{ id: "foo" avg: 60 }, { id: "bar" value: 80 }, { uri: "baz" avg: 70 }, { uri: "qux" value: 90 }] #Metric: { #Source #Target } #Source: #IDSource | #URISource #Target: #TargetAverage | #TargetValue #IDSource: { id: string } #URISource: { uri: string } #TargetAverage: { avg: number } #TargetValue: { value: number } } -- out/eval/stats -- Leaks: 4 Freed: 2339 Reused: 2323 Allocs: 20 Retain: 115 Unifications: 1260 Conjuncts: 3417 Disjuncts: 2454 -- out/eval -- Errors: issue2209.full.Bar.resource.spec: 6 errors in empty disjunction: issue2209.full.Bar.resource.spec.minBar: 2 errors in empty disjunction: issue2209.full.Bar.resource.spec.minBar: conflicting values null and int (mismatched types null and int): ./issue2209full.cue:43:7 ./issue2209full.cue:48:13 ./issue2209full.cue:67:10 ./issue2209full.cue:83:16 ./issue2209full.cue:87:13 ./issue2209full.cue:107:20 issue2209.full.Bar.resource.spec.minFoo: 2 errors in empty disjunction: issue2209.full.Bar.resource.spec.minFoo: conflicting values null and 10 (mismatched types null and int): ./issue2209full.cue:43:7 ./issue2209full.cue:48:13 ./issue2209full.cue:55:16 ./issue2209full.cue:71:4 ./issue2209full.cue:72:13 ./issue2209full.cue:92:13 issue2209.full.Bar.resource.spec.minFoo: conflicting values null and int (mismatched types null and int): ./issue2209full.cue:43:7 ./issue2209full.cue:48:13 ./issue2209full.cue:67:10 ./issue2209full.cue:83:16 ./issue2209full.cue:92:13 ./issue2209full.cue:105:20 issue2209.simplified.t3.BAZ: undefined field: y: ./issue2209full.cue:35:9 issue2209.full.Bar.resource.spec.minBar: undefined field: min: ./issue2209full.cue:77:25 Result: (_|_){ // [eval] disambiguateClosed: (struct){ b: (#struct){ |((#struct){ x: (bool){ true } }, (#struct){ y: (bool){ true } }) } a: (#struct){ |((#struct){ x: (bool){ true } }, (#struct){ y: (bool){ true } }) } #Def: (#struct){ |((#struct){ x: (bool){ true } }, (#struct){ y: (bool){ true } }) } } alwaysCheckMatchers1: (struct){ b: (struct){ c: (string){ "yyyyy" } } } alwaysCheckPatterns2: (struct){ a: (#struct){ c: (string){ "yyyyy" } } b: (#struct){ c: (string){ "yyyyy" } } #X: ((string|struct)){ |((string){ string }, (#struct){ c: (string){ string } }) } } nestedNonMonotonic: (struct){ resolved: (struct){ n1: (struct){ x: ((null|struct)){ |((struct){ a: (struct){ c: (int){ 1 } d: (int){ 1 } } }, (null){ null }) } } n2: (struct){ x: ((null|struct)){ |((struct){ a: (struct){ b: (struct){ c: (int){ 1 } d: (int){ 1 } } } }, (null){ null }) } } } eliminated: (struct){ n1: (struct){ p1: (struct){ x: (null){ null } } p2: (struct){ x: (null){ null } } } n2: (struct){ p1: (struct){ x: (null){ null } } p2: (struct){ x: (null){ null } } } } incomplete: (struct){ a: (struct){ n1: (struct){ p1: (struct){ x: (null){ null } } p2: (struct){ x: (null){ null } } } n2: (struct){ p1: (struct){ x: ((null|struct)){ |((struct){ 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:96:15 // ./in.cue:96:32 // ./in.cue:97:12 c: (int){ 1 } } } }, (null){ null }) } } p2: (struct){ x: ((null|struct)){ |((struct){ 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:102:15 // ./in.cue:101:12 // ./in.cue:102:32 c: (int){ 1 } } } }, (null){ null }) } } } } b: (struct){ n1: (struct){ p1: (struct){ x: (null){ null } } p2: (struct){ x: (null){ null } } p3: (struct){ x: (null){ null } } } n2: (struct){ p1: (struct){ x: ((null|struct)){ |((struct){ a: (struct){ b: (_|_){ // [incomplete] nestedNonMonotonic.incomplete.b.n2.p1.x.a.b: invalid value {c:1 & 1 & 1,d:1 & 1 & 1} (does not satisfy struct.MinFields(3)): len(fields) < MinFields(3) (2 < 3): // ./in.cue:138:15 // ./in.cue:124:15 // ./in.cue:125:12 // ./in.cue:126:12 // ./in.cue:130:12 // ./in.cue:131:15 // ./in.cue:132:12 // ./in.cue:136:12 // ./in.cue:137:12 // ./in.cue:138:32 c: (int){ 1 } d: (int){ 1 } } } }, (null){ null }) } } } } } } preserveClosedness: (struct){ small: (struct){ p1: (struct){ #A: (#struct){ |(*(#struct){ a: (string){ string } }, (#struct){ a: (string){ string } b: (int){ int } }) } #B: (#struct){ |(*(#struct){ }, (#struct){ b: (int){ int } }, (#struct){ a: (string){ string } }, (#struct){ a: (string){ string } b: (int){ int } }) } } p2: (struct){ #A: (#struct){ |(*(#struct){ a: (string){ string } }, (#struct){ a: (string){ string } b: (int){ int } }) } #B: (#struct){ |(*(#struct){ }, (#struct){ a: (string){ string } b: (int){ int } }, (#struct){ a: (string){ string } }, (#struct){ b: (int){ int } }) } } } medium: (struct){ p1: (struct){ #A: (#struct){ |(*(#struct){ a: (string){ string } }, (#struct){ a: (string){ string } c: (int){ int } }, (#struct){ a: (string){ string } d: (string){ string } }) } #B: (#struct){ |(*(#struct){ }, (#struct){ c: (int){ int } }, (#struct){ d: (string){ string } }, (#struct){ a: (string){ string } }, (#struct){ a: (string){ string } c: (int){ int } }, (#struct){ a: (string){ string } d: (string){ string } }, (#struct){ b: (string){ string } }, (#struct){ b: (string){ string } c: (int){ int } }, (#struct){ b: (string){ string } d: (string){ string } }) } } p2: (struct){ #A: (#struct){ |(*(#struct){ a: (string){ string } }, (#struct){ a: (string){ string } c: (int){ int } }, (#struct){ a: (string){ string } d: (string){ string } }) } #B: (#struct){ |(*(#struct){ }, (#struct){ a: (string){ string } c: (int){ int } }, (#struct){ a: (string){ string } d: (string){ string } }, (#struct){ a: (string){ string } }, (#struct){ c: (int){ int } }, (#struct){ d: (string){ string } }, (#struct){ b: (string){ string } }, (#struct){ b: (string){ string } c: (int){ int } }, (#struct){ b: (string){ string } d: (string){ string } }) } } p3: (struct){ #A: (#struct){ |(*(#struct){ a: (string){ string } }, (#struct){ a: (string){ string } c: (int){ int } }, (#struct){ a: (string){ string } d: (string){ string } }) } #B: (#struct){ |(*(#struct){ }, (#struct){ a: (string){ string } c: (int){ int } }, (#struct){ a: (string){ string } d: (string){ string } }, (#struct){ b: (string){ string } }, (#struct){ b: (string){ string } c: (int){ int } }, (#struct){ b: (string){ string } d: (string){ string } }, (#struct){ a: (string){ string } }, (#struct){ c: (int){ int } }, (#struct){ d: (string){ string } }) } } } } noChildError: (struct){ issue1608: (struct){ myValue: (#struct){ fieldName: (string){ "some string" } } #type: (#struct){ fieldName: ((string|struct)){ |((string){ string }, (#struct){ foo: (string){ string } }, (#struct){ bar: ((string|struct)){ |((string){ string }, (#struct){ foo: (string){ string } }) } }) } } #subtype: ((string|struct)){ |((string){ string }, (#struct){ foo: (string){ string } }) } } t1: (struct){ #D: (#struct){ b: (string){ string } } o: (#struct){ b: (string){ "test" } } } t2: (struct){ o: (#struct){ b: (string){ "test" } } #D: (#struct){ b: (string){ string } } } t3: (struct){ #D: (#struct){ |((#struct){ a: (null){ null } }, (#struct){ b: (string){ string } }) } o: (#struct){ b: (string){ "test" } } } t4: (struct){ o: (#struct){ b: (string){ "test" } } #D: (#struct){ |((#struct){ a: (null){ null } }, (#struct){ b: (string){ string } }) } } } issue1924: (struct){ t1: (struct){ m: (struct){ a: (int){ 2 } } x: (int){ 2 } } t2: (struct){ m: (struct){ a: (int){ 2 } } x: (int){ 3 } } t3: (struct){ m: (struct){ a: (int){ 2 } } x: (int){ 1 } } } issue1838: (struct){ t1: (struct){ p?: (#list){ } a: (null){ null } } t2: (struct){ p?: (#list){ } a: (null){ null } } } noHang: (struct){ #T: (list){ 0: (string){ "d" } } x: (list){ 0: (string){ "d" } } #X: (list){ 0: (string){ "d" } } } issue1940: (struct){ #T: (#list){ 0: (string){ "d" } 1: (list){ } } #A: (#struct){ type: (#list){ 0: (string){ "d" } 1: (list){ } } } #B: (#struct){ } #C: (#struct){ x: (#struct){ type: (#list){ 0: (string){ "d" } 1: (list){ } } } } } issue2209: (_|_){ // [eval] simplified: (_|_){ // [eval] t1: (struct){ #SpecFoo: (#struct){ foo: (#struct){ min: (int){ 1 } } } #SpecBar: (#struct){ bar: (#struct){ min: (int){ 1 } } } spec: (#struct){ bar: (#struct){ min: (int){ 1 } } } out: (struct){ |((struct){ X: (#struct){ bar: (#struct){ min: (int){ 1 } } } nullFoo: (null){ null } minFoo: (int){ int } }, (struct){ minBar: (int){ int } X: (#struct){ bar: (#struct){ min: (int){ 1 } } } nullFoo: (null){ null } }, (struct){ X: (#struct){ bar: (#struct){ min: (int){ 1 } } } nullBar: (null){ null } minFoo: (int){ int } }, (struct){ minBar: (int){ int } X: (#struct){ bar: (#struct){ min: (int){ 1 } } } nullBar: (null){ null } }) } } t2: (_|_){ // [incomplete] issue2209.simplified.t2.BAZ: undefined field: x: // ./issue2209full.cue:24:17 #SpecFoo: (#struct){ foo: (#struct){ } } #SpecBar: (#struct){ bar: (#struct){ x: (int){ 1 } } } spec: (#struct){ |(*(#struct){ bar: (struct){ } foo: (#struct){ } }, (#struct){ bar: (#struct){ x: (int){ 1 } } }) } BAZ: (_|_){ // [incomplete] issue2209.simplified.t2.BAZ: undefined field: x: // ./issue2209full.cue:24:17 } b2: (int){ int } } t3: (_|_){ // [eval] issue2209.simplified.t3.BAZ: undefined field: y: // ./issue2209full.cue:35:9 #A: (#struct){ v: (int){ 1 } } BAZ: (_|_){ // [eval] issue2209.simplified.t3.BAZ: undefined field: y: // ./issue2209full.cue:35:9 } S: (#struct){ |(*(#struct){ x: (int){ 1 } v: (int){ 1 } }, (#struct){ x: (int){ 1 } y: (int){ 1 } }) } #B: (#struct){ x: (int){ 1 } y: (int){ 1 } } b2: (int){ int } } } full: (_|_){ // [eval] Foo: (#struct){ spec: (#struct){ foo: (#struct){ min: (int){ |(*(int){ 10 }, (int){ int }) } max: (int){ |(*(int){ 20 }, (int){ int }) } } } resource: (#struct){ spec: (#struct){ |(*(#struct){ minFoo: (int){ |(*(int){ 10 }, (int){ int }) } maxFoo: (int){ |(*(int){ 20 }, (int){ int }) } minBar?: (null){ null } maxBar?: (null){ null } hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) } fuga?: (null){ null } }, (#struct){ minFoo: (int){ |(*(int){ 10 }, (int){ int }) } maxFoo: (int){ |(*(int){ 20 }, (int){ int }) } minBar?: (null){ null } maxBar?: (null){ null } hoge?: (null){ null } fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) } }) } _X: (#struct){ spec: (#struct){ |(*(#struct){ foo: (#struct){ min: (int){ |(*(int){ 10 }, (int){ int }) } max: (int){ |(*(int){ 20 }, (int){ int }) } } }, (#struct){ foo: (#struct){ } bar: (#struct){ min: (int){ |(*(int){ 30 }, (int){ int }) } max: (int){ |(*(int){ 40 }, (int){ int }) } } }) } } } } Bar: (_|_){ // [eval] spec: (#struct){ bar: (#struct){ min: (int){ |(*(int){ 30 }, (int){ int }) } max: (int){ |(*(int){ 40 }, (int){ int }) } } } resource: (_|_){ // [eval] spec: (_|_){ // [eval] issue2209.full.Bar.resource.spec: 6 errors in empty disjunction: // issue2209.full.Bar.resource.spec.minBar: 2 errors in empty disjunction: // issue2209.full.Bar.resource.spec.minBar: conflicting values null and int (mismatched types null and int): // ./issue2209full.cue:43:7 // ./issue2209full.cue:48:13 // ./issue2209full.cue:67:10 // ./issue2209full.cue:83:16 // ./issue2209full.cue:87:13 // ./issue2209full.cue:107:20 // issue2209.full.Bar.resource.spec.minFoo: 2 errors in empty disjunction: // issue2209.full.Bar.resource.spec.minFoo: conflicting values null and 10 (mismatched types null and int): // ./issue2209full.cue:43:7 // ./issue2209full.cue:48:13 // ./issue2209full.cue:55:16 // ./issue2209full.cue:71:4 // ./issue2209full.cue:72:13 // ./issue2209full.cue:92:13 // issue2209.full.Bar.resource.spec.minFoo: conflicting values null and int (mismatched types null and int): // ./issue2209full.cue:43:7 // ./issue2209full.cue:48:13 // ./issue2209full.cue:67:10 // ./issue2209full.cue:83:16 // ./issue2209full.cue:92:13 // ./issue2209full.cue:105:20 // issue2209.full.Bar.resource.spec.minBar: undefined field: min: // ./issue2209full.cue:77:25 minFoo: (_|_){ // [eval] issue2209.full.Bar.resource.spec.minFoo: 2 errors in empty disjunction: // issue2209.full.Bar.resource.spec.minFoo: conflicting values null and 10 (mismatched types null and int): // ./issue2209full.cue:43:7 // ./issue2209full.cue:48:13 // ./issue2209full.cue:55:16 // ./issue2209full.cue:71:4 // ./issue2209full.cue:72:13 // ./issue2209full.cue:92:13 // issue2209.full.Bar.resource.spec.minFoo: conflicting values null and int (mismatched types null and int): // ./issue2209full.cue:43:7 // ./issue2209full.cue:48:13 // ./issue2209full.cue:67:10 // ./issue2209full.cue:83:16 // ./issue2209full.cue:92:13 // ./issue2209full.cue:105:20 } maxFoo: (_|_){ // [eval] issue2209.full.Bar.resource.spec.maxFoo: 2 errors in empty disjunction: // issue2209.full.Bar.resource.spec.maxFoo: conflicting values null and 20 (mismatched types null and int): // ./issue2209full.cue:43:7 // ./issue2209full.cue:48:13 // ./issue2209full.cue:56:16 // ./issue2209full.cue:71:4 // ./issue2209full.cue:73:13 // ./issue2209full.cue:93:13 // issue2209.full.Bar.resource.spec.maxFoo: conflicting values null and int (mismatched types null and int): // ./issue2209full.cue:43:7 // ./issue2209full.cue:48:13 // ./issue2209full.cue:67:10 // ./issue2209full.cue:83:16 // ./issue2209full.cue:93:13 // ./issue2209full.cue:106:20 } minBar: (_|_){ // [eval] issue2209.full.Bar.resource.spec.minBar: undefined field: min: // ./issue2209full.cue:77:25 } maxBar: (_|_){ // [eval] issue2209.full.Bar.resource.spec.maxBar: undefined field: max: // ./issue2209full.cue:78:25 } hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) } fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) } } _X: (#struct){ spec: (#struct){ |(*(#struct){ bar: (#struct){ } foo: (#struct){ min: (int){ |(*(int){ 10 }, (int){ int }) } max: (int){ |(*(int){ 20 }, (int){ int }) } } }, (#struct){ bar: (#struct){ min: (int){ |(*(int){ 30 }, (int){ int }) } max: (int){ |(*(int){ 40 }, (int){ int }) } } }) } } } } #Abstract: (#struct){ spec: (#struct){ |(*(#struct){ foo: (#struct){ min: (int){ |(*(int){ 10 }, (int){ int }) } max: (int){ |(*(int){ 20 }, (int){ int }) } } }, (#struct){ bar: (#struct){ min: (int){ |(*(int){ 30 }, (int){ int }) } max: (int){ |(*(int){ 40 }, (int){ int }) } } }) } resource: (#struct){ spec: (#struct){ |(*(#struct){ minFoo: (int){ |(*(int){ 10 }, (int){ int }) } maxFoo: (int){ |(*(int){ 20 }, (int){ int }) } minBar?: (null){ null } maxBar?: (null){ null } hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) } fuga?: (null){ null } }, (#struct){ minFoo: (int){ |(*(int){ 10 }, (int){ int }) } maxFoo: (int){ |(*(int){ 20 }, (int){ int }) } minBar?: (null){ null } maxBar?: (null){ null } hoge?: (null){ null } fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) } }) } _X: (#struct){ spec: (#struct){ |(*(#struct){ foo: (#struct){ min: (int){ |(*(int){ 10 }, (int){ int }) } max: (int){ |(*(int){ 20 }, (int){ int }) } } }, (#struct){ bar: (#struct){ min: (int){ |(*(int){ 30 }, (int){ int }) } max: (int){ |(*(int){ 40 }, (int){ int }) } } }) } } } } _#Spec: (#struct){ |(*(#struct){ foo: (#struct){ min: (int){ |(*(int){ 10 }, (int){ int }) } max: (int){ |(*(int){ 20 }, (int){ int }) } } }, (#struct){ bar: (#struct){ min: (int){ |(*(int){ 30 }, (int){ int }) } max: (int){ |(*(int){ 40 }, (int){ int }) } } }) } _#SpecFoo: (#struct){ foo: (#struct){ min: (int){ |(*(int){ 10 }, (int){ int }) } max: (int){ |(*(int){ 20 }, (int){ int }) } } } _#SpecBar: (#struct){ bar: (#struct){ min: (int){ |(*(int){ 30 }, (int){ int }) } max: (int){ |(*(int){ 40 }, (int){ int }) } } } _Thing: (#struct){ spec: (#struct){ |(*(#struct){ minFoo: (int){ |(*(int){ 10 }, (int){ int }) } maxFoo: (int){ |(*(int){ 20 }, (int){ int }) } minBar?: (null){ null } maxBar?: (null){ null } hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) } fuga?: (null){ null } }, *(#struct){ minFoo?: (null){ null } maxFoo?: (null){ null } minBar: (int){ |(*(int){ 30 }, (int){ int }) } maxBar: (int){ |(*(int){ 40 }, (int){ int }) } hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) } fuga?: (null){ null } }, (#struct){ minFoo: (int){ |(*(int){ 10 }, (int){ int }) } maxFoo: (int){ |(*(int){ 20 }, (int){ int }) } minBar?: (null){ null } maxBar?: (null){ null } hoge?: (null){ null } fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) } }, (#struct){ minFoo?: (null){ null } maxFoo?: (null){ null } minBar: (int){ |(*(int){ 30 }, (int){ int }) } maxBar: (int){ |(*(int){ 40 }, (int){ int }) } hoge?: (null){ null } fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) } }) } _X: (_){ _ } } #Constrained: (#struct){ spec: (#struct){ |(*(#struct){ minFoo: (int){ |(*(int){ 10 }, (int){ int }) } maxFoo: (int){ |(*(int){ 20 }, (int){ int }) } minBar?: (null){ null } maxBar?: (null){ null } hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) } fuga?: (null){ null } }, *(#struct){ minFoo?: (null){ null } maxFoo?: (null){ null } minBar: (int){ |(*(int){ 30 }, (int){ int }) } maxBar: (int){ |(*(int){ 40 }, (int){ int }) } hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) } fuga?: (null){ null } }, (#struct){ minFoo: (int){ |(*(int){ 10 }, (int){ int }) } maxFoo: (int){ |(*(int){ 20 }, (int){ int }) } minBar?: (null){ null } maxBar?: (null){ null } hoge?: (null){ null } fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) } }, (#struct){ minFoo?: (null){ null } maxFoo?: (null){ null } minBar: (int){ |(*(int){ 30 }, (int){ int }) } maxBar: (int){ |(*(int){ 40 }, (int){ int }) } hoge?: (null){ null } fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) } }) } } #Base: (#struct){ spec: (#struct){ minFoo?: ((null|int)){ |((null){ null }, (int){ int }) } maxFoo?: ((null|int)){ |((null){ null }, (int){ int }) } minBar?: ((null|int)){ |((null){ null }, (int){ int }) } maxBar?: ((null|int)){ |((null){ null }, (int){ int }) } hoge?: ((null|bool)){ |((null){ null }, (bool){ bool }) } fuga?: ((null|bool)){ |((null){ null }, (bool){ bool }) } } } } } issue2246: (struct){ simplified: (struct){ #FormFoo: (#struct){ fooID: (string){ string } } #FormBar: (#struct){ barID: (string){ string } } #Form: (#struct){ |((#struct){ fooID: (string){ string } }, (#struct){ barID: (string){ string } }) } data: (struct){ fooID: (string){ "123" } } out1: (#struct){ fooID: (string){ "123" } } out2: (#struct){ fooID: (string){ "123" } } } full: (struct){ data: (struct){ forms: (#list){ 0: (struct){ fooID: (string){ "00-0000001" } } } } form1040: (#list){ 0: (int){ 3 } } #K1: (#struct){ #_base: (#struct){ common: (int){ 3 } } #FormFoo: (#struct){ common: (int){ 3 } fooID: (string){ string } } #FormBar: (#struct){ common: (int){ 3 } barID: (string){ string } } #Form: (#struct){ |((#struct){ common: (int){ 3 } fooID: (string){ string } }, (#struct){ common: (int){ 3 } barID: (string){ string } }) } } #Input: (#struct){ forms: (list){ } } #summarizeReturn: (#struct){ in: (#struct){ forms: (list){ } } out: (#list){ } } #compute: (#struct){ in: (#struct){ forms: (list){ } } out: (#list){ } } } } issue2263: (struct){ simplified: (struct){ metrics: (#struct){ id: (string){ "foo" } avg: (int){ 60 } } #Metric: (#struct){ |((#struct){ id: (string){ string } avg: (number){ number } }, (#struct){ id: (string){ string } }, (#struct){ avg: (number){ number } }, (#struct){ }) } #IDSource: (#struct){ id: (string){ string } } #TargetAverage: (#struct){ avg: (number){ number } } } full: (struct){ metrics: (#list){ 0: (#struct){ id: (string){ "foo" } avg: (int){ 60 } } 1: (#struct){ id: (string){ "bar" } value: (int){ 80 } } 2: (#struct){ uri: (string){ "baz" } avg: (int){ 70 } } 3: (#struct){ uri: (string){ "qux" } value: (int){ 90 } } } #Metric: (#struct){ |((#struct){ id: (string){ string } avg: (number){ number } }, (#struct){ id: (string){ string } value: (number){ number } }, (#struct){ uri: (string){ string } avg: (number){ number } }, (#struct){ uri: (string){ string } value: (number){ number } }) } #Source: (#struct){ |((#struct){ id: (string){ string } }, (#struct){ uri: (string){ string } }) } #Target: (#struct){ |((#struct){ avg: (number){ number } }, (#struct){ value: (number){ number } }) } #IDSource: (#struct){ id: (string){ string } } #URISource: (#struct){ uri: (string){ string } } #TargetAverage: (#struct){ avg: (number){ number } } #TargetValue: (#struct){ value: (number){ number } } } } } -- out/compile -- --- in.cue { disambiguateClosed: { b: (〈0;#Def〉 & 〈0;a〉) a: 〈0;#Def〉 #Def: { ({ x: true }|{ y: true }) } } alwaysCheckMatchers1: { b: ({ [=~"^xxxx$"]: int }|null) b: ({ c: string }|null) b: { c: "yyyyy" } } alwaysCheckPatterns2: { a: 〈0;#X〉 a: 〈0;b〉 b: 〈0;#X〉 b: { c: "yyyyy" } #X: (string|{ c: string { [=~"^xxxx$"]: int } }) } nestedNonMonotonic: { resolved: { n1: { x: ({ a: 〈import;struct〉.MinFields(2) }|null) x: ({ a: { c: 1 } }|null) x: ({ a: { d: 1 } }|null) } } } nestedNonMonotonic: { resolved: { n2: { x: ({ a: { b: 〈import;struct〉.MinFields(2) } }|null) x: ({ a: { b: { c: 1 } } }|null) x: ({ a: { b: { d: 1 } } }|null) } } } nestedNonMonotonic: { eliminated: { n1: { p1: { x: ({ a: 〈import;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: 〈import;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: 〈import;struct〉.MaxFields(1) }|null) } } } } nestedNonMonotonic: { eliminated: { n2: { p1: { x: ({ a: { b: 〈import;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: 〈import;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: 〈import;struct〉.MaxFields(1) } }|null) } } } } nestedNonMonotonic: { incomplete: { a: { n1: { p1: { x: ({ a: 〈import;struct〉.MinFields(2) }|null) x: ({ a: { c: 1 } }|null) } } } } } nestedNonMonotonic: { incomplete: { a: { n1: { p2: { x: ({ a: { c: 1 } }|null) x: ({ a: 〈import;struct〉.MinFields(2) }|null) } } } } } nestedNonMonotonic: { incomplete: { a: { n2: { p1: { x: ({ a: { b: 〈import;struct〉.MinFields(2) } }|null) x: ({ a: { b: { c: 1 } } }|null) } } } } } nestedNonMonotonic: { incomplete: { a: { n2: { p2: { x: ({ a: { b: { c: 1 } } }|null) x: ({ a: { b: 〈import;struct〉.MinFields(2) } }|null) } } } } } nestedNonMonotonic: { incomplete: { b: { n1: { p1: { x: ({ a: 〈import;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: 〈import;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: 〈import;struct〉.MinFields(3) }|null) } } } } } nestedNonMonotonic: { incomplete: { b: { n2: { p1: { x: ({ a: { b: 〈import;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: 〈import;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: 〈import;struct〉.MinFields(3) } }|null) } } } } } preserveClosedness: { small: { p1: { #A: (〈0;#B〉 & { a: string }) #B: { (*{}|{ a: string }) (*{}|{ b: int }) } } } } preserveClosedness: { small: { p2: { #A: (〈0;#B〉 & { a: string }) #B: { ({ a: string }|*{}) (*{}|{ b: int }) } } } } preserveClosedness: { medium: { p1: { #A: (〈0;#B〉 & { a: string }) #B: { (*{}|{ a: string }|{ b: string }) (*{}|{ c: int }|{ d: string }) } } } } preserveClosedness: { medium: { p2: { #A: (〈0;#B〉 & { a: string }) #B: { ({ a: string }|*{}|{ b: string }) (*{}|{ c: int }|{ d: string }) } } } } preserveClosedness: { medium: { p3: { #A: (〈0;#B〉 & { a: string }) #B: { ({ a: string }|{ b: string }|*{}) (*{}|{ c: int }|{ d: string }) } } } } noChildError: _ noChildError: { issue1608: { myValue: (〈0;#type〉 & { fieldName: "some string" }) #type: { fieldName: 〈1;#subtype〉 } #subtype: (string|{ foo: string }|{ bar: 〈1;#subtype〉 }) } } noChildError: { t1: { #D: ({ b: string }|{ c: 〈1;#D〉 }) o: (〈0;#D〉 & { b: "test" }) } } noChildError: { t2: { o: (〈0;#D〉 & { b: "test" }) #D: ({ b: string }|{ c: 〈1;#D〉 }) } } noChildError: { t3: { #D: ({ a: null }|{ b: string }|{ c: 〈1;#D〉 }) o: (〈0;#D〉 & { b: "test" }) } } noChildError: { t4: { o: (〈0;#D〉 & { b: "test" }) #D: ({ a: null }|{ b: string }|{ c: 〈1;#D〉 }) } } issue1924: { t1: { m: { a: 2 } x: (*[ 〈1;m〉.b, ]|2) } } issue1924: { t2: { m: { a: 2 } x: (*{ v: 〈1;m〉.b }|3) } } issue1924: { t3: { m: { a: 2 } x: (*〈0;m〉.b|1) } } issue1838: { t1: { p?: [] a: ([ for _, k in 〈1;p〉 { 〈1;k〉 }, ]|null) } } issue1838: { t2: { p?: [] a: (null|[ for _, k in 〈1;p〉 { 〈1;k〉 }, ]) } } noHang: { #T: ([ "a", 〈1;#T〉, ]|[ "d", ...〈1;#T〉, ]) x: 〈0;#T〉 #X: 〈0;x〉 #X: 〈0;#T〉 } issue1940: { #T: ([ "a", 〈1;#T〉, ]|[ "b", 〈1;#T〉, ]|[ "c", 〈1;#T〉, ]|[ "d", [ ...〈2;#T〉, ], ]) #A: { type: 〈1;#T〉 } #B: { [string]: 〈1;#A〉 } #C: (〈0;#B〉 & { x: 〈1;#A〉 }) } } --- issue2209full.cue { issue2209: { simplified: { t1: { #SpecFoo: { foo: { min: 1 } } #SpecBar: { bar: { min: 1 } } spec: { bar: {} } spec: (〈0;#SpecFoo〉|〈0;#SpecBar〉) out: { ({ nullFoo: null }|{ nullBar: null }) ({ minFoo: int }|{ minBar: int }) if (〈0;X〉.bar != _|_(explicit error (_|_ literal) in source)) { minBar: 〈1;X〉.bar.min } X: 〈1;spec〉 } } } } issue2209: { simplified: { t2: { #SpecFoo: { foo: {} } #SpecBar: { bar: { x: 1 } } spec: { bar: {} } spec: (*〈0;#SpecFoo〉|〈0;#SpecBar〉) if (〈0;spec〉.bar != _|_(explicit error (_|_ literal) in source)) { BAZ: 〈1;spec〉.bar.x } ({ f1: int }|{ b2: int }) ({ f2: int }|{ b2: int }) } } } issue2209: { simplified: { t3: { #A: { v: 1 } ({ f1: int }|{ b2: int }) ({ f2: int }|{ b2: int }) BAZ: 〈0;S〉.y S: (*〈0;#A〉|〈0;#B〉) #B: { x: 1 y: 1 } S: { x: 1 } } } } issue2209: { full: { Foo: (〈0;#Abstract〉 & { spec: { foo: {} } }) Bar: (〈0;#Abstract〉 & { spec: { bar: {} } }) #Abstract: { spec: 〈1;_#Spec〉 resource: (〈1;_Thing〉 & { _X: { spec: 〈3〉.spec } }) } _#Spec: (*〈0;_#SpecFoo〉|〈0;_#SpecBar〉) _#SpecFoo: { foo: { min: (int|*10) max: (int|*20) } } _#SpecBar: { bar: { min: (int|*30) max: (int|*40) } } _Thing: (〈0;#Constrained〉 & { _X: _ spec: { if (〈1;_X〉.spec.foo != _|_(explicit error (_|_ literal) in source)) { minFoo: 〈2;_X〉.spec.foo.min maxFoo: 〈2;_X〉.spec.foo.max } if (〈1;_X〉.spec.bar != _|_(explicit error (_|_ literal) in source)) { minBar: 〈2;_X〉.spec.bar.min maxBar: 〈2;_X〉.spec.bar.max } } }) #Constrained: (〈0;#Base〉 & { spec: ({ minFoo: (int|*10) maxFoo: (int|*20) minBar?: null maxBar?: null }|{ minBar: (int|*30) maxBar: (int|*40) minFoo?: null maxFoo?: null }) spec: (*{ fuga?: null }|{ hoge?: null }) }) #Base: { spec: { minFoo?: (null|int) maxFoo?: (null|int) minBar?: (null|int) maxBar?: (null|int) hoge?: (null|bool) fuga?: (null|bool) } } } } } --- issue2246.cue { issue2246: { simplified: { #FormFoo: { fooID: string } #FormBar: { barID: string } #Form: { (〈1;#FormFoo〉|〈1;#FormBar〉) } data: { fooID: "123" } out1: (〈0;#Form〉 & 〈0;data〉) out2: (〈0;#Form〉 & 〈0;out1〉) } } issue2246: { full: { data: { forms: [ { fooID: "00-0000001" }, ] } form1040: (〈0;#compute〉 & { in: 〈1;data〉 }).out #K1: { #_base: { common: 3 } #FormFoo: { 〈1;#_base〉 fooID: string } #FormBar: { 〈1;#_base〉 barID: string } #Form: { (〈1;#FormFoo〉|〈1;#FormBar〉) } } #Input: { forms: [ ...〈2;#K1〉.#Form, ] } #summarizeReturn: { in: 〈1;#Input〉 out: [ for _, k in 〈1;in〉.forms { 〈1;k〉.common }, ] } #compute: { in: 〈1;#Input〉 out: (〈1;#summarizeReturn〉 & { in: 〈1;in〉 }).out } } } } --- issue2263.cue { issue2263: { simplified: { metrics: 〈0;#Metric〉 #Metric: { (〈1;#IDSource〉|{}) (〈1;#TargetAverage〉|{}) } metrics: { id: "foo" avg: 60 } #IDSource: { id: string } #TargetAverage: { avg: number } } } issue2263: { full: { metrics: [ ...〈1;#Metric〉, ] metrics: [ { id: "foo" avg: 60 }, { id: "bar" value: 80 }, { uri: "baz" avg: 70 }, { uri: "qux" value: 90 }, ] #Metric: { 〈1;#Source〉 〈1;#Target〉 } #Source: (〈0;#IDSource〉|〈0;#URISource〉) #Target: (〈0;#TargetAverage〉|〈0;#TargetValue〉) #IDSource: { id: string } #URISource: { uri: string } #TargetAverage: { avg: number } #TargetValue: { value: number } } } }