this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

pkg: use adt.Unify instead of Value.Unify

This change should by itself be a no-op, as we
still need to pass cycle information through to
the respective OpContexts. This will be done in
a followup CL. We include these changes in a
separate CL, though, to be able to isolate any
issues that may arise from this change.

Issue #3649

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I2e5d201252faf42207bf5f7a08445f5607391033
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1208701
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Matthew Sackman <matthew@cue.works>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+10 -3
+6 -2
pkg/encoding/json/manual.go
··· 27 27 "cuelang.org/go/cue/parser" 28 28 "cuelang.org/go/cue/token" 29 29 cuejson "cuelang.org/go/encoding/json" 30 + "cuelang.org/go/internal/core/adt" 30 31 internaljson "cuelang.org/go/internal/encoding/json" 31 32 "cuelang.org/go/internal/pkg" 33 + "cuelang.org/go/internal/value" 32 34 ) 33 35 34 36 // Compact generates the JSON-encoded src with insignificant space characters ··· 131 133 // Validate validates JSON and confirms it matches the constraints 132 134 // specified by v. 133 135 func Validate(b []byte, v pkg.Schema) (bool, error) { 136 + c := value.OpContext(v) 134 137 if !json.Valid(b) { 135 138 return false, fmt.Errorf("json: invalid JSON") 136 139 } ··· 139 142 return false, err 140 143 } 141 144 142 - v = v.Unify(v2) 143 - if err := v.Err(); err != nil { 145 + vx := adt.Unify(c, value.Vertex(v2), value.Vertex(v)) 146 + x := value.Make(c, vx) 147 + if err := x.Err(); err != nil { 144 148 return false, err 145 149 } 146 150
+4 -1
pkg/list/list.go
··· 332 332 // "n" may be a number constraint and does not have to be a concrete number. 333 333 // Likewise, "matchValue" will usually be a non-concrete value. 334 334 func MatchN(list []cue.Value, n pkg.Schema, matchValue pkg.Schema) (bool, error) { 335 + c := value.OpContext(n) 335 336 var nmatch int64 336 337 for _, w := range list { 337 - if matchValue.Unify(w).Validate(cue.Final()) == nil { 338 + vx := adt.Unify(c, value.Vertex(matchValue), value.Vertex(w)) 339 + x := value.Make(c, vx) 340 + if x.Validate(cue.Final()) == nil { 338 341 nmatch++ 339 342 } 340 343 }