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

     1  -- in.cue --
     2  issue595: {
     3      // NOTE: this should eval with an EVAL error, not
     4      // an incomplete error. See Issue #595.
     5      #cfgs: [{
     6          name: "foo"
     7      }]
     8      for cfg in #cfgs {
     9          files: cfg.nam
    10      }
    11  }
    12  -- out/eval --
    13  Errors:
    14  issue595.files: undefined field: nam:
    15      ./in.cue:8:20
    16  
    17  Result:
    18  (_|_){
    19    // [eval]
    20    issue595: (_|_){
    21      // [eval]
    22      #cfgs: (#list){
    23        0: (#struct){
    24          name: (string){ "foo" }
    25        }
    26      }
    27      files: (_|_){
    28        // [eval] issue595.files: undefined field: nam:
    29        //     ./in.cue:8:20
    30      }
    31    }
    32  }
    33  -- out/compile --
    34  --- in.cue
    35  {
    36    issue595: {
    37      #cfgs: [
    38        {
    39          name: "foo"
    40        },
    41      ]
    42      for _, cfg in 〈0;#cfgs〉 {
    43        files: 〈1;cfg〉.nam
    44      }
    45    }
    46  }