...
1exec cue eval ./pkg:foo
2
3-- cue.mod/module.cue --
4module: "mod.test"
5-- in.cue --
6package foo
7
8import "mod.test/pkg"
9
10#def: {
11 _name: d: int
12}
13
14d: pkg.#D & {_name: d: int, _val: f: 4}
15
16// TODO: this should fail, as the _name restricting it is in this
17// package.
18e: pkg.#D & #def & {
19 // This should fail as c is disallowed by the _name defined
20 // in this package
21 _name: c: int
22
23 // This should not fail, as this is a different _val
24 _val: g: int
25}
26
27f: pkg.#D & {_val: f: 4}
28g: f._val
29-- pkg/bar.cue --
30package pkg
31
32#D: {_val: f: 3}
33-- out/eval/stats --
34Leaks: 1
35Freed: 29
36Reused: 24
37Allocs: 6
38Retain: 2
39
40Unifications: 30
41Conjuncts: 40
42Disjuncts: 31
43-- out/evalalpha --
44Errors:
45e._name.c: field not allowed:
46 ./in.cue:16:9
47
48Result:
49(_|_){
50 // [eval]
51 #def: (#struct){
52 _name(:foo): (#struct){
53 d: (int){ int }
54 }
55 }
56 d: (#struct){
57 _name(:foo): (#struct){
58 d: (int){ int }
59 }
60 _val(:foo): (#struct){
61 f: (int){ 4 }
62 }
63 _val(mod.test/pkg): (#struct){
64 f: (int){ 3 }
65 }
66 }
67 e: (_|_){
68 // [eval]
69 _name(:foo): (_|_){
70 // [eval]
71 c: (_|_){
72 // [eval] e._name.c: field not allowed:
73 // ./in.cue:16:9
74 }
75 d: (int){ int }
76 }
77 _val(:foo): (#struct){
78 g: (int){ int }
79 }
80 _val(mod.test/pkg): (#struct){
81 f: (int){ 3 }
82 }
83 }
84 f: (#struct){
85 _val(:foo): (#struct){
86 f: (int){ 4 }
87 }
88 _val(mod.test/pkg): (#struct){
89 f: (int){ 3 }
90 }
91 }
92 g: (struct){
93 f: (int){ 4 }
94 }
95}
96-- diff/-out/evalalpha<==>+out/eval --
97diff old new
98--- old
99+++ new
100@@ -1,7 +1,5 @@
101 Errors:
102 e._name.c: field not allowed:
103- ./in.cue:6:9
104- ./in.cue:13:13
105 ./in.cue:16:9
106
107 Result:
108@@ -13,41 +11,39 @@
109 }
110 }
111 d: (#struct){
112- _val(mod.test/pkg): (#struct){
113- f: (int){ 3 }
114- }
115- _name(:foo): (struct){
116- d: (int){ int }
117- }
118- _val(:foo): (struct){
119- f: (int){ 4 }
120+ _name(:foo): (#struct){
121+ d: (int){ int }
122+ }
123+ _val(:foo): (#struct){
124+ f: (int){ 4 }
125+ }
126+ _val(mod.test/pkg): (#struct){
127+ f: (int){ 3 }
128 }
129 }
130 e: (_|_){
131 // [eval]
132- _val(mod.test/pkg): (#struct){
133- f: (int){ 3 }
134- }
135 _name(:foo): (_|_){
136 // [eval]
137- d: (int){ int }
138 c: (_|_){
139 // [eval] e._name.c: field not allowed:
140- // ./in.cue:6:9
141- // ./in.cue:13:13
142 // ./in.cue:16:9
143 }
144- }
145- _val(:foo): (struct){
146+ d: (int){ int }
147+ }
148+ _val(:foo): (#struct){
149 g: (int){ int }
150 }
151+ _val(mod.test/pkg): (#struct){
152+ f: (int){ 3 }
153+ }
154 }
155 f: (#struct){
156- _val(mod.test/pkg): (#struct){
157- f: (int){ 3 }
158- }
159- _val(:foo): (struct){
160- f: (int){ 4 }
161+ _val(:foo): (#struct){
162+ f: (int){ 4 }
163+ }
164+ _val(mod.test/pkg): (#struct){
165+ f: (int){ 3 }
166 }
167 }
168 g: (struct){
169-- diff/todo/p2 --
170Reordering / missing positions.
171-- out/eval --
172Errors:
173e._name.c: field not allowed:
174 ./in.cue:6:9
175 ./in.cue:13:13
176 ./in.cue:16:9
177
178Result:
179(_|_){
180 // [eval]
181 #def: (#struct){
182 _name(:foo): (#struct){
183 d: (int){ int }
184 }
185 }
186 d: (#struct){
187 _val(mod.test/pkg): (#struct){
188 f: (int){ 3 }
189 }
190 _name(:foo): (struct){
191 d: (int){ int }
192 }
193 _val(:foo): (struct){
194 f: (int){ 4 }
195 }
196 }
197 e: (_|_){
198 // [eval]
199 _val(mod.test/pkg): (#struct){
200 f: (int){ 3 }
201 }
202 _name(:foo): (_|_){
203 // [eval]
204 d: (int){ int }
205 c: (_|_){
206 // [eval] e._name.c: field not allowed:
207 // ./in.cue:6:9
208 // ./in.cue:13:13
209 // ./in.cue:16:9
210 }
211 }
212 _val(:foo): (struct){
213 g: (int){ int }
214 }
215 }
216 f: (#struct){
217 _val(mod.test/pkg): (#struct){
218 f: (int){ 3 }
219 }
220 _val(:foo): (struct){
221 f: (int){ 4 }
222 }
223 }
224 g: (struct){
225 f: (int){ 4 }
226 }
227}
228-- out/compile --
229--- in.cue
230{
231 #def: {
232 _name: {
233 d: int
234 }
235 }
236 d: (〈import;"mod.test/pkg"〉.#D & {
237 _name: {
238 d: int
239 }
240 _val: {
241 f: 4
242 }
243 })
244 e: ((〈import;"mod.test/pkg"〉.#D & 〈0;#def〉) & {
245 _name: {
246 c: int
247 }
248 _val: {
249 g: int
250 }
251 })
252 f: (〈import;"mod.test/pkg"〉.#D & {
253 _val: {
254 f: 4
255 }
256 })
257 g: 〈0;f〉._val
258}
View as plain text