Typle.Unstable (Typle v0.1.0)

View Source

Opt-in layer that hooks into the compiler's private type checking infrastructure for deeper type inference.

WARNING: This module depends on private Elixir compiler APIs that may change without notice between Elixir versions. It is only tested with Elixir 1.20.x. If the private APIs change, this module will degrade gracefully to the stable inference engine.

Usage

Typle.Unstable.type_at("lib/my_app/user.ex", 15, 5)
Typle.Unstable.types_for(MyApp.User)

Summary

Functions

Returns the inferred type at the given file position using compiler replay.

Returns all inferred types for a module using compiler replay.

Functions

type_at(file, line, col)

@spec type_at(String.t(), non_neg_integer(), non_neg_integer()) ::
  {:ok, Typle.Type.t()} | {:error, term()}

Returns the inferred type at the given file position using compiler replay.

Falls back to stable inference if the compiler hook fails.

types_for(module)

@spec types_for(module()) :: {:ok, Typle.Inference.type_map()} | {:error, term()}

Returns all inferred types for a module using compiler replay.

Falls back to stable inference if the compiler hook fails.