diff --git a/internal/core/dep/dep_test.go b/internal/core/dep/dep_test.go index e2d12ffb0bd..4ccdd65b1e7 100644 --- a/internal/core/dep/dep_test.go +++ b/internal/core/dep/dep_test.go @@ -22,12 +22,14 @@ import ( "text/tabwriter" "cuelang.org/go/cue" - "cuelang.org/go/cue/cuecontext" "cuelang.org/go/cue/format" + "cuelang.org/go/internal" "cuelang.org/go/internal/core/adt" "cuelang.org/go/internal/core/debug" "cuelang.org/go/internal/core/dep" "cuelang.org/go/internal/core/eval" + "cuelang.org/go/internal/core/runtime" + "cuelang.org/go/internal/cuedebug" "cuelang.org/go/internal/cuetdtest" "cuelang.org/go/internal/cuetxtar" "cuelang.org/go/internal/value" @@ -35,9 +37,10 @@ import ( func TestVisit(t *testing.T) { test := cuetxtar.TxTarTest{ - Root: "./testdata", - Name: "dependencies", - Matrix: cuetdtest.SmallMatrix, + Root: "./testdata", + Name: "dependencies", + // Matrix: cuetdtest.SmallMatrix, + Matrix: cuetdtest.DevOnlyMatrix, ToDo: map[string]string{ "dependencies-v3/inline": "error", @@ -45,7 +48,15 @@ func TestVisit(t *testing.T) { } test.Run(t, func(t *cuetxtar.Test) { - val := t.CueContext().BuildInstance(t.Instance()) + flags := cuedebug.Config{ + Sharing: true, + // LogEval: 1, + } + ctx := t.CueContext() + r := (*runtime.Runtime)(ctx) + r.SetDebugOptions(&flags) + + val := ctx.BuildInstance(t.Instance()) if val.Err() != nil { t.Fatal(val.Err()) } @@ -117,9 +128,16 @@ func testVisit(t *testing.T, w io.Writer, ctxt *adt.OpContext, v *adt.Vertex, cf // DO NOT REMOVE: for Testing purposes. func TestX(t *testing.T) { + version := internal.DefaultVersion + version = internal.DevVersion + flags := cuedebug.Config{ + Sharing: true, + LogEval: 1, + } + cfg := &dep.Config{ Dynamic: true, - // Recurse: true, + // Descend: true, } in := ` @@ -129,7 +147,10 @@ func TestX(t *testing.T) { t.Skip() } - v := cuecontext.New().CompileString(in) + r := runtime.NewWithSettings(version, flags) + ctx := (*cue.Context)(r) + + v := ctx.CompileString(in) if err := v.Err(); err != nil { t.Fatal(err) } @@ -138,6 +159,9 @@ func TestX(t *testing.T) { r, n := value.ToInternal(aVal) + out := debug.NodeString(r, n, nil) + t.Error(out) + ctxt := eval.NewContext(r, n) n.VisitLeafConjuncts(func(c adt.Conjunct) bool { diff --git a/internal/core/dep/mixed.go b/internal/core/dep/mixed.go index 51ab7dbe282..5ae089a9283 100644 --- a/internal/core/dep/mixed.go +++ b/internal/core/dep/mixed.go @@ -29,6 +29,8 @@ import ( // and comprehension sources. func (v *visitor) dynamic(n *adt.Vertex, top bool) { found := false + // TODO: Consider if we should only visit the conjuncts of the disjunction + // for dynamic mode. n.VisitLeafConjuncts(func(c adt.Conjunct) bool { if v.marked[c.Expr()] { found = true @@ -45,6 +47,7 @@ func (v *visitor) dynamic(n *adt.Vertex, top bool) { return } + n = n.DerefValue() for _, a := range n.Arcs { if !a.IsDefined(v.ctxt) || a.Label.IsLet() { continue