| -- in.cue -- |
| import "list" |
| |
| a1list: [{1}] |
| let A1 = a1list |
| a1: 100*A1[0] + A1[0] |
| |
| a2list: [{2}] |
| let A2 = a2list |
| a2: b: 100*A2[0] + A2[0] |
| |
| a3list: [{3}] |
| let A3 = a3list |
| a3: b: c: 100*A3[0] + A3[0] |
| |
| a4list: [{4}] |
| let A4 = a4list |
| a4: [ for x in A4 { v: 404 } ] |
| |
| a5list: [{5}] |
| let A5 = a5list |
| a5: b: [ for x in A5 { v: 505 } ] |
| |
| a6list: [{6}] |
| let A6 = a6list |
| a6: b: c: [ for x in A6 { v: 606 } ] |
| |
| a7list: [{7}] |
| let A7 = a7list |
| a7: { for x in A7 { v: 707 } } |
| |
| a8list: [{8}] |
| let A8 = a8list |
| a8: b: { for x in A8 { v: 808 } } |
| |
| a9list: [{9}] |
| let A9 = a9list |
| a9: b: c: { for x in A9 { v: 909 } } |
| |
| // Issue #609: |
| // When a let value resolved to an incomplete value, it should pass this |
| // incomplete status to the expression in which it used. But 609 reported |
| // 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] |
| |
| last: { |
| min: list.Min(input) |
| max: list.Max(input) |
| } |
| |
| bar: { |
| let mn = last.min |
| let mx = list.max |
| |
| min: mn |
| max: mx |
| } |
| |
| x: { |
| if list.max < 0 { |
| } |
| } |
| } |
| |
| cycles: { |
| a: { |
| let A = { c: B } |
| let B = A |
| 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 |
| } |
| |
| #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 } |
| ] |
| } |
| } |
| } |
| -- out/compile -- |
| cycles.a.let[].c.c: cyclic references in let clause or alias: |
| ./in.cue:68:18 |
| cycles.b.let[].c.c: cyclic references in let clause or alias: |
| ./in.cue:74:18 |
| cycles.issue1042.#Add16.let[].for[].c.for[].for[].c: cyclic references in let clause or alias: |
| ./in.cue:97:50 |
| --- in.cue |
| { |
| a1list: [ |
| { |
| 1 |
| }, |
| ] |
| a1: ((100 * 〈0;let A1〉[0]) + 〈0;let A1〉[0]) |
| a2list: [ |
| { |
| 2 |
| }, |
| ] |
| a2: { |
| b: ((100 * 〈1;let A2〉[0]) + 〈1;let A2〉[0]) |
| } |
| a3list: [ |
| { |
| 3 |
| }, |
| ] |
| a3: { |
| b: { |
| c: ((100 * 〈2;let A3〉[0]) + 〈2;let A3〉[0]) |
| } |
| } |
| a4list: [ |
| { |
| 4 |
| }, |
| ] |
| a4: [ |
| for _, x in 〈0;let A4〉 { |
| v: 404 |
| }, |
| ] |
| a5list: [ |
| { |
| 5 |
| }, |
| ] |
| a5: { |
| b: [ |
| for _, x in 〈1;let A5〉 { |
| v: 505 |
| }, |
| ] |
| } |
| a6list: [ |
| { |
| 6 |
| }, |
| ] |
| a6: { |
| b: { |
| c: [ |
| for _, x in 〈2;let A6〉 { |
| v: 606 |
| }, |
| ] |
| } |
| } |
| a7list: [ |
| { |
| 7 |
| }, |
| ] |
| a7: { |
| for _, x in 〈1;let A7〉 { |
| v: 707 |
| } |
| } |
| a8list: [ |
| { |
| 8 |
| }, |
| ] |
| a8: { |
| b: { |
| for _, x in 〈2;let A8〉 { |
| v: 808 |
| } |
| } |
| } |
| a9list: [ |
| { |
| 9 |
| }, |
| ] |
| a9: { |
| b: { |
| c: { |
| for _, x in 〈3;let A9〉 { |
| v: 909 |
| } |
| } |
| } |
| } |
| incompleteLet: { |
| input: [ |
| 1, |
| 2, |
| 3, |
| 4, |
| 5, |
| ] |
| last: { |
| min: 〈import;list〉.Min(〈1;input〉) |
| max: 〈import;list〉.Max(〈1;input〉) |
| } |
| bar: { |
| min: 〈0;let mn〉 |
| max: 〈0;let mx〉 |
| } |
| x: { |
| if (〈import;list〉.max < 0) {} |
| } |
| } |
| cycles: { |
| a: { |
| out: 〈0;let A〉 |
| } |
| b: { |
| out: 〈0;let A〉 |
| } |
| issue1042: { |
| #FullAdder: { |
| a: bool |
| b: bool |
| c: bool |
| sum: bool |
| carry: bool |
| } |
| #Add16: { |
| a: ([ |
| bool, |
| ] * 16) |
| b: ([ |
| bool, |
| ] * 16) |
| out: ([ |
| bool, |
| ] * 16) |
| out: [ |
| for _, i in 〈import;list〉.Range(0, 4, 1) { |
| 〈2;let fulladders〉[〈1;i〉].sum |
| }, |
| ] |
| } |
| } |
| } |
| } |
| -- out/eval -- |
| cycles.a.let[].c.c: cyclic references in let clause or alias: |
| ./in.cue:68:18 |
| cycles.b.let[].c.c: cyclic references in let clause or alias: |
| ./in.cue:74:18 |
| cycles.issue1042.#Add16.let[].for[].c.for[].for[].c: cyclic references in let clause or alias: |
| ./in.cue:97:50 |