Module infer

Module infer 

Source
Expand description

AST-based type inference for Plotnik queries.

Analyzes query AST to determine output types. Rules follow ADR-0009 (Type System).

§Design

Unlike graph-based inference which must reconstruct structure from CFG traversal, AST-based inference directly walks the tree structure:

  • Sequences → SeqExpr
  • Alternations → AltExpr with .kind() for tagged/untagged
  • Quantifiers → QuantifiedExpr
  • Captures → CapturedExpr

This eliminates dry-run traversal, reconvergence detection, and scope stack management.

Structs§

InferredMember
A field (for Record) or variant (for Enum).
InferredTypeDef
An inferred type definition.
TypeInferenceResult
Result of type inference.
UnificationError
Error when types cannot be unified in alternation branches.

Enums§

TypeDescription
Human-readable type description for error messages.