Skip to content

Commit

Permalink
cue: derefernce more values
Browse files Browse the repository at this point in the history
As Eval V3 introduces more structure shraing, we have
to also do more dereferencing in the API.

Issue #2854

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: I9c5299f6122658f5bbd743895857ca4a2e002de5
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202229
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Matthew Sackman <[email protected]>
  • Loading branch information
mpvl committed Oct 8, 2024
1 parent 4330d60 commit 1700400
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cue/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -880,12 +880,13 @@ func (v Value) Kind() Kind {
if v.v == nil {
return BottomKind
}
c := v.v.BaseValue
if !v.v.IsConcrete() {
w := v.v.DerefValue()
c := w.BaseValue
if !w.IsConcrete() {
return BottomKind
}
// TODO: perhaps we should not consider open lists as "incomplete".
if v.IncompleteKind() == adt.ListKind && !v.v.IsClosedList() {
if v.IncompleteKind() == adt.ListKind && !w.IsClosedList() {
return BottomKind
}
return c.Kind()
Expand Down Expand Up @@ -1188,13 +1189,14 @@ func (v Value) IsConcrete() bool {
if v.v == nil {
return false // any is neither concrete, not a list or struct.
}
if b := v.v.Bottom(); b != nil {
w := v.v.DerefValue()
if b := w.Bottom(); b != nil {
return !b.IsIncomplete()
}
if !adt.IsConcrete(v.v) {
if !adt.IsConcrete(w) {
return false
}
if v.IncompleteKind() == adt.ListKind && !v.v.IsClosedList() {
if v.IncompleteKind() == adt.ListKind && !w.IsClosedList() {
return false
}
return true
Expand Down

0 comments on commit 1700400

Please sign in to comment.