...
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 --
6package foo
7
8#theme: {
9 color: string
10 ctermbg: string
11}
12dark: #theme & {
13 color: "dark"
14 ctermbg: "239"
15}
16light: #theme & {
17 color: "light"
18 ctermbg: "254"
19}
20#Config: {
21 console: dark | *light
22}
23-- box.cue --
24package foo
25
26#Config & {
27 console: dark
28}
29-- out/eval/stats --
30Leaks: 0
31Freed: 25
32Reused: 19
33Allocs: 6
34Retain: 1
35
36Unifications: 21
37Conjuncts: 69
38Disjuncts: 26
39-- out/eval --
40(#struct){
41 #theme: (#struct){
42 color: (string){ string }
43 ctermbg: (string){ string }
44 }
45 dark: (#struct){
46 color: (string){ "dark" }
47 ctermbg: (string){ "239" }
48 }
49 light: (#struct){
50 color: (string){ "light" }
51 ctermbg: (string){ "254" }
52 }
53 #Config: (#struct){
54 console: (#struct){ |(*(#struct){
55 color: (string){ "light" }
56 ctermbg: (string){ "254" }
57 }, (#struct){
58 color: (string){ "dark" }
59 ctermbg: (string){ "239" }
60 }) }
61 }
62 console: (#struct){
63 color: (string){ "dark" }
64 ctermbg: (string){ "239" }
65 }
66}
67-- out/compile --
68--- box.cue
69{
70 (〈0;#Config〉 & {
71 console: 〈1;dark〉
72 })
73}
74--- in.cue
75{
76 #theme: {
77 color: string
78 ctermbg: string
79 }
80 dark: (〈0;#theme〉 & {
81 color: "dark"
82 ctermbg: "239"
83 })
84 light: (〈0;#theme〉 & {
85 color: "light"
86 ctermbg: "254"
87 })
88 #Config: {
89 console: (〈1;dark〉|*〈1;light〉)
90 }
91}
View as plain text