Skip to content

Commit da69dc0

Browse files
committed
internal/core/eval: ... does not apply to defintions
Change-Id: Ic4ba09d7876ef5763c20b33708758190e5daf401 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7201 Reviewed-by: CUE cueckoo <[email protected]> Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 15e8a05 commit da69dc0

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
-- in.cue --
2+
#Schema: {
3+
...
4+
}
5+
6+
Component: {
7+
hostname: string | *"localhost"
8+
9+
#foo: {
10+
hello: "world"
11+
}
12+
}
13+
14+
hello: #Schema & Component
15+
-- out/eval --
16+
(struct){
17+
#Schema: (#struct){
18+
}
19+
Component: (struct){
20+
hostname: (string){ |(*(string){ "localhost" }, (string){ string }) }
21+
#foo: (#struct){
22+
hello: (string){ "world" }
23+
}
24+
}
25+
hello: (#struct){
26+
hostname: (string){ |(*(string){ "localhost" }, (string){ string }) }
27+
#foo: (#struct){
28+
hello: (string){ "world" }
29+
}
30+
}
31+
}
32+
-- out/compile --
33+
--- in.cue
34+
{
35+
#Schema: {
36+
...
37+
}
38+
Component: {
39+
hostname: (string|*"localhost")
40+
#foo: {
41+
hello: "world"
42+
}
43+
}
44+
hello: (〈0;#Schema〉 & 〈0;Component〉)
45+
}

internal/core/eval/closed.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ func (c *acceptor) verifySets(ctx *adt.OpContext, id adt.ID, f adt.Feature) (fou
483483
if o == nil {
484484
return false, false
485485
}
486-
for ; o != nil; o = o.next {
487-
if len(o.additional) > 0 || o.isOpen {
486+
for isRegular := f.IsRegular(); o != nil; o = o.next {
487+
if isRegular && (len(o.additional) > 0 || o.isOpen) {
488488
return true, false
489489
}
490490

@@ -494,6 +494,10 @@ func (c *acceptor) verifySets(ctx *adt.OpContext, id adt.ID, f adt.Feature) (fou
494494
}
495495
}
496496

497+
if !isRegular {
498+
continue
499+
}
500+
497501
for _, b := range o.bulk {
498502
if b.check.Match(ctx, f) {
499503
return true, false

0 commit comments

Comments
 (0)