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

     1  -- in.cue --
     2  a: "foo"
     3  "\(a)": b: c: d: e
     4  e: 2
     5  
     6  b: "bar"
     7  X="\(b)": {
     8  	a: 1
     9  }
    10  c: X
    11  
    12  withError: {
    13      issue799: {key: int32} & {"\(1&2)": 123}
    14  }
    15  
    16  parenExprRefParent: {
    17    a: (x): {}
    18    x: "foo"
    19  }
    20  parenExprRefEqual: {
    21    (x): {}
    22    x: "foo"
    23  }
    24  -- out/eval --
    25  Errors:
    26  invalid interpolation: conflicting values 2 and 1:
    27      ./in.cue:12:31
    28      ./in.cue:12:34
    29      ./in.cue:12:36
    30  
    31  Result:
    32  (_|_){
    33    // [eval]
    34    a: (string){ "foo" }
    35    e: (int){ 2 }
    36    b: (string){ "bar" }
    37    c: (struct){
    38      a: (int){ 1 }
    39    }
    40    withError: (_|_){
    41      // [eval]
    42      issue799: (_|_){
    43        // [eval] invalid interpolation: conflicting values 2 and 1:
    44        //     ./in.cue:12:31
    45        //     ./in.cue:12:34
    46        //     ./in.cue:12:36
    47        key: (int){ &(>=-2147483648, <=2147483647, int) }
    48      }
    49    }
    50    parenExprRefParent: (struct){
    51      a: (struct){
    52        foo: (struct){
    53        }
    54      }
    55      x: (string){ "foo" }
    56    }
    57    parenExprRefEqual: (struct){
    58      x: (string){ "foo" }
    59      foo: (struct){
    60      }
    61    }
    62    foo: (struct){
    63      b: (struct){
    64        c: (struct){
    65          d: (int){ 2 }
    66        }
    67      }
    68    }
    69    bar: (struct){
    70      a: (int){ 1 }
    71    }
    72  }
    73  -- out/compile --
    74  --- in.cue
    75  {
    76    a: "foo"
    77    "\(〈0;a〉)": {
    78      b: {
    79        c: {
    80          d: 〈3;e〉
    81        }
    82      }
    83    }
    84    e: 2
    85    b: "bar"
    86    "\(〈0;b〉)": {
    87      a: 1
    88    }
    89    c: 〈0;("\(〈0;b〉)")〉
    90    withError: {
    91      issue799: ({
    92        key: &(int, >=-2147483648, <=2147483647)
    93      } & {
    94        "\((1 & 2))": 123
    95      })
    96    }
    97    parenExprRefParent: {
    98      a: {
    99        〈1;x〉: {}
   100      }
   101      x: "foo"
   102    }
   103    parenExprRefEqual: {
   104      〈0;x〉: {}
   105      x: "foo"
   106    }
   107  }