cuelang.org/go@v0.10.1/cue/testdata/interpolation/issue487.txtar (about)

     1  -- in.cue --
     2  t1: {
     3  	#R: {
     4  		pos:  uint
     5  		name: "hello_\(pos)"
     6  	}
     7  	a: #R & {pos: 67}
     8  }
     9  t2: {
    10  	#R: {
    11  		pos:  string
    12  		name: "hello_\(pos)"
    13  	}
    14  	a: #R & {pos: "a"}
    15  }
    16  -- out/eval/stats --
    17  Leaks:  0
    18  Freed:  15
    19  Reused: 11
    20  Allocs: 4
    21  Retain: 0
    22  
    23  Unifications: 15
    24  Conjuncts:    29
    25  Disjuncts:    15
    26  -- out/eval --
    27  (struct){
    28    t1: (struct){
    29      #R: (#struct){
    30        pos: (int){ &(>=0, int) }
    31        name: (_|_){
    32          // [incomplete] t1.#R.name: invalid interpolation: non-concrete value >=0 & int (type int):
    33          //     ./in.cue:4:9
    34        }
    35      }
    36      a: (#struct){
    37        pos: (int){ 67 }
    38        name: (string){ "hello_67" }
    39      }
    40    }
    41    t2: (struct){
    42      #R: (#struct){
    43        pos: (string){ string }
    44        name: (_|_){
    45          // [incomplete] t2.#R.name: invalid interpolation: non-concrete value string (type string):
    46          //     ./in.cue:11:9
    47          //     ./in.cue:10:9
    48        }
    49      }
    50      a: (#struct){
    51        pos: (string){ "a" }
    52        name: (string){ "hello_a" }
    53      }
    54    }
    55  }
    56  -- out/compile --
    57  --- in.cue
    58  {
    59    t1: {
    60      #R: {
    61        pos: &(int, >=0)
    62        name: "hello_\(〈0;pos〉)"
    63      }
    64      a: (〈0;#R〉 & {
    65        pos: 67
    66      })
    67    }
    68    t2: {
    69      #R: {
    70        pos: string
    71        name: "hello_\(〈0;pos〉)"
    72      }
    73      a: (〈0;#R〉 & {
    74        pos: "a"
    75      })
    76    }
    77  }