...

Text file src/cuelang.org/go/cue/testdata/definitions/comprehensions.txtar

Documentation: cuelang.org/go/cue/testdata/definitions

     1-- in.cue --
     2issue595: {
     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 --
    13Leaks:  0
    14Freed:  6
    15Reused: 1
    16Allocs: 5
    17Retain: 0
    18
    19Unifications: 6
    20Conjuncts:    6
    21Disjuncts:    6
    22-- out/eval --
    23Errors:
    24issue595.files: undefined field: nam:
    25    ./in.cue:8:14
    26
    27Result:
    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}

View as plain text