subsume

package
v0.3.0-alpha1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package subsume defines various subsumption relations.

Index

Constants

This section is empty.

Variables

View Source
var API = Profile{
	IgnoreClosedness: true,
}

API is subsumption used for APIs.

View Source
var CUE = Profile{}
View Source
var Final = Profile{
	Final:    true,
	Defaults: true,
}

Final checks subsumption interpreting the subsumed value as data.

View Source
var FinalOpen = Profile{
	Final:            true,
	Defaults:         true,
	IgnoreClosedness: true,
}

FinalOpen exists as an artifact of the old API. One should probably not use this.

Functions

func Value

func Value(ctx *adt.OpContext, a, b adt.Value) errors.Error

Value subsumes two values based on their logical (evaluated) values.

Types

type Profile

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

	// Ignore optional fields.
	IgnoreOptional bool

	// IgnoreClosedness ignores closedness of structs and is used for comparing
	// APIs.
	IgnoreClosedness bool
}

Profile configures the type of subsumption. One should typically use one of the preconfigured profiles.

func (*Profile) Check

func (p *Profile) Check(ctx *adt.OpContext, a, b adt.Value) bool

Check reports whether b is an instance of a.

func (*Profile) Value

func (p *Profile) Value(ctx *adt.OpContext, a, b adt.Value) errors.Error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL