github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/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 --
    17  (struct){
    18    t1: (struct){
    19      #R: (#struct){
    20        pos: (int){ &(>=0, int) }
    21        name: (_|_){
    22          // [incomplete] t1.#R.name: invalid interpolation: non-concrete value >=0 & int (type int):
    23          //     ./in.cue:4:9
    24        }
    25      }
    26      a: (#struct){
    27        pos: (int){ 67 }
    28        name: (string){ "hello_67" }
    29      }
    30    }
    31    t2: (struct){
    32      #R: (#struct){
    33        pos: (string){ string }
    34        name: (_|_){
    35          // [incomplete] t2.#R.name: invalid interpolation: non-concrete value string (type string):
    36          //     ./in.cue:11:9
    37          //     ./in.cue:10:9
    38        }
    39      }
    40      a: (#struct){
    41        pos: (string){ "a" }
    42        name: (string){ "hello_a" }
    43      }
    44    }
    45  }
    46  -- out/compile --
    47  --- in.cue
    48  {
    49    t1: {
    50      #R: {
    51        pos: &(int, >=0)
    52        name: "hello_\(〈0;pos〉)"
    53      }
    54      a: (〈0;#R〉 & {
    55        pos: 67
    56      })
    57    }
    58    t2: {
    59      #R: {
    60        pos: string
    61        name: "hello_\(〈0;pos〉)"
    62      }
    63      a: (〈0;#R〉 & {
    64        pos: "a"
    65      })
    66    }
    67  }