Documentation
¶
Index ¶
Constants ¶
const DiagnosticContractVersion = "v1"
DiagnosticContractVersion versions the diagnostic wire format. This is independent of Graph.Version, which versions the graph schema instead — the two happen to both start at "v1" but track different things.
const TargetBytecode = "bytecode"
TargetBytecode is the verifier target identity for the standalone bytecode runtime. howlframe.go's hfirTargetBytecode must spell it the same way; the two are tied together by TestVerifyConstructsMatchesBytecodeTargetName.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Diagnostic ¶
type Diagnostic struct {
Code string `json:"code"`
Severity Severity `json:"severity"`
Message string `json:"message"`
Location Provenance `json:"location"`
RelatedNode NodeID `json:"related_node,omitempty"`
ContractVersion string `json:"contract_version"`
Target string `json:"target,omitempty"`
}
func VerifyConstructs ¶
func VerifyConstructs(root *ast.Node, target string) []Diagnostic
VerifyConstructs reports every construct in root that the given target cannot execute, as HFIR_TARGET_INFEASIBLE diagnostics in source order.
This deliberately runs over the AST rather than over Graph node kinds. LowerAST derives a node's Kind from the head symbol of every list, including lists that are not constructs at all - a (let (x 0) body) binding lowers to a node with Kind "x", and a try_let's catch clause lowers to a node with Kind "catch" even though internal/bytecode's try_let case destructures it directly and it never reaches compileNode in head position. A rule matching on Kind would therefore reject correct programs. internal/construct's Scan keeps the parent and child position the AST still carries, so the classification is exact (bugs.md #45).
Only the bytecode target has construct-support rules today. Every other target identity - including the empty target used by -validate, which is target-independent by contract - returns no diagnostics.
type Graph ¶
type LoweringContext ¶
type Node ¶
type Node struct {
ID NodeID `json:"id"`
Kind string `json:"kind"`
Module string `json:"module,omitempty"`
Provenance Provenance `json:"provenance"`
DataInputs []DataEdge `json:"data_inputs,omitempty"`
ControlEdges []NodeID `json:"control_edges,omitempty"`
Effects []Effect `json:"effects,omitempty"`
Type ast.TypeInfo `json:"type"`
Value string `json:"value,omitempty"`
}
type Provenance ¶
type Verifier ¶
type Verifier struct {
Graph *Graph
Diagnostics []Diagnostic
Target string
}
func NewVerifier ¶
func (*Verifier) Verify ¶
func (v *Verifier) Verify() []Diagnostic