internal/core/adt: don't check cycles for inlined arcs

Change-Id: I4e1e80a13a8024645a2f76c126c03c3e1fe172b1
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8242
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
diff --git a/internal/core/adt/eval.go b/internal/core/adt/eval.go
index ffa4b56..806797f 100644
--- a/internal/core/adt/eval.go
+++ b/internal/core/adt/eval.go
@@ -1056,7 +1056,7 @@
 		if x.IsData() {
 			n.addValueConjunct(env, x, id)
 		} else {
-			n.addVertexConjuncts(env, id, x, x)
+			n.addVertexConjuncts(env, id, x, x, true)
 		}
 
 	case Value:
@@ -1121,7 +1121,7 @@
 			break
 		}
 
-		n.addVertexConjuncts(v.Env, v.CloseInfo, v.Expr(), arc)
+		n.addVertexConjuncts(v.Env, v.CloseInfo, v.Expr(), arc, false)
 
 	case Evaluator:
 		// Interpolation, UnaryExpr, BinaryExpr, CallExpr
@@ -1165,7 +1165,7 @@
 	}
 }
 
-func (n *nodeContext) addVertexConjuncts(env *Environment, closeInfo CloseInfo, x Expr, arc *Vertex) {
+func (n *nodeContext) addVertexConjuncts(env *Environment, closeInfo CloseInfo, x Expr, arc *Vertex, inline bool) {
 
 	// We need to ensure that each arc is only unified once (or at least) a
 	// bounded time, witch each conjunct. Comprehensions, for instance, may
@@ -1253,7 +1253,11 @@
 		if env != nil {
 			a = env.Deref
 		}
-		c = updateCyclic(c, cyclic, arc, a)
+		if inline {
+			c = updateCyclic(c, cyclic, nil, nil)
+		} else {
+			c = updateCyclic(c, cyclic, arc, a)
+		}
 
 		// Note that we are resetting the tree here. We hereby assume that
 		// closedness conflicts resulting from unifying the referenced arc were
@@ -1345,7 +1349,7 @@
 			// TODO: this really shouldn't happen anymore.
 			if isComplexStruct(ctx, x) {
 				// This really shouldn't happen, but just in case.
-				n.addVertexConjuncts(env, id, x, x)
+				n.addVertexConjuncts(env, id, x, x, true)
 				return
 			}