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

     1  -- in.cue --
     2  structShorthand: X={b: 3, c: X.b}
     3  
     4  // Note that X and Y are subtly different, as they have different bindings:
     5  // one binds to the field, the other to the value. In this case, that does not
     6  // make a difference.
     7  fieldAndValue: X=foo: Y={ 3, #sum: X + Y }
     8  
     9  valueCycle: b: X=3+X
    10  
    11  -- out/eval --
    12  (struct){
    13    structShorthand: (struct){
    14      b: (int){ 3 }
    15      c: (int){ 3 }
    16    }
    17    fieldAndValue: (struct){
    18      foo: (int){
    19        3
    20        #sum: (int){ 6 }
    21      }
    22    }
    23    valueCycle: (struct){
    24      b: (_|_){
    25        // [cycle] cycle error:
    26        //     ./in.cue:8:18
    27      }
    28    }
    29  }
    30  -- out/compile --
    31  --- in.cue
    32  {
    33    structShorthand: {
    34      b: 3
    35      c: 〈1〉.b
    36    }
    37    fieldAndValue: {
    38      foo: {
    39        3
    40        #sum: (〈1;foo〉 + 〈1〉)
    41      }
    42    }
    43    valueCycle: {
    44      b: (3 + 〈0〉)
    45    }
    46  }