contracts

package
v0.0.0-...-d69f115 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contract2String

func Contract2String(c Contract) string

func UnmarshalTypevar

func UnmarshalTypevar(rawMessage *json.RawMessage) (typevars.Interface, error)

Types

type BinaryOp

type BinaryOp struct {
	// OpToken gives information about particular binary operation.
	// E.g. '+' can be used with integers and strings, '-' can not be used with strings.
	// As long as the operands are compatible with the operation, the contract holds.
	OpToken token.Token `json:"optoken"`
	// Z = X op Y
	X            typevars.Interface `json:"x"`
	Y            typevars.Interface `json:"y"`
	Z            typevars.Interface `json:"z"`
	ExpectedType gotypes.DataType   `json:"expectedtype"`
	Pos          string             `json:"pos"`
}

BinaryOp represents contract between two typevars

func (*BinaryOp) GetType

func (b *BinaryOp) GetType() Type

func (*BinaryOp) MarshalJSON

func (o *BinaryOp) MarshalJSON() (b []byte, e error)

func (*BinaryOp) UnmarshalJSON

func (o *BinaryOp) UnmarshalJSON(b []byte) error

type Contract

type Contract interface {
	GetType() Type
}

type DereferenceOf

type DereferenceOf struct {
	X   typevars.Interface `json:"x"`
	Y   typevars.Interface `json:"y"`
	Pos string             `json:"pos"`
}

func (*DereferenceOf) GetType

func (i *DereferenceOf) GetType() Type

func (*DereferenceOf) MarshalJSON

func (o *DereferenceOf) MarshalJSON() (b []byte, e error)

func (*DereferenceOf) UnmarshalJSON

func (o *DereferenceOf) UnmarshalJSON(b []byte) error

type HasField

type HasField struct {
	X     typevars.Interface `json:"x"`
	Field string             `json:"field"`
	Index int                `json:"index"`
	Pos   string             `json:"pos"`
}

func (*HasField) GetType

func (i *HasField) GetType() Type

func (*HasField) MarshalJSON

func (o *HasField) MarshalJSON() (b []byte, e error)

func (*HasField) UnmarshalJSON

func (o *HasField) UnmarshalJSON(b []byte) error

type IsCompatibleWith

type IsCompatibleWith struct {
	X            typevars.Interface `json:"x"`
	Y            typevars.Interface `json:"y"`
	ExpectedType gotypes.DataType   `json:"expectedtype"`
	// As long as MapKey is compatible with integer, it is compatible with ListKey as well
	// TODO(jchaloup): make sure this principle is applied during the compatibility analysis
	Weak bool   `json:"weak"`
	Pos  string `json:"pos"`
}

func (*IsCompatibleWith) GetType

func (i *IsCompatibleWith) GetType() Type

func (*IsCompatibleWith) MarshalJSON

func (o *IsCompatibleWith) MarshalJSON() (b []byte, e error)

func (*IsCompatibleWith) UnmarshalJSON

func (o *IsCompatibleWith) UnmarshalJSON(b []byte) error

type IsDereferenceable

type IsDereferenceable struct {
	X   typevars.Interface `json:"x"`
	Pos string             `json:"pos"`
}

func (*IsDereferenceable) GetType

func (i *IsDereferenceable) GetType() Type

func (*IsDereferenceable) MarshalJSON

func (o *IsDereferenceable) MarshalJSON() (b []byte, e error)

func (*IsDereferenceable) UnmarshalJSON

func (o *IsDereferenceable) UnmarshalJSON(b []byte) error

type IsIncDecable

type IsIncDecable struct {
	X   typevars.Interface `json:"x"`
	Pos string             `json:"pos"`
}

func (*IsIncDecable) GetType

func (i *IsIncDecable) GetType() Type

func (*IsIncDecable) MarshalJSON

func (o *IsIncDecable) MarshalJSON() (b []byte, e error)

func (*IsIncDecable) UnmarshalJSON

func (o *IsIncDecable) UnmarshalJSON(b []byte) error

type IsIndexable

type IsIndexable struct {
	X       typevars.Interface `json:"x"`
	Key     typevars.Interface `json:"key"`
	IsSlice bool               `json:"isslice"`
	Pos     string             `json:"pos"`
}

func (*IsIndexable) GetType

func (i *IsIndexable) GetType() Type

func (*IsIndexable) MarshalJSON

func (o *IsIndexable) MarshalJSON() (b []byte, e error)

func (*IsIndexable) UnmarshalJSON

func (o *IsIndexable) UnmarshalJSON(b []byte) error

type IsInvocable

type IsInvocable struct {
	F         typevars.Interface `json:"f"`
	ArgsCount int                `json:"argscount"`
	Pos       string             `json:"pos"`
}

func (*IsInvocable) GetType

func (i *IsInvocable) GetType() Type

func (*IsInvocable) MarshalJSON

func (o *IsInvocable) MarshalJSON() (b []byte, e error)

func (*IsInvocable) UnmarshalJSON

func (o *IsInvocable) UnmarshalJSON(b []byte) error

type IsRangeable

type IsRangeable struct {
	X   typevars.Interface `json:"x"`
	Pos string             `json:"pos"`
}

func (*IsRangeable) GetType

