github.com/solo-io/cue@v0.4.7/cue/testdata/references/let.txtar (about) 1 -- in.cue -- 2 import "list" 3 4 a1list: [{1}] 5 let A1 = a1list 6 a1: 100*A1[0] + A1[0] 7 8 a2list: [{2}] 9 let A2 = a2list 10 a2: b: 100*A2[0] + A2[0] 11 12 a3list: [{3}] 13 let A3 = a3list 14 a3: b: c: 100*A3[0] + A3[0] 15 16 a4list: [{4}] 17 let A4 = a4list 18 a4: [ for x in A4 { v: 404 } ] 19 20 a5list: [{5}] 21 let A5 = a5list 22 a5: b: [ for x in A5 { v: 505 } ] 23 24 a6list: [{6}] 25 let A6 = a6list 26 a6: b: c: [ for x in A6 { v: 606 } ] 27 28 a7list: [{7}] 29 let A7 = a7list 30 a7: { for x in A7 { v: 707 } } 31 32 a8list: [{8}] 33 let A8 = a8list 34 a8: b: { for x in A8 { v: 808 } } 35 36 a9list: [{9}] 37 let A9 = a9list 38 a9: b: c: { for x in A9 { v: 909 } } 39 40 // Issue #609: 41 // When a let value resolved to an incomplete value, it should pass this 42 // incomplete status to the expression in which it used. But 609 reported 43 // a gobbling of this incomplete status. The problem seemed to be not 44 // exclusive to the use of let, though. 45 incompleteLet: { 46 input: [1,2,3,4,5] 47 48 last: { 49 min: list.Min(input) 50 max: list.Max(input) 51 } 52 53 bar: { 54 let mn = last.min 55 let mx = list.max 56 57 min: mn 58 max: mx 59 } 60 61 x: { 62 if list.max < 0 { 63 } 64 } 65 } 66 67 cycles: { 68 a: { 69 let A = { c: B } 70 let B = A 71 out: A 72 } 73 74 b: { 75 let A = { c: B } 76 let B = { A.c } 77 out: A 78 } 79 80 issue1042: { 81 #FullAdder: { 82 // IN 83 a: bool 84 b: bool 85 c: bool 86 // OUT 87 sum: bool 88 carry: bool 89 } 90 91 #Add16: { 92 a: [bool] * 16 93 b: [bool] * 16 94 out: [bool] * 16 95 96 let fulladders = [ 97 for i in list.Range(0, 4, 1) { 98 #FullAdder & {"a": a[i], "b": b[i], c: carries[i]} 99 } 100 ] 101 let carries = [ 102 false, 103 for i in list.Range(0, 4, 1) { fulladders[i].carry } 104 ] 105 out: [ 106 for i in list.Range(0, 4, 1) { fulladders[i].sum } 107 ] 108 } 109 } 110 } 111 -- out/compile -- 112 cycles.a.let[].c.c: cyclic references in let clause or alias: 113 ./in.cue:68:18 114 cycles.b.let[].c.c: cyclic references in let clause or alias: 115 ./in.cue:74:18 116 cycles.issue1042.#Add16.let[].for[].c.for[].for[].c: cyclic references in let clause or alias: 117 ./in.cue:97:50 118 --- in.cue 119 { 120 a1list: [ 121 { 122 1 123 }, 124 ] 125 a1: ((100 * 〈0;let A1〉[0]) + 〈0;let A1〉[0]) 126 a2list: [ 127 { 128 2 129 }, 130 ] 131 a2: { 132 b: ((100 * 〈1;let A2〉[0]) + 〈1;let A2〉[0]) 133 } 134 a3list: [ 135 { 136 3 137 }, 138 ] 139 a3: { 140 b: { 141 c: ((100 * 〈2;let A3〉[0]) + 〈2;let A3〉[0]) 142 } 143 } 144 a4list: [ 145 { 146 4 147 }, 148 ] 149 a4: [ 150 for _, x in 〈0;let A4〉 { 151 v: 404 152 }, 153 ] 154 a5list: [ 155 { 156 5 157 }, 158 ] 159 a5: { 160 b: [ 161 for _, x in 〈1;let A5〉 { 162 v: 505 163 }, 164 ] 165 } 166 a6list: [ 167 { 168 6 169 }, 170 ] 171 a6: { 172 b: { 173 c: [ 174 for _, x in 〈2;let A6〉 { 175 v: 606 176 }, 177 ] 178 } 179 } 180 a7list: [ 181 { 182 7 183 }, 184 ] 185 a7: { 186 for _, x in 〈1;let A7〉 { 187 v: 707 188 } 189 } 190 a8list: [ 191 { 192 8 193 }, 194 ] 195 a8: { 196 b: { 197 for _, x in 〈2;let A8〉 { 198 v: 808 199 } 200 } 201 } 202 a9list: [ 203 { 204 9 205 }, 206 ] 207 a9: { 208 b: { 209 c: { 210 for _, x in 〈3;let A9〉 { 211 v: 909 212 } 213 } 214 } 215 } 216 incompleteLet: { 217 input: [ 218 1, 219 2, 220 3, 221 4, 222 5, 223 ] 224 last: { 225 min: 〈import;list〉.Min(〈1;input〉) 226 max: 〈import;list〉.Max(〈1;input〉) 227 } 228 bar: { 229 min: 〈0;let mn〉 230 max: 〈0;let mx〉 231 } 232 x: { 233 if (〈import;list〉.max < 0) {} 234 } 235 } 236 cycles: { 237 a: { 238 out: 〈0;let A〉 239 } 240 b: { 241 out: 〈0;let A〉 242 } 243 issue1042: { 244 #FullAdder: { 245 a: bool 246 b: bool 247 c: bool 248 sum: bool 249 carry: bool 250 } 251 #Add16: { 252 a: ([ 253 bool, 254 ] * 16) 255 b: ([ 256 bool, 257 ] * 16) 258 out: ([ 259 bool, 260 ] * 16) 261 out: [ 262 for _, i in 〈import;list〉.Range(0, 4, 1) { 263 〈2;let fulladders〉[〈1;i〉].sum 264 }, 265 ] 266 } 267 } 268 } 269 } 270 -- out/eval -- 271 cycles.a.let[].c.c: cyclic references in let clause or alias: 272 ./in.cue:68:18 273 cycles.b.let[].c.c: cyclic references in let clause or alias: 274 ./in.cue:74:18 275 cycles.issue1042.#Add16.let[].for[].c.for[].for[].c: cyclic references in let clause or alias: 276 ./in.cue:97:50