API is subsumption used for APIs.
var API = Profile{ IgnoreClosedness: true, }
var CUE = Profile{}
Final checks subsumption interpreting the subsumed value as data.
var Final = Profile{ Final: true, Defaults: true, }
FinalOpen exists as an artifact of the old API. One should probably not use this.
var FinalOpen = Profile{ Final: true, Defaults: true, IgnoreClosedness: true, }
var Simplify = Profile{ LeftDefault: true, }
func Value(ctx *adt.OpContext, a, b adt.Value) errors.Error
Value subsumes two values based on their logical (evaluated) values.
Profile configures the type of subsumption. One should typically use one of the preconfigured profiles.
type Profile struct { // Final indicates subsumption should only consider fields that are relevant // to data mode, and ignore definitions, hidden fields, pattern constraints // and additional constraints. Final bool // Defaults indicate that default values should be used for the subsumed // value. Defaults bool // LeftDefaults indicates that the default value of the subsuming value // needs to be taken. This is necessary for simplifications like trim // and simplifying disjunctions. LeftDefault bool // Ignore optional fields. IgnoreOptional bool // IgnoreClosedness ignores closedness of structs and is used for comparing // APIs. IgnoreClosedness bool }
func (p *Profile) Check(ctx *adt.OpContext, a, b adt.Value) bool
Check reports whether b is an instance of a.
func (p *Profile) Value(ctx *adt.OpContext, a, b adt.Value) errors.Error