model

package
v3.114.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 16 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// NoneType represents the undefined value.
	NoneType Type = noneType(0)
	// BoolType represents the set of boolean values.
	BoolType = NewOpaqueType("boolean")
	// IntType represents the set of 32-bit integer values.
	IntType = NewOpaqueType("int")
	// NumberType represents the set of arbitrary-precision values.
	NumberType = NewOpaqueType("number")
	// StringType represents the set of UTF-8 string values.
	StringType = NewOpaqueType("string")
	// DynamicType represents the set of all values.
	DynamicType = NewOpaqueType("dynamic")
)

Functions

func AllowMissingVariables

func AllowMissingVariables(options *bindOptions)

func ContainsEventuals

func ContainsEventuals(t Type) (containsOutputs, containsPromises bool)

ContainsEventuals returns true if the input type contains output or promise types.

func ContainsOutputs

func ContainsOutputs(t Type) bool

ContainsOutputs returns true if the input type contains output types.

func ContainsPromises

func ContainsPromises(t Type) bool

ContainsPromises returns true if the input type contains promise types.

func ExprNotConvertible

func ExprNotConvertible(destType Type, expr Expression) *hcl.Diagnostic

func GetCollectionTypes

func GetCollectionTypes(collectionType Type, rng hcl.Range, strict bool) (Type, Type, hcl.Diagnostics)

GetCollectionTypes returns the key and value types of the given type if it is a collection.

func HCLExpression

func HCLExpression(x Expression) hcl.Expression

func IsConstType added in v3.48.0

func IsConstType(t Type) bool

func IsOptionalType

func IsOptionalType(t Type) bool

IsOptionalType returns true if t is an optional type.

func MakeTraverser

func MakeTraverser(t Type) hcl.TraverseIndex

MakeTraverser returns an hcl.TraverseIndex with a key of the appropriate type.

func SkipRangeTypechecking added in v3.76.0

func SkipRangeTypechecking(options *bindOptions)

func SourceOrderBody

func SourceOrderBody(body *hclsyntax.Body) []hclsyntax.Node

SourceOrderBody sorts the contents of an HCL2 body in source order.

func SourceOrderLess

func SourceOrderLess(a, b hcl.Range) bool

SourceOrderLess returns true if the first range precedes the second when ordered by source position. Positions are ordered first by filename, then by byte offset.

func UnifyTypes

func UnifyTypes(types ...Type) (safeType Type, unsafeType Type)

UnifyTypes chooses the most general type that is convertible from all of the input types.

func VisitExpressions

func VisitExpressions(n BodyItem, pre, post ExpressionVisitor) hcl.Diagnostics

VisitExpressions visits each expression that descends from the given body item.

Types

type AnonymousFunctionExpression

type AnonymousFunctionExpression struct {
	// The signature for the anonymous function.
	Signature StaticFunctionSignature
	// The parameter definitions for the anonymous function.
	Parameters []*Variable

	// The body of the anonymous function.
	Body Expression
}

AnonymousFunctionExpression represents a semantically-analyzed anonymous function expression.

These expressions are not the result of semantically analyzing syntax nodes. Instead, they may be synthesized by transforms over the IR for a program (e.g. the Apply transform).

func (*AnonymousFunctionExpression) Evaluate

func (x *AnonymousFunctionExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*AnonymousFunctionExpression) Format

func (x *AnonymousFunctionExpression) Format(f fmt.State, c rune)

func (*AnonymousFunctionExpression) GetLeadingTrivia

func (x *AnonymousFunctionExpression) GetLeadingTrivia() syntax.TriviaList

func (*AnonymousFunctionExpression) GetTrailingTrivia

func (x *AnonymousFunctionExpression) GetTrailingTrivia() syntax.TriviaList

func (*AnonymousFunctionExpression) HasLeadingTrivia

func (x *AnonymousFunctionExpression) HasLeadingTrivia() bool

func (*AnonymousFunctionExpression) HasTrailingTrivia

func (x *AnonymousFunctionExpression) HasTrailingTrivia() bool

func (*AnonymousFunctionExpression) NodeTokens

NodeTokens returns the tokens associated with the body of the anonymous function.

func (*AnonymousFunctionExpression) SetLeadingTrivia

func (x *AnonymousFunctionExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*AnonymousFunctionExpression) SetTrailingTrivia

func (x *AnonymousFunctionExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*AnonymousFunctionExpression) SyntaxNode

