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

     1  Issue #560
     2  
     3  -- cue.mod/module.cue --
     4  module: "example.com"
     5  
     6  -- in.cue --
     7  import "strings"
     8  
     9  #User: {
    10      tags_str: string
    11      tags_map: {
    12           for k, v in strings.Split(tags_str, " ") {
    13               "\(v)": string
    14           }
    15           "{a}": string
    16      }
    17  }
    18  
    19  user: {
    20      #User
    21      tags_str: "b {c}"
    22  }
    23  -- out/eval --
    24  (struct){
    25    #User: (#struct){
    26      tags_str: (string){ string }
    27      tags_map: (_|_){
    28        // [incomplete] error in call to strings.Split: non-concrete value string:
    29        //     ./in.cue:6:22
    30        "{a}": (string){ string }
    31      }
    32    }
    33    user: (#struct){
    34      tags_str: (string){ "b {c}" }
    35      tags_map: (#struct){
    36        "{a}": (string){ string }
    37        b: (string){ string }
    38        "{c}": (string){ string }
    39      }
    40    }
    41  }
    42  -- out/compile --
    43  --- in.cue
    44  {
    45    #User: {
    46      tags_str: string
    47      tags_map: {
    48        for k, v in 〈import;strings〉.Split(〈1;tags_str〉, " ") {
    49          "\(〈1;v〉)": string
    50        }
    51        "{a}": string
    52      }
    53    }
    54    user: {
    55      〈1;#User〉
    56      tags_str: "b {c}"
    57    }
    58  }