cuelang.org/go@v0.10.1/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  -- out/eval/stats --
    33  Leaks:  1
    34  Freed:  17
    35  Reused: 14
    36  Allocs: 4
    37  Retain: 1
    38  
    39  Unifications: 18
    40  Conjuncts:    26
    41  Disjuncts:    18
    42  -- out/eval --
    43  Errors:
    44  incompleteIndex.a: invalid index top (invalid type _):
    45      ./in.cue:29:7
    46      ./in.cue:29:11
    47  
    48  Result:
    49  (_|_){
    50    // [eval]
    51    comprehensions: (struct){
    52      a: (struct){
    53      }
    54      b: (_|_){
    55        // [incomplete] comprehensions.b: undefined field: b:
    56        //     ./in.cue:4:8
    57      }
    58      c: (_|_){
    59        // [incomplete] comprehensions.c: undefined field: b:
    60        //     ./in.cue:8:14
    61      }
    62    }
    63    openStruct: (struct){
    64      a: (struct){
    65      }
    66      b: (_|_){
    67        // [incomplete] openStruct.b: undefined field: c:
    68        //     ./in.cue:14:7
    69      }
    70    }
    71    selectFromTop: (struct){
    72      top: (_){ _ }
    73      a: (_|_){
    74        // [incomplete] selectFromTop.a: top.foo undefined as top is incomplete (type _):
    75        //     ./in.cue:19:7
    76      }
    77    }
    78    indexOnTop: (struct){
    79      top: (_){ _ }
    80      a: (_|_){
    81        // [incomplete] indexOnTop.a: top[2] undefined as top is incomplete (type _):
    82        //     ./in.cue:24:7
    83      }
    84    }
    85    incompleteIndex: (_|_){
    86      // [eval]
    87      top: (_){ _ }
    88      a: (_|_){
    89        // [eval] incompleteIndex.a: invalid index top (invalid type _):
    90        //     ./in.cue:29:7
    91        //     ./in.cue:29:11
    92      }
    93    }
    94  }
    95  -- out/compile --
    96  --- in.cue
    97  {
    98    comprehensions: {
    99      a: {}
   100      b: {
   101        if 〈1;a〉.b {}
   102      }
   103      c: {
   104        for _, x in 〈1;a〉.b {
   105          〈1;x〉
   106        }
   107      }
   108    }
   109    openStruct: {
   110      a: {}
   111      b: 〈0;a〉.c
   112    }
   113    selectFromTop: {
   114      top: _
   115      a: 〈0;top〉.foo
   116    }
   117    indexOnTop: {
   118      top: _
   119      a: 〈0;top〉[2]
   120    }
   121    incompleteIndex: {
   122      top: _
   123      a: [
   124        1,
   125      ][〈0;top〉]
   126    }
   127  }