func (x *AnonymousFunctionExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the body of the anonymous function.

func (*AnonymousFunctionExpression) Type

Type returns the type of the anonymous function expression.

TODO: currently this returns the any type. Instead, it should return a function type.

func (*AnonymousFunctionExpression) Typecheck

func (x *AnonymousFunctionExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type Attribute

type Attribute struct {
	// The syntax node for the attribute, if any.
	Syntax *hclsyntax.Attribute
	// The tokens for the attribute.
	Tokens *syntax.AttributeTokens

	// The attribute's name.
	Name string
	// The attribute's value.
	Value Expression
}

Attribute represents an HCL2 attribute.

func BindAttribute

func BindAttribute(attribute *hclsyntax.Attribute, scope *Scope, tokens syntax.TokenMap,
	opts ...BindOption,
) (*Attribute, hcl.Diagnostics)

BindAttribute binds an HCL2 attribute using the given scope and token map.

func (*Attribute) Format

func (a *Attribute) Format(f fmt.State, c rune)

func (*Attribute) GetLeadingTrivia

func (a *Attribute) GetLeadingTrivia() syntax.TriviaList

func (*Attribute) GetTrailingTrivia

func (a *Attribute) GetTrailingTrivia() syntax.TriviaList

func (*Attribute) HasLeadingTrivia

func (a *Attribute) HasLeadingTrivia() bool

func (*Attribute) HasTrailingTrivia

func (a *Attribute) HasTrailingTrivia() bool

func (*Attribute) SyntaxNode

func (a *Attribute) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node of the attribute, and will either return an *hclsyntax.Attribute or syntax.None.

func (*Attribute) Type

func (a *Attribute) Type() Type

type BinaryOpExpression

type BinaryOpExpression struct {
	// The syntax node associated with the binary operation.
	Syntax *hclsyntax.BinaryOpExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.BinaryOpTokens

	// The left-hand operand of the operation.
	LeftOperand Expression
	// The operation.
	Operation *hclsyntax.Operation
	// The right-hand operand of the operation.
	RightOperand Expression
	// contains filtered or unexported fields
}

BinaryOpExpression represents a semantically-analyzed binary operation.

func (*BinaryOpExpression) Evaluate

func (x *BinaryOpExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*BinaryOpExpression) Format

func (x *BinaryOpExpression) Format(f fmt.State, c rune)

func (*BinaryOpExpression) GetLeadingTrivia

func (x *BinaryOpExpression) GetLeadingTrivia() syntax.TriviaList

func (*BinaryOpExpression) GetTrailingTrivia

func (x *BinaryOpExpression) GetTrailingTrivia() syntax.TriviaList

func (*BinaryOpExpression) HasLeadingTrivia

func (x *BinaryOpExpression) HasLeadingTrivia() bool

func (*BinaryOpExpression) HasTrailingTrivia

func (x *BinaryOpExpression) HasTrailingTrivia() bool

func (*BinaryOpExpression) LeftOperandType

func (x *BinaryOpExpression) LeftOperandType() Type

LeftOperandType returns the desired type for the left operand of the binary operation.

func (*BinaryOpExpression) NodeTokens

func (x *BinaryOpExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the binary operation.

func (*BinaryOpExpression) RightOperandType

func (x *BinaryOpExpression) RightOperandType() Type

RightOperandType returns the desired type for the right operand of the binary operation.

func (*BinaryOpExpression) SetLeadingTrivia

func (x *BinaryOpExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*BinaryOpExpression) SetTrailingTrivia

func (x *BinaryOpExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*BinaryOpExpression) SyntaxNode

func (x *BinaryOpExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the binary operation.

func (*BinaryOpExpression) Type

func (x *BinaryOpExpression) Type() Type

Type returns the type of the binary operation.

func (*BinaryOpExpression) Typecheck

func (x *BinaryOpExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type BindOption

type BindOption func(options *bindOptions)

type Block

type Block struct {
	// The syntax node for the block, if any.
	Syntax *hclsyntax.Block
	// The tokens for the block.
	Tokens *syntax.BlockTokens

	// The block's type.
	Type string
	// The block's labels.
	Labels []string

	// The block's body.
	Body *Body
}

Block represents an HCL2 block.

func BindBlock

func BindBlock(block *hclsyntax.Block, scopes Scopes, tokens syntax.TokenMap,
	opts ...BindOption,
) (*Block, hcl.Diagnostics)

BindBlock binds an HCL2 block using the given scopes and token map.

func (*Block) Format

func (b *Block) Format(f fmt.State, c rune)

func (*Block) GetLeadingTrivia

func (b *Block) GetLeadingTrivia() syntax.TriviaList

func (*Block) GetTrailingTrivia

func (b *Block) GetTrailingTrivia() syntax.TriviaList

func (*Block) HasLeadingTrivia

func (b *Block) HasLeadingTrivia() bool

func (*Block) HasTrailingTrivia

func (b *Block) HasTrailingTrivia() bool

func (*Block) SyntaxNode

func (b *Block) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node of the block, and will either return an *hclsyntax.Block or syntax.None.

type Body

type Body struct {
	// The syntax node for the body, if any.
	Syntax *hclsyntax.Body
	// The tokens for the body.
	Tokens *syntax.BodyTokens

	// The items that make up the body's contents.
	Items []BodyItem
}

Body represents an HCL2 body. A Body may be the root of an HCL2 file or the contents of an HCL2 block.

func BindBody

func BindBody(body *hclsyntax.Body, scopes Scopes, tokens syntax.TokenMap,
	opts ...BindOption,
) (*Body, hcl.Diagnostics)

BindBody binds an HCL2 body using the given scopes and token map.

func (*Body) Attribute

func (b *Body) Attribute(name string) (*Attribute, bool)

Attribute returns the attribute with the givne in the body if any exists.

func (*Body) Blocks

func (b *Body) Blocks(typ string) []*Block

Blocks returns all blocks in the body with the given type.

func (*Body) Format

func (b *Body) Format(f fmt.State, c rune)

func (*Body) GetLeadingTrivia

func (b *Body) GetLeadingTrivia() syntax.TriviaList

func (*Body) GetTrailingTrivia

func (b *Body) GetTrailingTrivia() syntax.TriviaList

func (*Body) HasLeadingTrivia

func (b *Body) HasLeadingTrivia() bool

func (*Body) HasTrailingTrivia

func (b *Body) HasTrailingTrivia() bool

func (*Body) SyntaxNode

func (b *Body) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node of the body, and will either return an *hclsyntax.Body or syntax.None.

type BodyItem

type BodyItem interface {

	// SyntaxNode returns syntax node of the item.
	SyntaxNode() hclsyntax.Node
	// contains filtered or unexported methods
}

BodyItem represents either an *Attribute or a *Block that is part of an HCL2 Body.

func BodyItemIdentityVisitor

func BodyItemIdentityVisitor(n BodyItem) (BodyItem, hcl.Diagnostics)

func VisitBodyItem

func VisitBodyItem(n BodyItem, pre, post BodyItemVisitor) (BodyItem, hcl.Diagnostics)

type BodyItemVisitor

type BodyItemVisitor func(n BodyItem) (BodyItem, hcl.Diagnostics)

A BodyItemVisitor is a function that visits and optionally replaces the contents of a body item.

type ConditionalExpression

type ConditionalExpression struct {
	// The syntax node associated with the conditional expression.
	Syntax *hclsyntax.ConditionalExpr
	// The tokens associated with the expression, if any.
	Tokens syntax.NodeTokens

	// The condition.
	Condition Expression
	// The result of the expression if the condition evaluates to true.
	TrueResult Expression
	// The result of the expression if the condition evaluates to false.
	FalseResult Expression
	// contains filtered or unexported fields
}

ConditionalExpression represents a semantically-analzed conditional expression (i.e. <condition> '?' <true> ':' <false>).

func (*ConditionalExpression) Evaluate

func (x *ConditionalExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*ConditionalExpression) Format

func (x *ConditionalExpression) Format(f fmt.State, c rune)

func (*ConditionalExpression) GetLeadingTrivia

func (x *ConditionalExpression) GetLeadingTrivia() syntax.TriviaList

func (*ConditionalExpression) GetTrailingTrivia

func (x *ConditionalExpression) GetTrailingTrivia() syntax.TriviaList

func (*ConditionalExpression) HasLeadingTrivia

func (x *ConditionalExpression) HasLeadingTrivia() bool

func (*ConditionalExpression) HasTrailingTrivia

func (x *ConditionalExpression) HasTrailingTrivia() bool

func (*ConditionalExpression) NodeTokens

func (x *ConditionalExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the conditional expression.

func (*ConditionalExpression) SetLeadingTrivia

func (x *ConditionalExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*ConditionalExpression) SetTrailingTrivia

func (x *ConditionalExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*ConditionalExpression) SyntaxNode

func (x *ConditionalExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the conditional expression.

func (*ConditionalExpression) Type

func (x *ConditionalExpression) Type() Type

Type returns the type of the conditional expression.

func (*ConditionalExpression) Typecheck

func (x *ConditionalExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type ConstType added in v3.2.0

type ConstType struct {
	// Type is the underlying value type.
	Type Type
	// Value is the constant value.
	Value cty.Value
}

ConstType represents a type that is a single constant value.

func NewConstType added in v3.2.0

func NewConstType(typ Type, value cty.Value) *ConstType

NewConstType creates a new constant type with the given type and value.

func (*ConstType) AssignableFrom added in v3.2.0

func (t *ConstType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. A const(value) is assignable from const(value).

func (*ConstType) ConversionFrom added in v3.2.0

func (t *ConstType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type. The const type is only convertible from itself.

func (*ConstType) Equals added in v3.2.0

func (t *ConstType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*ConstType) Pretty added in v3.50.0

func (t *ConstType) Pretty() pretty.Formatter

func (*ConstType) String added in v3.2.0

func (t *ConstType) String() string

func (*ConstType) SyntaxNode added in v3.2.0

func (*ConstType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*ConstType) Traverse added in v3.2.0

func (t *ConstType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the type with the given traverser. The result is the traversal result of the underlying type.

type Constant

type Constant struct {
	// The syntax node associated with the constant definition, if any.
	Syntax hclsyntax.Node

	// The name of the constant.
	Name string
	// The value of the constant.
	ConstantValue cty.Value
	// contains filtered or unexported fields
}

A Constant is a traversable, typed definition that represents a named constant.

func (*Constant) SyntaxNode

func (c *Constant) SyntaxNode() hclsyntax.Node

SyntaxNode returns the constant's syntax node or syntax.None.

func (*Constant) Traverse

func (c *Constant) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Tracerse attempts to traverse the constant's value.

func (*Constant) Type

func (c *Constant) Type() Type

Type returns the type of the constant.

func (*Constant) Value

func (c *Constant) Value(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

type ConversionKind

type ConversionKind int
const (
	NoConversion     ConversionKind = 0
	UnsafeConversion ConversionKind = 1
	SafeConversion   ConversionKind = 2
)

func (ConversionKind) Exists

func (k ConversionKind) Exists() bool

type Definition

type Definition interface {
	Traversable

	SyntaxNode() hclsyntax.Node
}

Definition represents a single definition in a Scope.

type EnumType added in v3.30.0

type EnumType struct {
	// Elements are the possible values of the enum.
	Elements []cty.Value

	// The type of the enum's values.
	Type Type

	// Token that uniquely identifies a EnumType.
	// Given EnumA, EnumB of type EnumType
	// 		EnumA.Token != EnumB.Token => EnumA != EnumB (regardless of other fields)
	//
	// It is the responsibility of enum constructors to ensure that given EnumA,
	// EnumB of type EnumType
	//
	// 		EnumA.Token = EnumB.Token => EnumA = EnumB (all fields match)
	//
	// Failure to do so may lead to panics.
	Token string

	// Annotations records any annotations associated with the object type.
	Annotations []interface{}
	// contains filtered or unexported fields
}

EnumType represents values of a single type, and a closed set of possible values.

func NewEnumType added in v3.30.0

func NewEnumType(token string, typ Type, elements []cty.Value, annotations ...interface{}) *EnumType

func (*EnumType) AssignableFrom added in v3.30.0

func (t *EnumType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. The whole point of enums is they are a unique type, so we can't convert between them.

func (*EnumType) ConversionFrom added in v3.30.0

func (t *EnumType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type. Most languages support casting between value types and an enum of that value. When the value is constant, we can determine if the cast is valid. Otherwise it is valid but unsafe.

func (*EnumType) Equals added in v3.30.0

func (t *EnumType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*EnumType) Pretty added in v3.50.0

func (t *EnumType) Pretty() pretty.Formatter

func (*EnumType) String added in v3.30.0

func (t *EnumType) String() string

func (*EnumType) SyntaxNode added in v3.30.0

func (*EnumType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*EnumType) Traverse added in v3.30.0

func (t *EnumType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the enum type with the given traverser. This always fails.

type ErrorExpression

type ErrorExpression struct {
	// The syntax node associated with the error, if any.
	Syntax hclsyntax.Node
	// The tokens associated with the error.
	Tokens syntax.NodeTokens
	// The message associated with the error.
	Message string
	// contains filtered or unexported fields
}

ErrorExpression represents an expression that could not be bound due to an error.

func (*ErrorExpression) Evaluate

func (x *ErrorExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*ErrorExpression) Format

func (x *ErrorExpression) Format(f fmt.State, c rune)

func (*ErrorExpression) GetLeadingTrivia

func (x *ErrorExpression) GetLeadingTrivia() syntax.TriviaList

func (*ErrorExpression) GetTrailingTrivia

func (x *ErrorExpression) GetTrailingTrivia() syntax.TriviaList

func (*ErrorExpression) HasLeadingTrivia

func (x *ErrorExpression) HasLeadingTrivia() bool

func (*ErrorExpression) HasTrailingTrivia

func (x *ErrorExpression) HasTrailingTrivia() bool

func (*ErrorExpression) NodeTokens

func (x *ErrorExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the error expression.

func (*ErrorExpression) SetLeadingTrivia

func (x *ErrorExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*ErrorExpression) SetTrailingTrivia

func (x *ErrorExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*ErrorExpression) SyntaxNode

func (x *ErrorExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the error expression.

func (*ErrorExpression) Type

func (x *ErrorExpression) Type() Type

Type returns the type of the error expression.

func (*ErrorExpression) Typecheck

func (x *ErrorExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type Expression

type Expression interface {

	// SyntaxNode returns the hclsyntax.Node associated with the expression.
	SyntaxNode() hclsyntax.Node
	// NodeTokens returns the syntax.Tokens associated with the expression.
	NodeTokens() syntax.NodeTokens

	// SetLeadingTrivia sets the leading trivia associated with the expression.
	SetLeadingTrivia(syntax.TriviaList)
	// SetTrailingTrivia sets the trailing trivia associated with the expression.
	SetTrailingTrivia(syntax.TriviaList)

	// Type returns the type of the expression.
	Type() Type
	// Typecheck recomputes the type of the expression, optionally typechecking its operands first.
	Typecheck(typecheckOperands bool) hcl.Diagnostics

	// Evaluate evaluates the expression.
	Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
	// contains filtered or unexported methods
}

Expression represents a semantically-analyzed HCL2 expression.

func BindExpression

func BindExpression(syntax hclsyntax.Node, scope *Scope, tokens _syntax.TokenMap,
	opts ...BindOption,
) (Expression, hcl.Diagnostics)

BindExpression binds an HCL2 expression using the given scope and token map.

func BindExpressionText

func BindExpressionText(source string, scope *Scope, initialPos hcl.Pos,
	opts ...BindOption,
) (Expression, hcl.Diagnostics)

BindExpressionText parses and binds an HCL2 expression using the given scope.

func IdentityVisitor

func IdentityVisitor(n Expression) (Expression, hcl.Diagnostics)

IdentityVisitor is a ExpressionVisitor that returns the input node unchanged.

func VisitExpression

func VisitExpression(n Expression, pre, post ExpressionVisitor) (Expression, hcl.Diagnostics)

VisitExpression visits each node in an expression tree using the given pre- and post-order visitors. If the preorder visitor returns a new node, that node's descendents will be visited. VisitExpression returns the result of the post-order visitor. All diagnostics are accumulated.

type ExpressionVisitor

type ExpressionVisitor func(n Expression) (Expression, hcl.Diagnostics)

An ExpressionVisitor is a function that visits and optionally replaces a node in an expression tree.

type ForExpression

type ForExpression struct {
	fmt.Formatter

	// The syntax node associated with the for expression.
	Syntax *hclsyntax.ForExpr
	// The tokens associated with the expression, if any.
	Tokens syntax.NodeTokens

	// The key variable, if any.
	KeyVariable *Variable
	// The value variable.
	ValueVariable *Variable

	// The collection being iterated.
	Collection Expression
	// The expression that generates the keys of the result, if any. If this field is non-nil, the result is a map.
	Key Expression
	// The expression that generates the values of the result.
	Value Expression
	// The condition that filters the items of the result, if any.
	Condition Expression

	// True if the value expression is being grouped.
	Group bool

	// Whether the collection type should be strictly type-checked
	// When true, unsupported collection types will result in an error
	// otherwise a warning will be emitted
	StrictCollectionTypechecking bool
	// contains filtered or unexported fields
}

ForExpression represents a semantically-analyzed for expression.

func (*ForExpression) Evaluate

func (x *ForExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*ForExpression) Format

func (x *ForExpression) Format(f fmt.State, c rune)

func (*ForExpression) GetLeadingTrivia

func (x *ForExpression) GetLeadingTrivia() syntax.TriviaList

func (*ForExpression) GetTrailingTrivia

func (x *ForExpression) GetTrailingTrivia() syntax.TriviaList

func (*ForExpression) HasLeadingTrivia

func (x *ForExpression) HasLeadingTrivia() bool

func (*ForExpression) HasTrailingTrivia

func (x *ForExpression) HasTrailingTrivia() bool

func (*ForExpression) NodeTokens

func (x *ForExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the for expression.

func (*ForExpression) SetLeadingTrivia

func (x *ForExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*ForExpression) SetTrailingTrivia

func (x *ForExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*ForExpression) SyntaxNode

func (x *ForExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the for expression.

func (*ForExpression) Type

func (x *ForExpression) Type() Type

Type returns the type of the for expression.

func (*ForExpression) Typecheck

func (x *ForExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type Function

type Function struct {
	// contains filtered or unexported fields
}

Function represents a function definition.

func NewFunction

func NewFunction(signature FunctionSignature) *Function

NewFunction creates a new function with the given signature.

func (*Function) GetSignature

func (f *Function) GetSignature(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)

GetSignature returns the static signature of the function when it is invoked with the given arguments.

func (*Function) SyntaxNode

func (f *Function) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the function, which is always syntax.None.

func (*Function) Traverse

func (f *Function) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the function definition. This will always fail: functions are not traversable.

type FunctionCallExpression

type FunctionCallExpression struct {
	// The syntax node associated with the function call expression.
	Syntax *hclsyntax.FunctionCallExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.FunctionCallTokens

	// The name of the called function.
	Name string
	// The signature of the called function.
	Signature StaticFunctionSignature
	// The arguments to the function call.
	Args []Expression
	// ExpandFinal indicates that the final argument should be a tuple, list, or set whose elements will be passed as
	// individual arguments to the function.
	ExpandFinal bool
}

FunctionCallExpression represents a semantically-analyzed function call expression.

func (*FunctionCallExpression) Evaluate

func (x *FunctionCallExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*FunctionCallExpression) Format

func (x *FunctionCallExpression) Format(f fmt.State, c rune)

func (*FunctionCallExpression) GetLeadingTrivia

func (x *FunctionCallExpression) GetLeadingTrivia() syntax.TriviaList

func (*FunctionCallExpression) GetTrailingTrivia

func (x *FunctionCallExpression) GetTrailingTrivia() syntax.TriviaList

func (*FunctionCallExpression) HasLeadingTrivia

func (x *FunctionCallExpression) HasLeadingTrivia() bool

func (*FunctionCallExpression) HasTrailingTrivia

func (x *FunctionCallExpression) HasTrailingTrivia() bool

func (*FunctionCallExpression) NodeTokens

func (x *FunctionCallExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the function call expression.

func (*FunctionCallExpression) SetLeadingTrivia

func (x *FunctionCallExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*FunctionCallExpression) SetTrailingTrivia

func (x *FunctionCallExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*FunctionCallExpression) SyntaxNode

func (x *FunctionCallExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the function call expression.

func (*FunctionCallExpression) Type

func (x *FunctionCallExpression) Type() Type

Type returns the type of the function call expression.

func (*FunctionCallExpression) Typecheck

func (x *FunctionCallExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type FunctionSignature

type FunctionSignature interface {
	// GetSignature returns the static signature for the function when invoked with the given arguments.
	GetSignature(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)
}

FunctionSignature represents a possibly-type-polymorphic function signature.

type GenericFunctionSignature

type GenericFunctionSignature func(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)

GenericFunctionSignature represents a type-polymorphic function signature. The underlying function will be invoked by GenericFunctionSignature.GetSignature to compute the static signature of the function.

func (GenericFunctionSignature) GetSignature

func (fs GenericFunctionSignature) GetSignature(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)

GetSignature returns the static function signature when it is invoked with the given arguments.

type IndexExpression

type IndexExpression struct {
	// The syntax node associated with the index expression.
	Syntax *hclsyntax.IndexExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.IndexTokens

	// The collection being indexed.
	Collection Expression
	// The index key.
	Key Expression
	// Whether the collection type should be strictly type-checked
	// When true, unsupported collection types will result in an error
	// otherwise a warning will be emitted
	StrictCollectionTypechecking bool
	// contains filtered or unexported fields
}

IndexExpression represents a semantically-analyzed index expression.

func (*IndexExpression) Evaluate

func (x *IndexExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*IndexExpression) Format

func (x *IndexExpression) Format(f fmt.State, c rune)

func (*IndexExpression) GetLeadingTrivia

func (x *IndexExpression) GetLeadingTrivia() syntax.TriviaList

func (*IndexExpression) GetTrailingTrivia

func (x *IndexExpression) GetTrailingTrivia() syntax.TriviaList

func (*IndexExpression) HasLeadingTrivia

func (x *IndexExpression) HasLeadingTrivia() bool

func (*IndexExpression) HasTrailingTrivia

func (x *IndexExpression) HasTrailingTrivia() bool

func (*IndexExpression) KeyType

func (x *IndexExpression) KeyType() Type

KeyType returns the expected type of the index expression's key.

func (*IndexExpression) NodeTokens

func (x *IndexExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the index expression.

func (*IndexExpression) SetLeadingTrivia

func (x *IndexExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*IndexExpression) SetTrailingTrivia

func (x *IndexExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*IndexExpression) SyntaxNode

func (x *IndexExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the index expression.

func (*IndexExpression) Type

func (x *IndexExpression) Type() Type

Type returns the type of the index expression.

func (*IndexExpression) Typecheck

func (x *IndexExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type Keyword

type Keyword string

A Keyword is a non-traversable definition that allows scope traversals to bind to arbitrary keywords.

func (Keyword) SyntaxNode

func (kw Keyword) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the keyword, which is always syntax.None.

func (Keyword) Traverse

func (kw Keyword) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the keyword, and always fails.

type ListType

type ListType struct {
	// ElementType is the element type of the list.
	ElementType Type
}

ListType represents lists of particular element types.

func NewListType

func NewListType(elementType Type) *ListType

NewListType creates a new list type with the given element type.

func (*ListType) AssignableFrom

func (t *ListType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. A list(T) is assignable from values of type list(U) where T is assignable from U.

func (*ListType) ConversionFrom

func (t *ListType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type. A list(T) is safely convertible from list(U), set(U), or tuple(U_0 ... U_N) if the element type(s) U is/are safely convertible to T. If any element type is unsafely convertible to T and no element type is safely convertible to T, the conversion is unsafe. Otherwise, no conversion exists.

func (*ListType) Equals

func (t *ListType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*ListType) Pretty added in v3.50.0

func (t *ListType) Pretty() pretty.Formatter

func (*ListType) String

func (t *ListType) String() string

func (*ListType) SyntaxNode

func (*ListType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*ListType) Traverse

func (t *ListType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the optional type with the given traverser. The result type of traverse(list(T)) is T; the traversal fails if the traverser is not a number.

type LiteralValueExpression

type LiteralValueExpression struct {
	// The syntax node associated with the literal value expression.
	Syntax *hclsyntax.LiteralValueExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.LiteralValueTokens

	// The value of the expression.
	Value cty.Value
	// contains filtered or unexported fields
}

LiteralValueExpression represents a semantically-analyzed literal value expression.

func (*LiteralValueExpression) Evaluate

func (x *LiteralValueExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*LiteralValueExpression) Format

func (x *LiteralValueExpression) Format(f fmt.State, c rune)

func (*LiteralValueExpression) GetLeadingTrivia

func (x *LiteralValueExpression) GetLeadingTrivia() syntax.TriviaList

func (*LiteralValueExpression) GetTrailingTrivia

func (x *LiteralValueExpression) GetTrailingTrivia() syntax.TriviaList

func (*LiteralValueExpression) HasLeadingTrivia

func (x *LiteralValueExpression) HasLeadingTrivia() bool

func (*LiteralValueExpression) HasTrailingTrivia

func (x *LiteralValueExpression) HasTrailingTrivia() bool

func (*LiteralValueExpression) NodeTokens

func (x *LiteralValueExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the literal value expression.

func (*LiteralValueExpression) SetLeadingTrivia

func (x *LiteralValueExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*LiteralValueExpression) SetTrailingTrivia

func (x *LiteralValueExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*LiteralValueExpression) SyntaxNode

func (x *LiteralValueExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the literal value expression.

func (*LiteralValueExpression) Type

func (x *LiteralValueExpression) Type() Type

Type returns the type of the literal value expression.

func (*LiteralValueExpression) Typecheck

func (x *LiteralValueExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type MapType

type MapType struct {
	// ElementType is the element type of the map.
	ElementType Type
}

MapType represents maps from strings to particular element types.

func NewMapType

func NewMapType(elementType Type) *MapType

NewMapType creates a new map type with the given element type.

func (*MapType) AssignableFrom

func (t *MapType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. A map(T) is assignable from values of type map(U) where T is assignable from U or object(K_0=U_0, ..., K_N=U_N) if T is assignable from the unified type of U_0 through U_N.

func (*MapType) ConversionFrom

func (t *MapType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type. A map(T) is safely convertible from map(U) or object({K_0 = U_0 ... K_N = U_N}) if the element type(s) U is/are safely convertible to T. If any element type is unsafely convertible to T and no element type is safely convertible to T, the conversion is unsafe. Otherwise, no conversion exists.

func (*MapType) Equals

func (t *MapType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*MapType) Pretty added in v3.50.0

func (t *MapType) Pretty() pretty.Formatter

func (*MapType) String

func (t *MapType) String() string

func (*MapType) SyntaxNode

func (*MapType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*MapType) Traverse

func (t *MapType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the optional type with the given traverser. The result type of traverse(map(T)) is T; the traversal fails if the traverser is not a string.

type ObjectConsExpression

type ObjectConsExpression struct {
	// The syntax node associated with the object construction expression.
	Syntax *hclsyntax.ObjectConsExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.ObjectConsTokens

	// The items that comprise the object construction expression.
	Items []ObjectConsItem
	// contains filtered or unexported fields
}

ObjectConsExpression represents a semantically-analyzed object construction expression.

func (*ObjectConsExpression) Evaluate

func (x *ObjectConsExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*ObjectConsExpression) Format

func (x *ObjectConsExpression) Format(f fmt.State, c rune)

func (*ObjectConsExpression) GetLeadingTrivia

func (x *ObjectConsExpression) GetLeadingTrivia() syntax.TriviaList

func (*ObjectConsExpression) GetTrailingTrivia

func (x *ObjectConsExpression) GetTrailingTrivia() syntax.TriviaList

func (*ObjectConsExpression) HasLeadingTrivia

func (x *ObjectConsExpression) HasLeadingTrivia() bool

func (*ObjectConsExpression) HasTrailingTrivia

func (x *ObjectConsExpression) HasTrailingTrivia() bool

func (*ObjectConsExpression) NodeTokens

func (x *ObjectConsExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the object construction expression.

func (*ObjectConsExpression) SetLeadingTrivia

func (x *ObjectConsExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*ObjectConsExpression) SetTrailingTrivia

func (x *ObjectConsExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*ObjectConsExpression) SyntaxNode

func (x *ObjectConsExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the object construction expression.

func (*ObjectConsExpression) Type

func (x *ObjectConsExpression) Type() Type

Type returns the type of the object construction expression.

func (*ObjectConsExpression) Typecheck

func (x *ObjectConsExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

func (*ObjectConsExpression) WithType added in v3.43.0

func (x *ObjectConsExpression) WithType(updateType func(Type) *ObjectConsExpression) *ObjectConsExpression

type ObjectConsItem

type ObjectConsItem struct {
	// The key.
	Key Expression
	// The value.
	Value Expression
}

ObjectConsItem records a key-value pair that is part of object construction expression.

type ObjectType

type ObjectType struct {
	// Properties records the types of the object's properties.
	Properties map[string]Type
	// Annotations records any annotations associated with the object type.
	Annotations []interface{}
	// contains filtered or unexported fields
}

ObjectType represents schematized maps from strings to particular types.

func NewObjectType

func NewObjectType(properties map[string]Type, annotations ...interface{}) *ObjectType

NewObjectType creates a new object type with the given properties and annotations.

func (*ObjectType) AssignableFrom

func (t *ObjectType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. An object({K_0 = T_0, ..., K_N = T_N}) is assignable from U = object({K_0 = U_0, ... K_M = U_M}), where T_I is assignable from U[K_I] for all I from 0 to N.

func (*ObjectType) ConversionFrom

func (t *ObjectType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type.

An object({K_0 = T_0, ..., K_N = T_N}) is convertible from object({K_0 = U_0, ... K_M = U_M}) if all properties that exist in both types are convertible, and any keys that do not exist in the source type are optional in the destination type. If any of these conversions are unsafe, the whole conversion is unsafe; otherwise, the conversion is safe.

An object({K_0 = T_0, ..., K_N = T_N}) is convertible from a map(U) if U is convertible to all of T_0 through T_N. This conversion is always unsafe, and may fail if the map does not contain an appropriate set of keys for the destination type.

func (*ObjectType) Equals

func (t *ObjectType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*ObjectType) Pretty added in v3.50.0

func (t *ObjectType) Pretty() pretty.Formatter

func (*ObjectType) String

func (t *ObjectType) String() string

func (*ObjectType) SyntaxNode

func (*ObjectType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*ObjectType) Traverse

func (t *ObjectType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the optional type with the given traverser. The result type of traverse(object({K_0 = T_0, ..., K_N = T_N})) is T_i if the traverser is the string literal K_i. If the traverser is a string but not a literal, the result type is any.

type OpaqueType

type OpaqueType string

OpaqueType represents a type that is named by a string.

func NewOpaqueType

func NewOpaqueType(name string) *OpaqueType

func (*OpaqueType) AssignableFrom

func (t *OpaqueType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. A token(name) is assignable from token(name).

func (*OpaqueType) ConversionFrom

func (t *OpaqueType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type.

In general, an opaque type is only convertible from itself (in addition to the standard dynamic and union conversions). However, there are special rules for the builtin types:

- The dynamic type is safely convertible from any other type, and is unsafely convertible _to_ any other type - The string type is safely convertible from bool, number, and int - The number type is safely convertible from int and unsafely convertible from string - The int type is unsafely convertible from string - The bool type is unsafely convertible from string

func (*OpaqueType) Equals

func (t *OpaqueType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*OpaqueType) Pretty added in v3.50.0

func (t *OpaqueType) Pretty() pretty.Formatter

func (*OpaqueType) String

func (t *OpaqueType) String() string

func (*OpaqueType) SyntaxNode

func (*OpaqueType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*OpaqueType) Traverse

func (t *OpaqueType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the opaque type with the given traverser. The result type of traverse(opaque(name)) is dynamic if name is "dynamic"; otherwise the traversal fails.

type OutputType

type OutputType struct {
	// ElementType is the element type of the output.
	ElementType Type
}

OutputType represents eventual values that carry additional application-specific information.

func NewOutputType

func NewOutputType(elementType Type) *OutputType

NewOutputType creates a new output type with the given element type after replacing any output or promise types within the element type with their respective element types.

func (*OutputType) AssignableFrom

func (t *OutputType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. An output(T) is assignable from values of type output(U), promise(U), and U, where T is assignable from U.

func (*OutputType) ConversionFrom

func (t *OutputType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type. An output(T) is convertible from a type U, output(U), or promise(U) if U is convertible to T. If the conversion from U to T is unsafe, the entire conversion is unsafe. Otherwise, the conversion is safe.

func (*OutputType) Equals

func (t *OutputType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*OutputType) Pretty added in v3.50.0

func (t *OutputType) Pretty() pretty.Formatter

func (*OutputType) String

func (t *OutputType) String() string

func (*OutputType) SyntaxNode

func (*OutputType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*OutputType) Traverse

func (t *OutputType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the output type with the given traverser. The result type of traverse(output(T)) is output(traverse(T)).

type Parameter

type Parameter struct {
	Name string // The name of the parameter.
	Type Type   // The type of the parameter.
}

Parameter represents a single function parameter.

type PromiseType

type PromiseType struct {
	// ElementType is the element type of the promise.
	ElementType Type
}

PromiseType represents eventual values that do not carry additional information.

func NewPromiseType

func NewPromiseType(elementType Type) *PromiseType

NewPromiseType creates a new promise type with the given element type after replacing any promise types within the element type with their respective element types.

func (*PromiseType) AssignableFrom

func (t *PromiseType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. A promise(T) is assignable from values of type promise(U) and U, where T is assignable from U.

func (*PromiseType) ConversionFrom

func (t *PromiseType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type. An promise(T) is convertible from a type U or promise(U) if U is convertible to T. If the conversion from U to T is unsafe, the entire conversion is unsafe. Otherwise, the conversion is safe.

func (*PromiseType) Equals

func (t *PromiseType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*PromiseType) Pretty added in v3.50.0

func (t *PromiseType) Pretty() pretty.Formatter

func (*PromiseType) String

func (t *PromiseType) String() string

func (*PromiseType) SyntaxNode

func (*PromiseType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*PromiseType) Traverse

func (t *PromiseType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the promise type with the given traverser. The result type of traverse(promise(T)) is promise(traverse(T)).

type RelativeTraversalExpression

type RelativeTraversalExpression struct {
	// The syntax node associated with the relative traversal expression.
	Syntax *hclsyntax.RelativeTraversalExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.RelativeTraversalTokens

	// The expression that computes the value being traversed.
	Source Expression
	// The traversal's parts.
	Parts []Traversable

	// The traversers.
	Traversal hcl.Traversal
}

RelativeTraversalExpression represents a semantically-analyzed relative traversal expression.

func (*RelativeTraversalExpression) Evaluate

func (x *RelativeTraversalExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*RelativeTraversalExpression) Format

func (x *RelativeTraversalExpression) Format(f fmt.State, c rune)

func (*RelativeTraversalExpression) GetLeadingTrivia

func (x *RelativeTraversalExpression) GetLeadingTrivia() syntax.TriviaList

func (*RelativeTraversalExpression) GetTrailingTrivia

func (x *RelativeTraversalExpression) GetTrailingTrivia() syntax.TriviaList

func (*RelativeTraversalExpression) HasLeadingTrivia

func (x *RelativeTraversalExpression) HasLeadingTrivia() bool

func (*RelativeTraversalExpression) HasTrailingTrivia

func (x *RelativeTraversalExpression) HasTrailingTrivia() bool

func (*RelativeTraversalExpression) NodeTokens

NodeTokens returns the tokens associated with the relative traversal expression.

func (*RelativeTraversalExpression) SetLeadingTrivia

func (x *RelativeTraversalExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*RelativeTraversalExpression) SetTrailingTrivia

func (x *RelativeTraversalExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*RelativeTraversalExpression) SyntaxNode

func (x *RelativeTraversalExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the relative traversal expression.

func (*RelativeTraversalExpression) Type

Type returns the type of the relative traversal expression.

func (*RelativeTraversalExpression) Typecheck

func (x *RelativeTraversalExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type Scope

type Scope struct {
	// contains filtered or unexported fields
}

A Scope is used to map names to definitions during expression binding.

A scope has three namespaces:

  • one that is exclusive to functions
  • one that is exclusive to output variables
  • and one that contains config variables, local variables and resource definitions.

When binding a reference, we check `defs` and `outputs`. When binding a function, we check `functions`. Definitions within a namespace such as `defs`, `outputs` or `functions` are expected to have a unique identifier and cannot be redeclared.

var TypeScope *Scope

func NewRootScope

func NewRootScope(syntax hclsyntax.Node) *Scope

NewRootScope returns a new unparented scope associated with the given syntax node.

func (*Scope) BindFunctionReference

func (s *Scope) BindFunctionReference(name string) (*Function, bool)

BindFunctionReference returns the function definition that corresponds to the given name, if any. Each parent scope is checked until a definition is found or no parent scope remains.

func (*Scope) BindReference

func (s *Scope) BindReference(name string) (Definition, bool)

BindReference returns the definition that corresponds to the given name, if any. Each parent scope is checked until a definition is found or no parent scope remains.

func (*Scope) Define

func (s *Scope) Define(name string, def Definition) bool

Define maps the given name to the given definition. If the name is already defined in this scope, the existing definition is not overwritten and Define returns false.

func (*Scope) DefineFunction

func (s *Scope) DefineFunction(name string, def *Function) bool

DefineFunction maps the given function name to the given function definition. If the function is alreadu defined in this scope, the definition is not overwritten and DefineFunction returns false.

func (*Scope) DefineScope

func (s *Scope) DefineScope(name string, syntax hclsyntax.Node) (*Scope, bool)

DefineScope defines a child scope with the given name. If the name is already defined in this scope, the existing definition is not overwritten and DefineScope returns false.

func (*Scope) Pop

func (s *Scope) Pop() *Scope

Pop returns this scope's parent.

func (*Scope) Push

func (s *Scope) Push(syntax hclsyntax.Node) *Scope

Push defines an anonymous child scope associated with the given syntax node.

func (*Scope) SyntaxNode

func (s *Scope) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the scope, if any.

func (*Scope) Traverse

func (s *Scope) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the scope using the given traverser. If the traverser is a literal string that refers to a name defined within the scope or one of its ancestors, the traversal returns the corresponding definition.

type ScopeTraversalExpression

type ScopeTraversalExpression struct {
	// The syntax node associated with the scope traversal expression.
	Syntax *hclsyntax.ScopeTraversalExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.ScopeTraversalTokens

	// The traversal's parts.
	Parts []Traversable

	// The root name.
	RootName string
	// The traversers.
	Traversal hcl.Traversal
}

ScopeTraversalExpression represents a semantically-analyzed scope traversal expression.

func ConstantReference

func ConstantReference(c *Constant) *ScopeTraversalExpression

func VariableReference

func VariableReference(v *Variable) *ScopeTraversalExpression

func (*ScopeTraversalExpression) Evaluate

func (x *ScopeTraversalExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*ScopeTraversalExpression) Format

func (x *ScopeTraversalExpression) Format(f fmt.State, c rune)

func (*ScopeTraversalExpression) GetLeadingTrivia

func (x *ScopeTraversalExpression) GetLeadingTrivia() syntax.TriviaList

func (*ScopeTraversalExpression) GetTrailingTrivia

func (x *ScopeTraversalExpression) GetTrailingTrivia() syntax.TriviaList

func (*ScopeTraversalExpression) HasLeadingTrivia

func (x *ScopeTraversalExpression) HasLeadingTrivia() bool

func (*ScopeTraversalExpression) HasTrailingTrivia

func (x *ScopeTraversalExpression) HasTrailingTrivia() bool

func (*ScopeTraversalExpression) NodeTokens

func (x *ScopeTraversalExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the scope traversal expression.

func (*ScopeTraversalExpression) SetLeadingTrivia

func (x *ScopeTraversalExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*ScopeTraversalExpression) SetTrailingTrivia

func (x *ScopeTraversalExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*ScopeTraversalExpression) SyntaxNode

func (x *ScopeTraversalExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the scope traversal expression.

func (*ScopeTraversalExpression) Type

func (x *ScopeTraversalExpression) Type() Type

Type returns the type of the scope traversal expression.

func (*ScopeTraversalExpression) Typecheck

func (x *ScopeTraversalExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type Scopes

type Scopes interface {
	// GetScopesForBlock returns the Scopes that should be used when binding the given block.
	GetScopesForBlock(block *hclsyntax.Block) (Scopes, hcl.Diagnostics)
	// GetScopeForAttribute returns the *Scope that should be used when binding the given attribute.
	GetScopeForAttribute(attribute *hclsyntax.Attribute) (*Scope, hcl.Diagnostics)
}

Scopes is the interface that is used fetch the scope that should be used when binding a block or attribute.

func StaticScope

func StaticScope(scope *Scope) Scopes

StaticScope returns a Scopes that uses the given *Scope for all blocks and attributes.

type SetType

type SetType struct {
	// ElementType is the element type of the set.
	ElementType Type
}

SetType represents sets of particular element types.

func NewSetType

func NewSetType(elementType Type) *SetType

NewSetType creates a new set type with the given element type.

func (*SetType) AssignableFrom

func (t *SetType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. A set(T) is assignable from values of type set(U) where T is assignable from U.

func (*SetType) ConversionFrom

func (t *SetType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type. A set(T) is convertible from a set(U) if a conversion exists from U to T. If the conversion from U to T is unsafe, the entire conversion is unsafe; otherwise the conversion is safe. An unsafe conversion exists from list(U) or or tuple(U_0 ... U_N) to set(T) if a conversion exists from each U to T.

func (*SetType) Equals

func (t *SetType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*SetType) Pretty added in v3.50.0

func (t *SetType) Pretty() pretty.Formatter

func (*SetType) String

func (t *SetType) String() string

func (*SetType) SyntaxNode

func (*SetType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*SetType) Traverse

func (t *SetType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the optional type with the given traverser. This always fails.

type SplatExpression

type SplatExpression struct {
	// The syntax node associated with the splat expression.
	Syntax *hclsyntax.SplatExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.SplatTokens

	// The expression being splatted.
	Source Expression
	// The expression applied to each element of the splat.
	Each Expression
	// The local variable definition associated with the current item being processed. This definition is not part of
	// a scope, and can only be referenced by an AnonSymbolExpr.
	Item *SplatVariable
	// contains filtered or unexported fields
}

SplatExpression represents a semantically-analyzed splat expression.

func (*SplatExpression) Evaluate

func (x *SplatExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*SplatExpression) Format

func (x *SplatExpression) Format(f fmt.State, c rune)

func (*SplatExpression) GetLeadingTrivia

func (x *SplatExpression) GetLeadingTrivia() syntax.TriviaList

func (*SplatExpression) GetTrailingTrivia

func (x *SplatExpression) GetTrailingTrivia() syntax.TriviaList

func (*SplatExpression) HasLeadingTrivia

func (x *SplatExpression) HasLeadingTrivia() bool

func (*SplatExpression) HasTrailingTrivia

func (x *SplatExpression) HasTrailingTrivia() bool

func (*SplatExpression) NodeTokens

func (x *SplatExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the splat expression.

func (*SplatExpression) SetLeadingTrivia

func (x *SplatExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*SplatExpression) SetTrailingTrivia

func (x *SplatExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*SplatExpression) SyntaxNode

func (x *SplatExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the splat expression.

func (*SplatExpression) Type

func (x *SplatExpression) Type() Type

Type returns the type of the splat expression.

func (*SplatExpression) Typecheck

func (x *SplatExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type SplatVariable

type SplatVariable struct {
	Variable
	// contains filtered or unexported fields
}

func (*SplatVariable) Value

func (v *SplatVariable) Value(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

type StaticFunctionSignature

type StaticFunctionSignature struct {
	// The function's fixed parameters.
	Parameters []Parameter
	// The function's variadic parameter, if any. Any arguments that follow a function's fixed arguments must be
	// assignable to this parameter.
	VarargsParameter *Parameter
	// The return type of the function.
	ReturnType Type
	// Determines whether the input bag should be treated as a single argument or as multiple arguments.
	MultiArgumentInputs bool
}

StaticFunctionSignature records the parameters and return type of a function.

func (StaticFunctionSignature) GetSignature

func (fs StaticFunctionSignature) GetSignature(arguments []Expression) (StaticFunctionSignature, hcl.Diagnostics)

GetSignature returns the static signature itself.

type TemplateExpression

type TemplateExpression struct {
	// The syntax node associated with the template expression.
	Syntax *hclsyntax.TemplateExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.TemplateTokens

	// The parts of the template expression.
	Parts []Expression
	// contains filtered or unexported fields
}

TemplateExpression represents a semantically-analyzed template expression.

func (*TemplateExpression) Evaluate

func (x *TemplateExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*TemplateExpression) Format

func (x *TemplateExpression) Format(f fmt.State, c rune)

func (*TemplateExpression) GetLeadingTrivia

func (x *TemplateExpression) GetLeadingTrivia() syntax.TriviaList

func (*TemplateExpression) GetTrailingTrivia

func (x *TemplateExpression) GetTrailingTrivia() syntax.TriviaList

func (*TemplateExpression) HasLeadingTrivia

func (x *TemplateExpression) HasLeadingTrivia() bool

func (*TemplateExpression) HasTrailingTrivia

func (x *TemplateExpression) HasTrailingTrivia() bool

func (*TemplateExpression) NodeTokens

func (x *TemplateExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the template expression.

func (*TemplateExpression) SetLeadingTrivia

func (x *TemplateExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*TemplateExpression) SetTrailingTrivia

func (x *TemplateExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*TemplateExpression) SyntaxNode

func (x *TemplateExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the template expression.

func (*TemplateExpression) Type

func (x *TemplateExpression) Type() Type

Type returns the type of the template expression.

func (*TemplateExpression) Typecheck

func (x *TemplateExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type TemplateJoinExpression

type TemplateJoinExpression struct {
	// The syntax node associated with the template join expression.
	Syntax *hclsyntax.TemplateJoinExpr

	// The tuple being joined.
	Tuple Expression
	// contains filtered or unexported fields
}

TemplateJoinExpression represents a semantically-analyzed template join expression.

func (*TemplateJoinExpression) Evaluate

func (x *TemplateJoinExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*TemplateJoinExpression) Format

func (x *TemplateJoinExpression) Format(f fmt.State, c rune)

func (*TemplateJoinExpression) GetLeadingTrivia

func (x *TemplateJoinExpression) GetLeadingTrivia() syntax.TriviaList

func (*TemplateJoinExpression) GetTrailingTrivia

func (x *TemplateJoinExpression) GetTrailingTrivia() syntax.TriviaList

func (*TemplateJoinExpression) HasLeadingTrivia

func (x *TemplateJoinExpression) HasLeadingTrivia() bool

func (*TemplateJoinExpression) HasTrailingTrivia

func (x *TemplateJoinExpression) HasTrailingTrivia() bool

func (*TemplateJoinExpression) NodeTokens

func (x *TemplateJoinExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the template join expression.

func (*TemplateJoinExpression) SetLeadingTrivia

func (x *TemplateJoinExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*TemplateJoinExpression) SetTrailingTrivia

func (x *TemplateJoinExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*TemplateJoinExpression) SyntaxNode

func (x *TemplateJoinExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the template join expression.

func (*TemplateJoinExpression) Type

func (x *TemplateJoinExpression) Type() Type

Type returns the type of the template join expression.

func (*TemplateJoinExpression) Typecheck

func (x *TemplateJoinExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type Traversable

type Traversable interface {
	// Traverse attempts to traverse the receiver using the given traverser.
	Traverse(t hcl.Traverser) (Traversable, hcl.Diagnostics)
}

Traversable represents an entity that can be traversed by an HCL2 traverser.

type TupleConsExpression

type TupleConsExpression struct {
	// The syntax node associated with the tuple construction expression.
	Syntax *hclsyntax.TupleConsExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.TupleConsTokens

	// The elements of the tuple.
	Expressions []Expression
	// contains filtered or unexported fields
}

TupleConsExpression represents a semantically-analyzed tuple construction expression.

func (*TupleConsExpression) Evaluate

func (x *TupleConsExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*TupleConsExpression) Format

func (x *TupleConsExpression) Format(f fmt.State, c rune)

func (*TupleConsExpression) GetLeadingTrivia

func (x *TupleConsExpression) GetLeadingTrivia() syntax.TriviaList

func (*TupleConsExpression) GetTrailingTrivia

func (x *TupleConsExpression) GetTrailingTrivia() syntax.TriviaList

func (*TupleConsExpression) HasLeadingTrivia

func (x *TupleConsExpression) HasLeadingTrivia() bool

func (*TupleConsExpression) HasTrailingTrivia

func (x *TupleConsExpression) HasTrailingTrivia() bool

func (*TupleConsExpression) NodeTokens

func (x *TupleConsExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the tuple construction expression.

func (*TupleConsExpression) SetLeadingTrivia

func (x *TupleConsExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*TupleConsExpression) SetTrailingTrivia

func (x *TupleConsExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*TupleConsExpression) SyntaxNode

func (x *TupleConsExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the tuple construction expression.

func (*TupleConsExpression) Type

func (x *TupleConsExpression) Type() Type

Type returns the type of the tuple construction expression.

func (*TupleConsExpression) Typecheck

func (x *TupleConsExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type TupleType

type TupleType struct {
	// ElementTypes are the types of the tuple's elements.
	ElementTypes []Type
	// contains filtered or unexported fields
}

TupleType represents values that are a sequence of independently-typed elements.

func (*TupleType) AssignableFrom

func (t *TupleType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type..

func (*TupleType) ConversionFrom

func (t *TupleType) ConversionFrom(src Type) ConversionKind

func (*TupleType) Equals

func (t *TupleType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*TupleType) Pretty added in v3.50.0

func (t *TupleType) Pretty() pretty.Formatter

func (*TupleType) String

func (t *TupleType) String() string

func (*TupleType) SyntaxNode

func (*TupleType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*TupleType) Traverse

func (t *TupleType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the tuple type with the given traverser. This always fails.

type Type

type Type interface {
	fmt.Stringer
	Definition

	Equals(other Type) bool
	AssignableFrom(src Type) bool
	ConversionFrom(src Type) ConversionKind

	Pretty() pretty.Formatter
	// contains filtered or unexported methods
}

Type represents a datatype in the Pulumi Schema. Types created by this package are identical if they are equal values.

func GetTraversableType

func GetTraversableType(t Traversable) Type

GetTraversableType returns the type of the given Traversable: - If the Traversable is a TypedTraversable, this returns t.Type() - If the Traversable is a Type, this returns t - Otherwise, this returns DynamicType

func GetTraverserKey

func GetTraverserKey(t hcl.Traverser) (cty.Value, Type)

GetTraverserKey extracts the value and type of the key associated with the given traverser.

func InputType

func InputType(t Type) Type

InputType returns the result of replacing each type in T with union(T, output(T)).

func NewOptionalType

func NewOptionalType(t Type) Type

NewOptionalType returns a new union(T, None).

func NewTupleType

func NewTupleType(elementTypes ...Type) Type

NewTupleType creates a new tuple type with the given element types.

func NewUnionType

func NewUnionType(types ...Type) Type

NewUnionType creates a new union type with the given element types. Any element types that are union types are replaced with their element types.

func NewUnionTypeAnnotated added in v3.2.0

func NewUnionTypeAnnotated(types []Type, annotations ...interface{}) Type

NewUnionTypeAnnotated creates a new union type with the given element types and annotations. NewUnionTypeAnnotated enforces 3 properties on the returned type: 1. Any element types that are union types are replaced with their element types. 2. Any duplicate types are removed. 3. Unions have have more then 1 type. If only a single type is left after (1) and (2), it is returned as is.

func ResolveOutputs

func ResolveOutputs(t Type) Type

ResolveOutputs recursively replaces all output(T) and promise(T) types in the input type with their element type.

func ResolvePromises

func ResolvePromises(t Type) Type

ResolvePromises recursively replaces all promise(T) types in the input type with their element type.

type TypedTraversable

type TypedTraversable interface {
	Traversable

	Type() Type
}

TypedTraversable is a Traversable that has an associated type.

type UnaryOpExpression

type UnaryOpExpression struct {
	// The syntax node associated with the unary operation.
	Syntax *hclsyntax.UnaryOpExpr
	// The tokens associated with the expression, if any.
	Tokens *syntax.UnaryOpTokens

	// The operation.
	Operation *hclsyntax.Operation
	// The operand of the operation.
	Operand Expression
	// contains filtered or unexported fields
}

UnaryOpExpression represents a semantically-analyzed unary operation.

func (*UnaryOpExpression) Evaluate

func (x *UnaryOpExpression) Evaluate(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

func (*UnaryOpExpression) Format

func (x *UnaryOpExpression) Format(f fmt.State, c rune)

func (*UnaryOpExpression) GetLeadingTrivia

func (x *UnaryOpExpression) GetLeadingTrivia() syntax.TriviaList

func (*UnaryOpExpression) GetTrailingTrivia

func (x *UnaryOpExpression) GetTrailingTrivia() syntax.TriviaList

func (*UnaryOpExpression) HasLeadingTrivia

func (x *UnaryOpExpression) HasLeadingTrivia() bool

func (*UnaryOpExpression) HasTrailingTrivia

func (x *UnaryOpExpression) HasTrailingTrivia() bool

func (*UnaryOpExpression) NodeTokens

func (x *UnaryOpExpression) NodeTokens() syntax.NodeTokens

NodeTokens returns the tokens associated with the unary operation.

func (*UnaryOpExpression) OperandType

func (x *UnaryOpExpression) OperandType() Type

OperandType returns the operand type of the unary operation.

func (*UnaryOpExpression) SetLeadingTrivia

func (x *UnaryOpExpression) SetLeadingTrivia(t syntax.TriviaList)

func (*UnaryOpExpression) SetTrailingTrivia

func (x *UnaryOpExpression) SetTrailingTrivia(t syntax.TriviaList)

func (*UnaryOpExpression) SyntaxNode

func (x *UnaryOpExpression) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node associated with the unary operation.

func (*UnaryOpExpression) Type

func (x *UnaryOpExpression) Type() Type

Type returns the type of the unary operation.

func (*UnaryOpExpression) Typecheck

func (x *UnaryOpExpression) Typecheck(typecheckOperands bool) hcl.Diagnostics

type UnionType

type UnionType struct {
	// ElementTypes are the allowable types for the union type.
	ElementTypes []Type
	// Annotations records any annotations associated with the object type.
	Annotations []interface{}
	// contains filtered or unexported fields
}

UnionType represents values that may be any one of a specified set of types.

func (*UnionType) AssignableFrom

func (t *UnionType) AssignableFrom(src Type) bool

AssignableFrom returns true if this type is assignable from the indicated source type. A union(T_0, ..., T_N) from values of type union(U_0, ..., U_M) where all of U_0 through U_M are assignable to some type in (T_0, ..., T_N) and V where V is assignable to at least one of (T_0, ..., T_N).

func (*UnionType) ConversionFrom

func (t *UnionType) ConversionFrom(src Type) ConversionKind

ConversionFrom returns the kind of conversion (if any) that is possible from the source type to this type. A union type is convertible from a source type if any of its elements are convertible from the source type. If any element type is safely convertible, the conversion is safe; if no element is safely convertible but some element is unsafely convertible, the conversion is unsafe.

func (*UnionType) Equals

func (t *UnionType) Equals(other Type) bool

Equals returns true if this type has the same identity as the given type.

func (*UnionType) Pretty added in v3.50.0

func (t *UnionType) Pretty() pretty.Formatter

func (*UnionType) String

func (t *UnionType) String() string

func (*UnionType) SyntaxNode

func (*UnionType) SyntaxNode() hclsyntax.Node

SyntaxNode returns the syntax node for the type. This is always syntax.None.

func (*UnionType) Traverse

func (t *UnionType) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the union type with the given traverser. This always fails.

type ValueTraversable

type ValueTraversable interface {
	Traversable

	Value(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)
}

ValueTraversable is a Traversable that has an associated value.

type Variable

type Variable struct {
	// The syntax node associated with the variable definition, if any.
	Syntax hclsyntax.Node

	// The name of the variable.
	Name string
	// The type of the variable.
	VariableType Type
}

A Variable is a traversable, typed definition that represents a named value.

func (*Variable) SyntaxNode

func (v *Variable) SyntaxNode() hclsyntax.Node

SyntaxNode returns the variable's syntax node or syntax.None.

func (*Variable) Traverse

func (v *Variable) Traverse(traverser hcl.Traverser) (Traversable, hcl.Diagnostics)

Traverse attempts to traverse the variable's type.

func (*Variable) Type

func (v *Variable) Type() Type

Type returns the type of the variable.

func (*Variable) Value

func (v *Variable) Value(context *hcl.EvalContext) (cty.Value, hcl.Diagnostics)

Directories

Path Synopsis
pretty is an extensible utility library to pretty-print nested structures.
pretty is an extensible utility library to pretty-print nested structures.

Jump to

Keyboard shortcuts

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