cuelang.org/go@v0.10.1/cue/testdata/eval/discontinuous.txtar (about)

     1  This test tests a case where a child node needs to be evaluated
     2  before evaluating a parent has completed.
     3  
     4  -- in.cue --
     5  a: [for c in foo.bar.baz {
     6  	c
     7  }]
     8  
     9  a: [{name: "http"}]
    10  
    11  foo: {
    12  	x.D
    13  
    14  	bar: baz: [{port: 8080}]
    15  }
    16  
    17  x: {
    18  	D: bar: DSpec
    19  	DSpec: {}
    20  }
    21  -- out/compile --
    22  --- in.cue
    23  {
    24    a: [
    25      for _, c in 〈1;foo〉.bar.baz {
    26        〈1;c〉
    27      },
    28    ]
    29    a: [
    30      {
    31        name: "http"
    32      },
    33    ]
    34    foo: {
    35      〈1;x〉.D
    36      bar: {
    37        baz: [
    38          {
    39            port: 8080
    40          },
    41        ]
    42      }
    43    }
    44    x: {
    45      D: {
    46        bar: 〈1;DSpec〉
    47      }
    48      DSpec: {}
    49    }
    50  }
    51  -- out/eval/stats --
    52  Leaks:  0
    53  Freed:  14
    54  Reused: 5
    55  Allocs: 9
    56  Retain: 9
    57  
    58  Unifications: 14
    59  Conjuncts:    23
    60  Disjuncts:    23
    61  -- out/evalalpha --
    62  (struct){
    63    a: (#list){
    64      0: (struct){
    65        name: (string){ "http" }
    66        port: (int){ 8080 }
    67      }
    68    }
    69    foo: (struct){
    70      bar: (struct){
    71        baz: (#list){
    72          0: (struct){
    73            port: (int){ 8080 }
    74          }
    75        }
    76      }
    77    }
    78    x: (struct){
    79      D: (struct){
    80        bar: (struct){
    81        }
    82      }
    83      DSpec: (struct){
    84      }
    85    }
    86  }
    87  -- diff/-out/evalalpha<==>+out/eval --
    88  diff old new
    89  --- old
    90  +++ new
    91  @@ -1,8 +1,8 @@
    92   (struct){
    93     a: (#list){
    94       0: (struct){
    95  -      port: (int){ 8080 }
    96         name: (string){ "http" }
    97  +      port: (int){ 8080 }
    98       }
    99     }
   100     foo: (struct){
   101  -- diff/explanation --
   102  Reordering.
   103  -- out/eval --
   104  (struct){
   105    a: (#list){
   106      0: (struct){
   107        port: (int){ 8080 }
   108        name: (string){ "http" }
   109      }
   110    }
   111    foo: (struct){
   112      bar: (struct){
   113        baz: (#list){
   114          0: (struct){
   115            port: (int){ 8080 }
   116          }
   117        }
   118      }
   119    }
   120    x: (struct){
   121      D: (struct){
   122        bar: (struct){
   123        }
   124      }
   125      DSpec: (struct){
   126      }
   127    }
   128  }