check

package
v0.7.0-1a Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package check runs the compile-time checks over a parsed stack: reference and type resolution, literal constraint evaluation, and @for-each nesting. The compiler runs every check; a factory binary's validate command re-runs the reference check on demand. Construction builds the stack's dependency graph once, and the graph is shared with whoever goes on to execute the stack.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

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

Checker runs the compile-time checks over a parsed, validated stack file. Construction builds the stack's dependency graph and the scope tables for every composite call site once; each check method walks them and returns its own diagnostics. The graph is exposed so callers executing the stack share the structure the checks ran against.

func New

func New(f *lang.File, libs map[string]*runtime.Library) *Checker

New builds the check state for a parsed stack file. libs is the imported-library table resolved for the file.

func (*Checker) DAG

func (c *Checker) DAG() *runtime.DAG

DAG returns the stack's dependency graph.

func (*Checker) ForEachNesting

func (c *Checker) ForEachNesting() *lang.ErrorList

ForEachNesting reports any node declaring @for-each whose enclosing composite chain already iterates: no fan-out exists for an iteration nested inside another, and a body that never reads @each would otherwise quietly plan a single instance where several were declared. The compile command runs this with every composite body the stack reaches expanded, so the factory binary never holds the construct.

func (*Checker) LiteralConstraints

func (c *Checker) LiteralConstraints() *lang.ErrorList

LiteralConstraints reports cross-field constraint violations that are decidable at compile time. It evaluates each library node's fields with no inputs or upstream outputs in scope and checks every constraint whose referenced fields all reduce that way (an absent field reads as null); a constraint that reads a deferred field is left for plan, which checks it once the value is known. Only Go libraries declare constraints in their schema, so UB composite nodes never match here, and their bodies check at plan.

func (*Checker) References

func (c *Checker) References(observe func(e lang.Expr, t typecheck.Type)) *lang.ErrorList

References reports references that cannot resolve to an input binding, node address, or active for-each binding, along with the type errors the resolved schemas expose. A non-nil observe receives every inferred expression with its type; the residual-Unknown harness reads the stream.

Jump to

Keyboard shortcuts

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