cuelang.org/go@v0.10.1/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/stats --
    13  Leaks:  0
    14  Freed:  6
    15  Reused: 1
    16  Allocs: 5
    17  Retain: 0
    18  
    19  Unifications: 6
    20  Conjuncts:    6
    21  Disjuncts:    6
    22  -- out/eval --
    23  Errors:
    24  issue595.files: undefined field: nam:
    25      ./in.cue:8:14
    26  
    27  Result:
    28  (_|_){
    29    // [eval]
    30    issue595: (_|_){
    31      // [eval]
    32      #cfgs: (#list){
    33        0: (#struct){
    34          name: (string){ "foo" }
    35        }
    36      }
    37      files: (_|_){
    38        // [eval] issue595.files: undefined field: nam:
    39        //     ./in.cue:8:14
    40      }
    41    }
    42  }
    43  -- out/compile --
    44  --- in.cue
    45  {
    46    issue595: {
    47      #cfgs: [
    48        {
    49          name: "foo"
    50        },
    51      ]
    52      for _, cfg in 〈0;#cfgs〉 {
    53        files: 〈1;cfg〉.nam
    54      }
    55    }
    56  }