...
1# DO NOT EDIT; generated by go run testdata/gen.go
2#
3#name: definitions with disjunctions
4#evalPartial
5-- in.cue --
6#Foo: {
7 field: int
8
9 {a: 1} |
10 {b: 2}
11}
12
13foo: #Foo
14foo: {a: 1}
15
16bar: #Foo
17bar: {c: 2}
18
19baz: #Foo
20baz: {b: 2}
21-- out/def --
22#Foo: {
23 field: int
24 a: 1
25} | {
26 field: int
27 b: 2
28}
29foo: #Foo & {
30 a: 1
31}
32bar: _|_ //
33baz: #Foo & {
34 b: 2
35}
36-- out/legacy-debug --
37<0>{#Foo: (<1>C{field: int, a: 1} | <2>C{field: int, b: 2}), foo: <3>C{field: int, a: 1}, bar: _|_(2:empty disjunction: field "c" not allowed in closed struct), baz: <4>C{field: int, b: 2}}
38-- out/compile --
39--- in.cue
40{
41 #Foo: {
42 field: int
43 ({
44 a: 1
45 }|{
46 b: 2
47 })
48 }
49 foo: 〈0;#Foo〉
50 foo: {
51 a: 1
52 }
53 bar: 〈0;#Foo〉
54 bar: {
55 c: 2
56 }
57 baz: 〈0;#Foo〉
58 baz: {
59 b: 2
60 }
61}
62-- out/eval/stats --
63Leaks: 0
64Freed: 33
65Reused: 28
66Allocs: 5
67Retain: 0
68
69Unifications: 25
70Conjuncts: 45
71Disjuncts: 33
72-- out/eval --
73Errors:
74bar.c: field not allowed:
75 ./in.cue:1:7
76 ./in.cue:4:2
77 ./in.cue:11:6
78 ./in.cue:12:7
79
80Result:
81(_|_){
82 // [eval]
83 #Foo: (#struct){ |((#struct){
84 field: (int){ int }
85 a: (int){ 1 }
86 }, (#struct){
87 field: (int){ int }
88 b: (int){ 2 }
89 }) }
90 foo: (#struct){
91 field: (int){ int }
92 a: (int){ 1 }
93 }
94 bar: (_|_){
95 // [eval] bar.c: field not allowed:
96 // ./in.cue:1:7
97 // ./in.cue:4:2
98 // ./in.cue:11:6
99 // ./in.cue:12:7
100 field: (int){ int }
101 c: (_|_){
102 // [eval] bar.c: field not allowed:
103 // ./in.cue:1:7
104 // ./in.cue:4:2
105 // ./in.cue:5:2
106 // ./in.cue:11:6
107 // ./in.cue:12:7
108 }
109 b: (int){ 2 }
110 }
111 baz: (#struct){
112 field: (int){ int }
113 b: (int){ 2 }
114 }
115}
View as plain text