github.com/solo-io/cue@v0.4.7/cue/testdata/references/incomplete.txtar (about)

     1  -- in.cue --
     2  comprehensions: {
     3      a: {}
     4      b: {
     5          if a.b {
     6          }
     7      }
     8      c: {
     9          for x in a.b { x }
    10      }
    11  }
    12  
    13  openStruct: {
    14      a: {}
    15      b: a.c
    16  }
    17  
    18  selectFromTop: {
    19      top: _
    20      a: top.foo
    21  }
    22  
    23  indexOnTop: {
    24      top: _
    25      a: top[2]
    26  }
    27  
    28  incompleteIndex: {
    29      top: _
    30      a: [1][top]
    31  }
    32  
    33  -- out/eval --
    34  Errors:
    35  incompleteIndex.a: invalid index top (invalid type _):
    36      ./in.cue:29:8
    37      ./in.cue:29:12
    38  
    39  Result:
    40  (_|_){
    41    // [eval]
    42    comprehensions: (struct){
    43      a: (struct){
    44      }
    45      b: (_|_){
    46        // [incomplete] comprehensions.b: undefined field: b:
    47        //     ./in.cue:4:14
    48      }
    49      c: (_|_){
    50        // [incomplete] comprehensions.c: undefined field: b:
    51        //     ./in.cue:8:20
    52      }
    53    }
    54    openStruct: (struct){
    55      a: (struct){
    56      }
    57      b: (_|_){
    58        // [incomplete] openStruct.b: undefined field: c:
    59        //     ./in.cue:14:10
    60      }
    61    }
    62    selectFromTop: (struct){
    63      top: (_){ _ }
    64      a: (_|_){
    65        // [incomplete] selectFromTop.a: top.foo undefined as top is incomplete (type _):
    66        //     ./in.cue:19:8
    67      }
    68    }
    69    indexOnTop: (struct){
    70      top: (_){ _ }
    71      a: (_|_){
    72        // [incomplete] indexOnTop.a: top[2] undefined as top is incomplete (type _):
    73        //     ./in.cue:24:8
    74      }
    75    }
    76    incompleteIndex: (_|_){
    77      // [eval]
    78      top: (_){ _ }
    79      a: (_|_){
    80        // [eval] incompleteIndex.a: invalid index top (invalid type _):
    81        //     ./in.cue:29:8
    82        //     ./in.cue:29:12
    83      }
    84    }
    85  }
    86  -- out/compile --
    87  --- in.cue
    88  {
    89    comprehensions: {
    90      a: {}
    91      b: {
    92        if 〈1;a〉.b {}
    93      }
    94      c: {
    95        for _, x in 〈1;a〉.b {
    96          〈1;x〉
    97        }
    98      }
    99    }
   100    openStruct: {
   101      a: {}
   102      b: 〈0;a〉.c
   103    }
   104    selectFromTop: {
   105      top: _
   106      a: 〈0;top〉.foo
   107    }
   108    indexOnTop: {
   109      top: _
   110      a: 〈0;top〉[2]
   111    }
   112    incompleteIndex: {
   113      top: _
   114      a: [
   115        1,
   116      ][〈0;top〉]
   117    }
   118  }