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

     1  // Treat fields of different files as belonging to the same struct.
     2  // This means that a closed embedding in one file should not restrict the
     3  // fields of another.
     4  
     5  -- in.cue --
     6  package foo
     7  
     8  #theme: {
     9  	color:   string
    10  	ctermbg: string
    11  }
    12  dark: #theme & {
    13  	color:   "dark"
    14  	ctermbg: "239"
    15  }
    16  light: #theme & {
    17  	color:   "light"
    18  	ctermbg: "254"
    19  }
    20  #Config: {
    21  	console: dark | *light
    22  }
    23  
    24  -- box.cue --
    25  package foo
    26  
    27  #Config & {
    28  	console: dark
    29  }
    30  
    31  -- out/eval --
    32  (#struct){
    33    #theme: (#struct){
    34      color: (string){ string }
    35      ctermbg: (string){ string }
    36    }
    37    dark: (#struct){
    38      color: (string){ "dark" }
    39      ctermbg: (string){ "239" }
    40    }
    41    light: (#struct){
    42      color: (string){ "light" }
    43      ctermbg: (string){ "254" }
    44    }
    45    #Config: (#struct){
    46      console: (#struct){ |(*(#struct){
    47          color: (string){ "light" }
    48          ctermbg: (string){ "254" }
    49        }, (#struct){
    50          color: (string){ "dark" }
    51          ctermbg: (string){ "239" }
    52        }) }
    53    }
    54    console: (#struct){
    55      color: (string){ "dark" }
    56      ctermbg: (string){ "239" }
    57    }
    58  }
    59  -- out/compile --
    60  --- in.cue
    61  {
    62    #theme: {
    63      color: string
    64      ctermbg: string
    65    }
    66    dark: (〈0;#theme〉 & {
    67      color: "dark"
    68      ctermbg: "239"
    69    })
    70    light: (〈0;#theme〉 & {
    71      color: "light"
    72      ctermbg: "254"
    73    })
    74    #Config: {
    75      console: (〈1;dark〉|*〈1;light〉)
    76    }
    77  }
    78  --- box.cue
    79  {
    80    (〈0;#Config〉 & {
    81      console: 〈1;dark〉
    82    })
    83  }