Skip to content

Commit 4967eb4

Browse files
committed
internal/core/adt: expose v3 optional field bug
This will be fixed in a follow-up CL. Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Icb7b7839c43d61d00bbc9cec872c9dcbece9a782 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1199915 Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent e525f29 commit 4967eb4

File tree

1 file changed

+80
-20
lines changed

1 file changed

+80
-20
lines changed
+80-20
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,94 @@
11
-- in.cue --
2-
a: {
2+
t1: a: {
33
foo?: int
44

55
b: foo
66
}
7-
-- out/compile --
8-
--- in.cue
9-
{
10-
a: {
11-
foo?: int
12-
b: 〈0;foo〉
13-
}
7+
t2: a: {
8+
b: foo
9+
10+
foo?: int
1411
}
1512
-- out/eval/stats --
1613
Leaks: 0
17-
Freed: 4
18-
Reused: 1
19-
Allocs: 3
20-
Retain: 0
14+
Freed: 9
15+
Reused: 4
16+
Allocs: 5
17+
Retain: 1
2118

22-
Unifications: 4
23-
Conjuncts: 4
24-
Disjuncts: 4
19+
Unifications: 9
20+
Conjuncts: 9
21+
Disjuncts: 10
22+
-- out/evalalpha --
23+
(struct){
24+
t1: (struct){
25+
a: (struct){
26+
foo?: (int){ int }
27+
b: (_|_){
28+
// [incomplete] t1.a.b: cannot reference optional field: foo:
29+
// ./in.cue:4:5
30+
}
31+
}
32+
}
33+
t2: (struct){
34+
a: (struct){
35+
b: (int){ int }
36+
foo?: (int){ int }
37+
}
38+
}
39+
}
40+
-- diff/-out/evalalpha<==>+out/eval --
41+
diff old new
42+
--- old
43+
+++ new
44+
@@ -10,10 +10,7 @@
45+
}
46+
t2: (struct){
47+
a: (struct){
48+
- b: (_|_){
49+
- // [incomplete] t2.a.b: cannot reference optional field: foo:
50+
- // ./in.cue:7:5
51+
- }
52+
+ b: (int){ int }
53+
foo?: (int){ int }
54+
}
55+
}
56+
-- diff/todo/p1 --
57+
t2: reference resolves to optional field.
2558
-- out/eval --
2659
(struct){
27-
a: (struct){
28-
foo?: (int){ int }
29-
b: (_|_){
30-
// [incomplete] a.b: cannot reference optional field: foo:
31-
// ./in.cue:4:5
60+
t1: (struct){
61+
a: (struct){
62+
foo?: (int){ int }
63+
b: (_|_){
64+
// [incomplete] t1.a.b: cannot reference optional field: foo:
65+
// ./in.cue:4:5
66+
}
67+
}
68+
}
69+
t2: (struct){
70+
a: (struct){
71+
b: (_|_){
72+
// [incomplete] t2.a.b: cannot reference optional field: foo:
73+
// ./in.cue:7:5
74+
}
75+
foo?: (int){ int }
3276
}
3377
}
3478
}
79+
-- out/compile --
80+
--- in.cue
81+
{
82+
t1: {
83+
a: {
84+
foo?: int
85+
b: 〈0;foo〉
86+
}
87+
}
88+
t2: {
89+
a: {
90+
b: 〈0;foo〉
91+
foo?: int
92+
}
93+
}
94+
}

0 commit comments

Comments
 (0)