cuelang.org/go@v0.13.0/cue/testdata/disjunctions/incomplete.txtar (about) 1 -- in.cue -- 2 import "encoding/yaml" 3 4 issue700: { 5 a: y: "y" 6 test1: *a.x | 1 7 test2: *a.y | 1 8 } 9 10 lookup: { 11 x: { 12 name: "Hello" 13 } 14 y: x.a 15 ok1: *x.a | x 16 ok2: x | *x.a 17 ok3: x.a | *x 18 ok4: *x | x.a 19 ok5: x | x.a 20 ok5: x.a | x 21 allFail1: x.a | x.b 22 allFail2: x.a | x.b 23 } 24 25 func: { 26 s: string 27 ok1: yaml.MarshalStream(s) | yaml.Marshal(s) 28 } 29 30 issue782: { 31 a: { 32 inner: string 33 interpolation: *"\(inner)" | string 34 interpolation: "override" 35 } 36 b: { 37 inner: string 38 interpolation: string | *"\(inner)" 39 interpolation: "override" 40 } 41 c: { 42 inner: string 43 interpolation: "\(inner)" | string 44 interpolation: "override" 45 } 46 d: { 47 inner: string 48 interpolation: string | "\(inner)" 49 interpolation: "override" 50 } 51 } 52 -- issue3680.cue -- 53 issue3680: t1: { 54 {} | { 55 a?: _|_ 56 b?: _|_ 57 } 58 {} | {} 59 } 60 issue3680: t2: { 61 x: {} | { 62 a?: _|_ 63 b?: _|_ 64 } 65 x: {} | {} 66 } 67 -- out/eval/stats -- 68 Leaks: 0 69 Freed: 98 70 Reused: 88 71 Allocs: 10 72 Retain: 0 73 74 Unifications: 56 75 Conjuncts: 132 76 Disjuncts: 98 77 -- out/eval -- 78 (struct){ 79 issue700: (struct){ 80 a: (struct){ 81 y: (string){ "y" } 82 } 83 test1: (int){ 1 } 84 test2: ((int|string)){ |(*(string){ "y" }, (int){ 1 }) } 85 } 86 lookup: (struct){ 87 x: (struct){ 88 name: (string){ "Hello" } 89 } 90 y: (_|_){ 91 // [incomplete] lookup.y: undefined field: a: 92 // ./in.cue:13:14 93 } 94 ok1: (struct){ 95 name: (string){ "Hello" } 96 } 97 ok2: (struct){ 98 name: (string){ "Hello" } 99 } 100 ok3: (struct){ 101 name: (string){ "Hello" } 102 } 103 ok4: (struct){ 104 name: (string){ "Hello" } 105 } 106 ok5: (struct){ 107 name: (string){ "Hello" } 108 } 109 allFail1: (_|_){ 110 // [incomplete] lookup.allFail1: 2 errors in empty disjunction: 111 // lookup.allFail1: undefined field: a: 112 // ./in.cue:20:14 113 // lookup.allFail1: undefined field: b: 114 // ./in.cue:20:20 115 } 116 allFail2: (_|_){ 117 // [incomplete] lookup.allFail2: 2 errors in empty disjunction: 118 // lookup.allFail2: undefined field: a: 119 // ./in.cue:21:14 120 // lookup.allFail2: undefined field: b: 121 // ./in.cue:21:20 122 } 123 } 124 func: (struct){ 125 s: (string){ string } 126 ok1: (_|_){ 127 // [incomplete] func.ok1: 2 errors in empty disjunction: 128 // func.ok1: non-concrete argument 0: 129 // ./in.cue:26:7 130 // func.ok1: non-concrete argument 0: 131 // ./in.cue:26:31 132 } 133 } 134 issue782: (struct){ 135 a: (struct){ 136 inner: (string){ string } 137 interpolation: (string){ "override" } 138 } 139 b: (struct){ 140 inner: (string){ string } 141 interpolation: (string){ "override" } 142 } 143 c: (struct){ 144 inner: (string){ string } 145 interpolation: (string){ "override" } 146 } 147 d: (struct){ 148 inner: (string){ string } 149 interpolation: (string){ "override" } 150 } 151 } 152 issue3680: (struct){ 153 t1: (struct){ |((struct){ 154 }, (struct){ 155 a?: (_|_){ 156 // [user] explicit error (_|_ literal) in source: 157 // ./issue3680.cue:3:7 158 } 159 b?: (_|_){ 160 // [user] explicit error (_|_ literal) in source: 161 // ./issue3680.cue:4:7 162 } 163 }) } 164 t2: (struct){ 165 x: (struct){ |((struct){ 166 }, (struct){ 167 a?: (_|_){ 168 // [user] explicit error (_|_ literal) in source: 169 // ./issue3680.cue:10:7 170 } 171 b?: (_|_){ 172 // [user] explicit error (_|_ literal) in source: 173 // ./issue3680.cue:11:7 174 } 175 }) } 176 } 177 } 178 } 179 -- out/compile -- 180 --- in.cue 181 { 182 issue700: { 183 a: { 184 y: "y" 185 } 186 test1: (*〈0;a〉.x|1) 187 test2: (*〈0;a〉.y|1) 188 } 189 lookup: { 190 x: { 191 name: "Hello" 192 } 193 y: 〈0;x〉.a 194 ok1: (*〈0;x〉.a|〈0;x〉) 195 ok2: (〈0;x〉|*〈0;x〉.a) 196 ok3: (〈0;x〉.a|*〈0;x〉) 197 ok4: (*〈0;x〉|〈0;x〉.a) 198 ok5: (〈0;x〉|〈0;x〉.a) 199 ok5: (〈0;x〉.a|〈0;x〉) 200 allFail1: (〈0;x〉.a|〈0;x〉.b) 201 allFail2: (〈0;x〉.a|〈0;x〉.b) 202 } 203 func: { 204 s: string 205 ok1: (〈import;"encoding/yaml"〉.MarshalStream(〈0;s〉)|〈import;"encoding/yaml"〉.Marshal(〈0;s〉)) 206 } 207 issue782: { 208 a: { 209 inner: string 210 interpolation: (*"\(〈0;inner〉)"|string) 211 interpolation: "override" 212 } 213 b: { 214 inner: string 215 interpolation: (string|*"\(〈0;inner〉)") 216 interpolation: "override" 217 } 218 c: { 219 inner: string 220 interpolation: ("\(〈0;inner〉)"|string) 221 interpolation: "override" 222 } 223 d: { 224 inner: string 225 interpolation: (string|"\(〈0;inner〉)") 226 interpolation: "override" 227 } 228 } 229 } 230 --- issue3680.cue 231 { 232 issue3680: { 233 t1: { 234 ({}|{ 235 a?: _|_(explicit error (_|_ literal) in source) 236 b?: _|_(explicit error (_|_ literal) in source) 237 }) 238 ({}|{}) 239 } 240 } 241 issue3680: { 242 t2: { 243 x: ({}|{ 244 a?: _|_(explicit error (_|_ literal) in source) 245 b?: _|_(explicit error (_|_ literal) in source) 246 }) 247 x: ({}|{}) 248 } 249 } 250 }