github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/testdata/disjunctions/errors.txtar (about) 1 -- in.cue -- 2 issue570: { 3 results: #DecodeOutput 4 results: result: "hello" 5 6 #Output: { 7 result: _ 8 } | { 9 error: string 10 } 11 12 #DecodeOutput: #Output & { 13 result?: [... string] 14 ... 15 } 16 } 17 18 issue516: { 19 #Def: { 20 match: metrics: string: {} 21 } | {} 22 23 x: #Def 24 x: match: metrics: "foo": {} 25 } 26 27 // issue #465 28 explicitDefaultError: { 29 a: string | *_|_ 30 31 if a != "" { 32 } 33 } 34 -- out/eval -- 35 Errors: 36 issue516.x: 2 errors in empty disjunction: 37 issue516.x: field not allowed: match: 38 ./in.cue:20:6 39 ./in.cue:22:5 40 ./in.cue:23:5 41 issue516.x.match.metrics: field not allowed: foo: 42 ./in.cue:19:19 43 ./in.cue:22:5 44 ./in.cue:23:21 45 issue570.results: 2 errors in empty disjunction: 46 issue570.results: field not allowed: result: 47 ./in.cue:2:11 48 ./in.cue:3:11 49 ./in.cue:7:6 50 ./in.cue:11:17 51 ./in.cue:12:3 52 issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 53 ./in.cue:2:11 54 ./in.cue:3:19 55 ./in.cue:12:12 56 57 Result: 58 (_|_){ 59 // [eval] 60 issue570: (_|_){ 61 // [eval] 62 results: (_|_){ 63 // [eval] issue570.results: 2 errors in empty disjunction: 64 // issue570.results: field not allowed: result: 65 // ./in.cue:2:11 66 // ./in.cue:3:11 67 // ./in.cue:7:6 68 // ./in.cue:11:17 69 // ./in.cue:12:3 70 // issue570.results.result: conflicting values "hello" and [...string] (mismatched types string and list): 71 // ./in.cue:2:11 72 // ./in.cue:3:19 73 // ./in.cue:12:12 74 result: (_|_){ 75 // [eval] issue570.results: field not allowed: result: 76 // ./in.cue:2:11 77 // ./in.cue:3:11 78 // ./in.cue:7:6 79 // ./in.cue:11:17 80 // ./in.cue:12:3 81 } 82 error: (string){ string } 83 } 84 #Output: (#struct){ |((#struct){ 85 result: (_){ _ } 86 }, (#struct){ 87 error: (string){ string } 88 }) } 89 #DecodeOutput: (#struct){ |((#struct){ 90 result: (list){ 91 } 92 }, (#struct){ 93 error: (string){ string } 94 }) } 95 } 96 issue516: (_|_){ 97 // [eval] 98 #Def: (#struct){ |((#struct){ 99 match: (#struct){ 100 metrics: (#struct){ 101 string: (#struct){ 102 } 103 } 104 } 105 }, (#struct){ 106 }) } 107 x: (_|_){ 108 // [eval] issue516.x: 2 errors in empty disjunction: 109 // issue516.x: field not allowed: match: 110 // ./in.cue:20:6 111 // ./in.cue:22:5 112 // ./in.cue:23:5 113 // issue516.x.match.metrics: field not allowed: foo: 114 // ./in.cue:19:19 115 // ./in.cue:22:5 116 // ./in.cue:23:21 117 match: (_|_){ 118 // [eval] issue516.x: field not allowed: match: 119 // ./in.cue:20:6 120 // ./in.cue:22:5 121 // ./in.cue:23:5 122 } 123 } 124 } 125 explicitDefaultError: (_|_){ 126 // [incomplete] explicitDefaultError: non-concrete value string in operand to !=: 127 // ./in.cue:30:5 128 // ./in.cue:28:5 129 a: (string){ string } 130 } 131 } 132 -- out/compile -- 133 --- in.cue 134 { 135 issue570: { 136 results: 〈0;#DecodeOutput〉 137 results: { 138 result: "hello" 139 } 140 #Output: ({ 141 result: _ 142 }|{ 143 error: string 144 }) 145 #DecodeOutput: (〈0;#Output〉 & { 146 result?: [ 147 ...string, 148 ] 149 ... 150 }) 151 } 152 issue516: { 153 #Def: ({ 154 match: { 155 metrics: { 156 string: {} 157 } 158 } 159 }|{}) 160 x: 〈0;#Def〉 161 x: { 162 match: { 163 metrics: { 164 foo: {} 165 } 166 } 167 } 168 } 169 explicitDefaultError: { 170 a: (string|*_|_(explicit error (_|_ literal) in source)) 171 if (〈0;a〉 != "") {} 172 } 173 }