ToolCall.LocalTypeAlgorithm (ToolCall v0.4.0)

Copy Markdown

Shared local-type expansion algorithm used by AST and, later, TypeExpr.

The algorithm owns cyclic detection, inlining and instantiation budgets, hoisting, and $defs naming. Adapters supply the node structure, variable substitution, reference syntax, and naming details.

Summary

Types

One hoisted $defs entry, with the arguments of its instantiation.

Types

instantiation()

@type instantiation() :: %{
  key: ToolCall.LocalTypeAlgorithm.Adapter.key(),
  args: [term()],
  body: term()
}

One hoisted $defs entry, with the arguments of its instantiation.

Functions

cyclic_keys(definitions, adapter)

expand(root, definitions, adapter, opts \\ [])

@spec expand(term(), map(), module(), keyword()) ::
  {term(), boolean(), [instantiation()]}

max_defs()

@spec max_defs() :: pos_integer()