func (i *IsRangeable) GetType() Type

func (*IsRangeable) MarshalJSON

func (o *IsRangeable) MarshalJSON() (b []byte, e error)

func (*IsRangeable) UnmarshalJSON

func (o *IsRangeable) UnmarshalJSON(b []byte) error

type IsReceiveableFrom

type IsReceiveableFrom struct {
	X            typevars.Interface `json:"x"`
	Y            typevars.Interface `json:"y"`
	ExpectedType gotypes.DataType   `json:"expectedtype"`
	Pos          string             `json:"pos"`
}

func (*IsReceiveableFrom) GetType

func (i *IsReceiveableFrom) GetType() Type

func (*IsReceiveableFrom) MarshalJSON

func (o *IsReceiveableFrom) MarshalJSON() (b []byte, e error)

func (*IsReceiveableFrom) UnmarshalJSON

func (o *IsReceiveableFrom) UnmarshalJSON(b []byte) error

type IsReferenceable

type IsReferenceable struct {
	X   typevars.Interface `json:"x"`
	Pos string             `json:"pos"`
}

func (*IsReferenceable) GetType

func (i *IsReferenceable) GetType() Type

func (*IsReferenceable) MarshalJSON

func (o *IsReferenceable) MarshalJSON() (b []byte, e error)

func (*IsReferenceable) UnmarshalJSON

func (o *IsReferenceable) UnmarshalJSON(b []byte) error

type IsSendableTo

type IsSendableTo struct {
	X   typevars.Interface `json:"x"`
	Y   typevars.Interface `json:"y"`
	Pos string             `json:"pos"`
}

func (*IsSendableTo) GetType

func (i *IsSendableTo) GetType() Type

func (*IsSendableTo) MarshalJSON

func (o *IsSendableTo) MarshalJSON() (b []byte, e error)

func (*IsSendableTo) UnmarshalJSON

func (o *IsSendableTo) UnmarshalJSON(b []byte) error

type PropagatesTo

type PropagatesTo struct {
	X            typevars.Interface `json:"x"`
	Y            typevars.Interface `json:"y"`
	ExpectedType gotypes.DataType   `json:"expectedtype"`
	ToVariable   bool               `json:"tovariable"`
	Pos          string             `json:"pos"`
}

func (*PropagatesTo) GetType

func (p *PropagatesTo) GetType() Type

func (*PropagatesTo) MarshalJSON

func (o *PropagatesTo) MarshalJSON() (b []byte, e error)

func (*PropagatesTo) UnmarshalJSON

func (o *PropagatesTo) UnmarshalJSON(b []byte) error

type ReferenceOf

type ReferenceOf struct {
	X   typevars.Interface `json:"x"`
	Y   typevars.Interface `json:"y"`
	Pos string             `json:"pos"`
}

func (*ReferenceOf) GetType

func (i *ReferenceOf) GetType() Type

func (*ReferenceOf) MarshalJSON

func (o *ReferenceOf) MarshalJSON() (b []byte, e error)

func (*ReferenceOf) UnmarshalJSON

func (o *ReferenceOf) UnmarshalJSON(b []byte) error

type Type

type Type string
var BinaryOpType Type = "binaryop"
var DereferenceOfType Type = "dereferenceOf"
var HasFieldType Type = "hasfield"
var IsCompatibleWithType Type = "iscompatiblewith"
var IsDereferenceableType Type = "Isdereferenceable"
var IsIncDecableType Type = "isincdecable"
var IsIndexableType Type = "isindexable"
var IsInvocableType Type = "isinvocable"
var IsRangeableType Type = "israngeable"
var IsReceiveableFromType Type = "isreceiveablefrom"
var IsReferenceableType Type = "isreferenceable"
var IsSendableToType Type = "issendableto"
var PropagatesToType Type = "propagatesto"
var ReferenceOfType Type = "referenceof"
var TypecastsToType Type = "typecaststo"
var UnaryOpType Type = "unaryop"

type TypecastsTo

type TypecastsTo struct {
	X            typevars.Interface `json:"x"`
	Type         typevars.Interface `json:"castedtype"`
	Y            typevars.Interface `json:"y"`
	ExpectedType gotypes.DataType   `json:"expectedtype"`
	Pos          string             `json:"pos"`
}

func (*TypecastsTo) GetType

func (p *TypecastsTo) GetType() Type

func (*TypecastsTo) MarshalJSON

func (o *TypecastsTo) MarshalJSON() (b []byte, e error)

func (*TypecastsTo) UnmarshalJSON

func (o *TypecastsTo) UnmarshalJSON(b []byte) error

type UnaryOp

type UnaryOp struct {
	OpToken token.Token `json:"optoken"`
	// Y = op X
	X            typevars.Interface `json:"x"`
	Y            typevars.Interface `json:"y"`
	ExpectedType gotypes.DataType   `json:"expectedtype"`
	Pos          string             `json:"pos"`
}

func (*UnaryOp) GetType

func (b *UnaryOp) GetType() Type

func (*UnaryOp) MarshalJSON

func (o *UnaryOp) MarshalJSON() (b []byte, e error)

func (*UnaryOp) UnmarshalJSON

func (o *UnaryOp) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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