Typle.SignatureStore
(Typle v0.1.0)
View Source
ETS-backed cache of function type signatures.
Pre-loads function signatures from compiled .beam files for the
project and all dependencies. Used by the inference engine to look up
return types for remote function calls.
Summary
Functions
Clears all cached signatures.
Initializes the signature store. Creates the ETS table if it does not exist.
Loads signatures for a single module.
Loads signatures for all .beam files found under build_path.
Looks up the signature clauses for module.function/arity.
Given concrete argument types, finds the best matching clause and returns
its return type. Falls back to dynamic() if no clause matches.
Functions
@spec clear() :: :ok
Clears all cached signatures.
@spec init() :: :ok
Initializes the signature store. Creates the ETS table if it does not exist.
Loads signatures for a single module.
@spec load_project(String.t()) :: {:ok, non_neg_integer()} | {:error, term()}
Loads signatures for all .beam files found under build_path.
Typically called with Mix.Project.build_path() to load the current
project and its dependencies.
@spec lookup(module(), atom(), non_neg_integer()) :: {:ok, [{[Typle.Type.t()], Typle.Type.t()}]} | :error
Looks up the signature clauses for module.function/arity.
@spec return_type(module(), atom(), non_neg_integer(), [Typle.Type.t()]) :: Typle.Type.t()
Given concrete argument types, finds the best matching clause and returns
its return type. Falls back to dynamic() if no clause matches.