RustQ.Meta.Typing (rustq v0.9.3)

Copy Markdown View Source

Small bidirectional typing nucleus for Rusty-Elixir lowering.

This module intentionally starts as an explicit, side-effect-free companion to RustQ.Meta.Lower: callers pass an %Env{} instead of relying on the lowerer's process dictionary. The lowerer can migrate individual positions to synth/2 and check/3 over time.

Summary

Types

env_source()

@type env_source() :: RustQ.Meta.Typing.Env.t() | keyword()

Functions

check(ast, expected, opts)

env(opts \\ [])

@spec env(keyword()) :: RustQ.Meta.Typing.Env.t()

expected_for_let(pattern, expression, opts)

@spec expected_for_let(Macro.t(), Macro.t(), env_source()) ::
  RustQ.Meta.Type.t() | nil

infer_downstream_let_types(expressions, env_or_opts, callbacks \\ %{})

@spec infer_downstream_let_types([Macro.t()], env_source(), map()) :: %{
  optional(atom()) => RustQ.Meta.Type.t()
}

struct_field_type(type, field)

@spec struct_field_type(RustQ.Meta.Type.t(), atom()) :: RustQ.Meta.Type.t() | nil

synth(call_ast, env)

@spec synth(Macro.t(), env_source()) :: RustQ.Meta.Type.t() | nil