| -- in.cue -- |
| comprehensions: { |
| a: {} |
| b: { |
| if a.b { |
| } |
| } |
| c: { |
| for x in a.b { x } |
| } |
| } |
| |
| openStruct: { |
| a: {} |
| b: a.c |
| } |
| |
| selectFromTop: { |
| top: _ |
| a: top.foo |
| } |
| |
| indexOnTop: { |
| top: _ |
| a: top[2] |
| } |
| |
| incompleteIndex: { |
| top: _ |
| a: [1][top] |
| } |
| |
| -- out/eval -- |
| Errors: |
| incompleteIndex.a: invalid index top (invalid type _): |
| ./in.cue:29:8 |
| ./in.cue:29:12 |
| |
| Result: |
| (_|_){ |
| // [eval] |
| comprehensions: (struct){ |
| a: (struct){ |
| } |
| b: (_|_){ |
| // [incomplete] comprehensions.b: undefined field: b: |
| // ./in.cue:4:14 |
| } |
| c: (_|_){ |
| // [incomplete] comprehensions.c: undefined field: b: |
| // ./in.cue:8:20 |
| } |
| } |
| openStruct: (struct){ |
| a: (struct){ |
| } |
| b: (_|_){ |
| // [incomplete] openStruct.b: undefined field: c: |
| // ./in.cue:14:10 |
| } |
| } |
| selectFromTop: (struct){ |
| top: (_){ _ } |
| a: (_|_){ |
| // [incomplete] selectFromTop.a: top.foo undefined as top is incomplete (type _): |
| // ./in.cue:19:8 |
| } |
| } |
| indexOnTop: (struct){ |
| top: (_){ _ } |
| a: (_|_){ |
| // [incomplete] indexOnTop.a: top[2] undefined as top is incomplete (type _): |
| // ./in.cue:24:8 |
| } |
| } |
| incompleteIndex: (_|_){ |
| // [eval] |
| top: (_){ _ } |
| a: (_|_){ |
| // [eval] incompleteIndex.a: invalid index top (invalid type _): |
| // ./in.cue:29:8 |
| // ./in.cue:29:12 |
| } |
| } |
| } |
| -- out/compile -- |
| --- in.cue |
| { |
| comprehensions: { |
| a: {} |
| b: { |
| if 〈1;a〉.b {} |
| } |
| c: { |
| for _, x in 〈1;a〉.b { |
| 〈1;x〉 |
| } |
| } |
| } |
| openStruct: { |
| a: {} |
| b: 〈0;a〉.c |
| } |
| selectFromTop: { |
| top: _ |
| a: 〈0;top〉.foo |
| } |
| indexOnTop: { |
| top: _ |
| a: 〈0;top〉[2] |
| } |
| incompleteIndex: { |
| top: _ |
| a: [ |
| 1, |
| ][〈0;top〉] |
| } |
| } |