cuelang.org/go@v0.13.0/cue/testdata/interpolation/041_interpolation.txtar (about)

     1  #name: interpolation
     2  #evalPartial
     3  -- in.cue --
     4  a: "\(4)"
     5  b: "one \(a) two \( a+c )"
     6  c: "one"
     7  d: "\(r)"
     8  u: "\(_)"
     9  r: _
    10  e: "\([])"
    11  -- out/def --
    12  a: "4"
    13  b: "one 4 two 4one"
    14  c: "one"
    15  d: "\(r)"
    16  r: _
    17  u: "\(_)"
    18  e: _|_ // expression in interpolation must evaluate to a number kind or string (found list)
    19  -- out/legacy-debug --
    20  <0>{a: "4", b: "one 4 two 4one", c: "one", d: ""+<1>.r+"", r: _, u: ""+_+"", e: _|_([]:expression in interpolation must evaluate to a number kind or string (found list))}
    21  -- out/compile --
    22  --- in.cue
    23  {
    24    a: "\(4)"
    25    b: "one \(〈0;a〉) two \((〈0;a〉 + 〈0;c〉))"
    26    c: "one"
    27    d: "\(〈0;r〉)"
    28    u: "\(_)"
    29    r: _
    30    e: "\([])"
    31  }
    32  -- out/eval/stats --
    33  Leaks:  1
    34  Freed:  8
    35  Reused: 6
    36  Allocs: 3
    37  Retain: 12
    38  
    39  Unifications: 9
    40  Conjuncts:    16
    41  Disjuncts:    19
    42  -- out/eval --
    43  Errors:
    44  e: invalid interpolation: cannot use [] (type list) as type (bool|string|bytes|number):
    45      ./in.cue:7:4
    46      ./in.cue:7:7
    47  
    48  Result:
    49  (_|_){
    50    // [eval]
    51    a: (string){ "4" }
    52    b: (string){ "one 4 two 4one" }
    53    c: (string){ "one" }
    54    d: (_|_){
    55      // [incomplete] d: invalid interpolation: non-concrete value _ (type _):
    56      //     ./in.cue:4:4
    57    }
    58    u: (_|_){
    59      // [incomplete] u: invalid interpolation: non-concrete value _ (type _):
    60      //     ./in.cue:5:4
    61      //     ./in.cue:5:7
    62    }
    63    r: (_){ _ }
    64    e: (_|_){
    65      // [eval] e: invalid interpolation: cannot use [] (type list) as type (bool|string|bytes|number):
    66      //     ./in.cue:7:4
    67      //     ./in.cue:7:7
    68    }
    69  }