Dsxir.Predicate.TypeChecker (dsxir v0.2.0)

Copy Markdown

Walks a predicate AST against a per-namespace field-type environment.

Root expression must type-check to :boolean.

Summary

Functions

Type-check a parsed predicate expression against an env.

Types

env()

@type env() :: %{required(atom()) => %{required(atom()) => type()}}

type()

@type type() :: Dsxir.Predicate.AST.type() | {:list, type()}

Functions

check(expr, env)

@spec check(Dsxir.Predicate.AST.t_expr(), env()) :: :ok | {:error, map()}

Type-check a parsed predicate expression against an env.

Returns :ok when the root expression is :boolean, otherwise {:error, map()} with :code, :expected, :got (and optionally :unknown, :what) details.