RustQ.Meta.Inference (rustq v0.9.2)

Copy Markdown View Source

Performs block-local type inference used by Rusty-Elixir lowering.

This module intentionally stays scoped to straight-line block inference. It propagates expected argument types from later callable uses back to earlier local let bindings and carries known let RHS types forward so receiver method calls can participate in the same pass.

Summary

Types

callbacks()

@type callbacks() :: %{
  :return_type => (Macro.t() -> RustQ.Meta.Type.t() | nil),
  :local_argument_types => (atom(), non_neg_integer() ->
                              [RustQ.Meta.Type.t()] | nil),
  :path_argument_types => ([atom()], atom(), non_neg_integer() ->
                             [RustQ.Meta.Type.t()] | nil),
  :method_argument_types => (RustQ.Meta.Type.t()
                             | nil,
                             atom(),
                             non_neg_integer() ->
                               [RustQ.Meta.Type.t()] | nil),
  :target_type => (RustQ.Meta.Type.t() | nil -> term()),
  :method_receiver_type => (atom(), non_neg_integer() ->
                              RustQ.Meta.Type.t() | nil),
  optional(:block_return_type) => RustQ.Meta.Type.t() | nil
}

Functions

infer_downstream_let_types(expressions, vars, callbacks)

@spec infer_downstream_let_types([Macro.t()], map(), callbacks()) :: map()