diff --git a/cue/context.go b/cue/context.go index 29c50a1a0..947987d89 100644 --- a/cue/context.go +++ b/cue/context.go @@ -35,8 +35,6 @@ type context struct { inSum int cycleErr bool - noManifest bool - // for debug strings nodeRefs map[scope]string diff --git a/cue/evaluator.go b/cue/evaluator.go index 48ff71c51..703879a8d 100644 --- a/cue/evaluator.go +++ b/cue/evaluator.go @@ -16,9 +16,6 @@ package cue func (c *context) manifest(v value) evaluated { evaluated := v.evalPartial(c) - if c.noManifest { - return evaluated - } outer: switch x := evaluated.(type) { case *disjunction: diff --git a/cue/resolve_test.go b/cue/resolve_test.go index d9137021d..1c3ee9ff1 100644 --- a/cue/resolve_test.go +++ b/cue/resolve_test.go @@ -2733,6 +2733,23 @@ func TestFullEval(t *testing.T) { `c: <9>C{C{[=~"^Q*$"]: <10>(_: string)->int}, C{(C{[=~"^[a-s]*$"]: <11>(_: string)->int} & C{[=~"^[m-z]*?"]: <12>(_: string)->int})}, QQ: 3}, ` + `D :: <13>C{[=~"^[a-s]*$"]: <14>(_: string)->int, [=~"^[m-z]*?"]: <15>(_: string)->int, }, ` + `d: <16>C{[=~"^[a-s]*$"]: <17>(_: string)->int, [=~"^[m-z]*?"]: <18>(_: string)->int, aaa: 4}}`, + }, { + in: ` + Task :: { + { + op: "pull" + tag: *"latest" | string + refToTag: tag + tagExpr: tag + "dd" + tagInString: "\(tag)" + } | { + op: "scratch" + } + } + + foo: Task & {"op": "pull"} + `, + out: `<0>{Task :: (<1>C{op: "pull", tag: (*"latest" | string), refToTag: <1>.tag, tagExpr: (<1>.tag + "dd"), tagInString: ""+<1>.tag+""} | <2>C{op: "scratch"}), foo: <3>C{op: "pull", tag: "latest", refToTag: "latest", tagExpr: "latestdd", tagInString: "latest"}}`, }} rewriteHelper(t, testCases, evalFull) } diff --git a/cue/types_test.go b/cue/types_test.go index 0b7dcd738..31eb4a6ef 100644 --- a/cue/types_test.go +++ b/cue/types_test.go @@ -1843,6 +1843,21 @@ func TestMashalJSON(t *testing.T) { f: >=1.1 & <=1.1 `, json: `{"a":1,"b":1,"c":2,"d":1,"e":1,"f":1.1}`, + }, { + value: ` + Task :: { + { + op: "pull" + tag: *"latest" | string + tagInString: tag + "dd" + } | { + op: "scratch" + } + } + + foo: Task & {"op": "pull"} + `, + json: `{"foo":{"op":"pull","tag":"latest","tagInString":"latestdd"}}`, }} for i, tc := range testCases { t.Run(fmt.Sprintf("%d/%v", i, tc.value), func(t *testing.T) { diff --git a/cue/value.go b/cue/value.go index 27aeb7e5b..7ad98e7dc 100644 --- a/cue/value.go +++ b/cue/value.go @@ -1624,11 +1624,6 @@ func (x *disjunction) normalize(ctx *context, src source) mVal { } k := 0 - // manifesting values should be disabled for recursive evaluation as - // these values may still be bound to another value later on, for instance - // when the result of this value is unified with another value. - noManifest := ctx.noManifest - ctx.noManifest = true hasMarked := false var markedErr *bottom outer: @@ -1673,7 +1668,6 @@ outer: x.values[k] = dValue{&bottom{}, true} k++ } - ctx.noManifest = noManifest switch k { case 0: