| # DO NOT EDIT; generated by go run testdata/gen.go |
| # |
| #name: reentrance |
| #evalFull |
| -- in.cue -- |
| // This indirection is needed to avoid binding references to fib |
| // within fib to the instantiated version. |
| fibRec: {nn: int, out: (fib & {n: nn}).out} |
| fib: { |
| n: int |
| |
| if n >= 2 { |
| out: (fibRec & {nn: n - 2}).out + (fibRec & {nn: n - 1}).out |
| } |
| if n < 2 { |
| out: n |
| } |
| } |
| fib2: (fib & {n: 2}).out |
| fib7: (fib & {n: 7}).out |
| fib12: (fib & {n: 12}).out |
| -- out/def -- |
| // This indirection is needed to avoid binding references to fib |
| // within fib to the instantiated version. |
| fibRec: { |
| nn: int |
| out: (fib & { |
| n: nn |
| }).out |
| } |
| fib: { |
| n: int |
| if n >= 2 { |
| out: (fibRec & { |
| nn: n - 2 |
| }).out + (fibRec & { |
| nn: n - 1 |
| }).out |
| } |
| if n < 2 { |
| out: n |
| } |
| } |
| fib2: 1 |
| fib7: 13 |
| fib12: 144 |
| -- out/legacy-debug -- |
| <0>{fibRec: <1>{nn: int, out: (<2>.fib & <3>{n: <4>.nn}).out}, fib: <5>{n: int if (<6>.n >= 2) yield <7>{out: ((<2>.fibRec & <8>{nn: (<6>.n - 2)}).out + (<2>.fibRec & <9>{nn: (<6>.n - 1)}).out)}, if (<6>.n < 2) yield <10>{out: <6>.n}}, fib2: 1, fib7: 13, fib12: 144} |
| -- out/compile -- |
| --- in.cue |
| { |
| fibRec: { |
| nn: int |
| out: (〈1;fib〉 & { |
| n: 〈1;nn〉 |
| }).out |
| } |
| fib: { |
| n: int |
| if (〈0;n〉 >= 2) { |
| out: ((〈2;fibRec〉 & { |
| nn: (〈2;n〉 - 2) |
| }).out + (〈2;fibRec〉 & { |
| nn: (〈2;n〉 - 1) |
| }).out) |
| } |
| if (〈0;n〉 < 2) { |
| out: 〈1;n〉 |
| } |
| } |
| fib2: (〈0;fib〉 & { |
| n: 2 |
| }).out |
| fib7: (〈0;fib〉 & { |
| n: 7 |
| }).out |
| fib12: (〈0;fib〉 & { |
| n: 12 |
| }).out |
| } |
| -- out/eval -- |
| Errors: |
| structural cycle: |
| ./in.cue:8:9 |
| |
| Result: |
| (_|_){ |
| // [structural cycle] |
| fibRec: (struct){ |
| nn: (int){ int } |
| out: (_|_){ |
| // [incomplete] non-concrete value int in operand to >=: |
| // ./in.cue:7:5 |
| // ./in.cue:3:32 |
| // ./in.cue:5:2 |
| // non-concrete value int in operand to <: |
| // ./in.cue:10:5 |
| // ./in.cue:3:32 |
| // ./in.cue:5:2 |
| } |
| } |
| fib: (_|_){ |
| // [incomplete] fib: non-concrete value int in operand to >=: |
| // ./in.cue:7:5 |
| // ./in.cue:5:2 |
| // fib: non-concrete value int in operand to <: |
| // ./in.cue:10:5 |
| // ./in.cue:5:2 |
| n: (int){ int } |
| } |
| fib2: (int){ 1 } |
| fib7: (_|_){ |
| // [structural cycle] structural cycle: |
| // ./in.cue:8:9 |
| } |
| fib12: (_|_){ |
| // [structural cycle] structural cycle: |
| // ./in.cue:8:9 |
| } |
| } |