Skip to content

Commit 1e803fa

Browse files
committed
internal/core/adt: only reset enclosingEmbed when used
This prevents erasing it too early, disallowing it to be used when it should Fixes #3826 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: I556d098af38024b1e9323b41690f791f486ddd7f Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211800 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Daniel Martí <[email protected]>
1 parent 61a8b03 commit 1e803fa

File tree

3 files changed

+70
-127
lines changed

3 files changed

+70
-127
lines changed

cue/testdata/definitions/root5.txtar

Lines changed: 11 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,7 @@ Unifications: 20
2424
Conjuncts: 34
2525
Disjuncts: 26
2626
-- out/evalalpha --
27-
Errors:
28-
c: field not allowed:
29-
./in.cue:5:1
30-
x: field not allowed:
31-
./in.cue:8:1
32-
33-
Result:
34-
(_|_){
35-
// [eval]
27+
(#struct){
3628
_schema: ~(#Schema)
3729
#Schema: (#struct){
3830
a?: (#struct){
@@ -42,103 +34,48 @@ Result:
4234
a: (#struct){
4335
b: (string){ "foo" }
4436
}
45-
c: (_|_){
46-
// [eval] c: field not allowed:
47-
// ./in.cue:5:1
48-
}
49-
x: (_|_){
50-
// [eval] x: field not allowed:
51-
// ./in.cue:8:1
37+
c: (string){ "foo" }
38+
x: (#struct){
5239
_schema: ~(x.#Schema)
5340
#Schema: (#struct){
5441
a?: (#struct){
5542
b?: (string){ string }
5643
}
5744
}
58-
a: (_|_){
59-
// [eval] x.a: field not allowed:
60-
// ./in.cue:11:11
61-
// ./in.cue:12:2
62-
b: (_|_){
63-
// [eval] x.a.b: field not allowed:
64-
// ./in.cue:11:15
65-
// ./in.cue:12:5
66-
}
67-
}
68-
c: (_|_){
69-
// [eval] x.c: field not allowed:
70-
// ./in.cue:13:2
45+
a: (#struct){
46+
b: (string){ "foo" }
7147
}
48+
c: (string){ "foo" }
7249
}
7350
}
7451
-- diff/-out/evalalpha<==>+out/eval --
7552
diff old new
7653
--- old
7754
+++ new
78-
@@ -1,9 +1,13 @@
79-
-(#struct){
55+
@@ -1,9 +1,5 @@
56+
(#struct){
8057
- _schema: (#struct){
8158
- a?: (#struct){
8259
- b?: (string){ string }
8360
- }
8461
- }
85-
+Errors:
86-
+c: field not allowed:
87-
+ ./in.cue:5:1
88-
+x: field not allowed:
89-
+ ./in.cue:8:1
90-
+
91-
+Result:
92-
+(_|_){
93-
+ // [eval]
9462
+ _schema: ~(#Schema)
9563
#Schema: (#struct){
9664
a?: (#struct){
9765
b?: (string){ string }
98-
@@ -12,21 +16,32 @@
99-
a: (#struct){
100-
b: (string){ "foo" }
66+
@@ -14,11 +10,7 @@
10167
}
102-
- c: (string){ "foo" }
103-
- x: (#struct){
68+
c: (string){ "foo" }
69+
x: (#struct){
10470
- _schema: (#struct){
10571
- a?: (#struct){
10672
- b?: (string){ string }
10773
- }
10874
- }
109-
+ c: (_|_){
110-
+ // [eval] c: field not allowed:
111-
+ // ./in.cue:5:1
112-
+ }
113-
+ x: (_|_){
114-
+ // [eval] x: field not allowed:
115-
+ // ./in.cue:8:1
11675
+ _schema: ~(x.#Schema)
11776
#Schema: (#struct){
11877
a?: (#struct){
11978
b?: (string){ string }
120-
}
121-
}
122-
- a: (#struct){
123-
- b: (string){ "foo" }
124-
- }
125-
- c: (string){ "foo" }
126-
+ a: (_|_){
127-
+ // [eval] x.a: field not allowed:
128-
+ // ./in.cue:11:11
129-
+ // ./in.cue:12:2
130-
+ b: (_|_){
131-
+ // [eval] x.a.b: field not allowed:
132-
+ // ./in.cue:11:15
133-
+ // ./in.cue:12:5
134-
+ }
135-
+ }
136-
+ c: (_|_){
137-
+ // [eval] x.c: field not allowed:
138-
+ // ./in.cue:13:2
139-
+ }
140-
}
141-
}
14279
-- out/eval --
14380
(#struct){
14481
_schema: (#struct){

0 commit comments

Comments
 (0)