github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/cue/testdata/eval/issue285.txtar (about)

     1  -- in.cue --
     2  #TopLevel: [name=string]: {
     3  	path:    string
     4  	content: string
     5  }
     6  
     7  #Mid: #TopLevel & {
     8  	myoutput: path: "/output"
     9  }
    10  
    11  val: #Mid & {} & {myoutput: {content: "foo"}} // Should work.
    12  -- out/eval --
    13  (struct){
    14    #TopLevel: (#struct){
    15    }
    16    #Mid: (#struct){
    17      myoutput: (#struct){
    18        path: (string){ "/output" }
    19        content: (string){ string }
    20      }
    21    }
    22    val: (#struct){
    23      myoutput: (#struct){
    24        path: (string){ "/output" }
    25        content: (string){ "foo" }
    26      }
    27    }
    28  }
    29  -- out/compile --
    30  --- in.cue
    31  {
    32    #TopLevel: {
    33      [string]: {
    34        path: string
    35        content: string
    36      }
    37    }
    38    #Mid: (〈0;#TopLevel〉 & {
    39      myoutput: {
    40        path: "/output"
    41      }
    42    })
    43    val: ((〈0;#Mid〉 & {}) & {
    44      myoutput: {
    45        content: "foo"
    46      }
    47    })
    48  }