In From v0.2.1 to v0.2.9, we focused on polymorphic bounded_fun specs, demand-driven specialization, and making PPLT builds fast on large Elixir projects.
Between v0.2.9 and v0.2.11, the focus shifted to type precision in guards, diagnostic readability, nine community-reported issues (#17–#25), and building a property-based test suite (prop_prisma_elixir) that compiles and runs real Elixir code against Prisma.
1. v0.2.10: Guard Refinement, Opaque Preservation, and Focused Mismatch Paths
Two commits landed around v0.2.10 to tighten precision and make large type mismatches readable:
-
Opaque preservation & guarded clause subtraction (
prisma_type/prisma_infer):-
prisma_type:meet/2now preserves@opaquewrappers when narrowing against compatible types instead of stripping opacity prematurely. -
Inequality guards (
=/=and/=) against atom literals narrow union types cleanly, record unions are filtered by tag in pattern/guard refinement, and guarded clauses subtract only the covered portion when the guard is guaranteed to hold.
-
-
Path-focused mismatch diagnostics (
prisma_checker/prisma_type):-
Large nested types (records, maps, tuples, unions) previously printed the entire structural expansion in
gradual_mismatchmessages.prisma_checkernow narrows the reported mismatch down to the failing path and formatsrecursive_refcleanly instead of dumping raw internal AST markers.
-
Large nested types (records, maps, tuples, unions) previously printed the entire structural expansion in
2. v0.2.11: Resolving Nine GitHub Issues (#17–#25)
v0.2.11 addressed nine issues reported against real Elixir and Erlang projects. A huge thank-you to the community contributor who filed these sharp, reproducible reports (#17–#25, as well as several earlier issues)—that kind of detailed feedback from real-world usage is what turns edge cases into permanent test coverage. Looking at all nine issues together, they fell into three clear buckets:
2.1 Elixir elixir_v1 AST & Struct Clause Ordering (#17, #18, #19, #22)
Because Prisma translates Elixir's elixir_v1 debug info directly rather than relying on abstract_code (which strips macro context metadata), every Elixir special form or sugar not explicitly handled in prisma_elixir:translate_expr/1 fell through to a fallback local call:
-
#17— Zero-argument remote calls vs. map field reads:{{'.', _, [Target, Field]}, _, []}was unconditionally translated toerlang:map_get(Field, Target). WhenTargetwas a module atom or alias (e.g.,Helper.val()), it became a map read instead of a remote callHelper:val(). Module targets now emit{remote, ...}calls, while expression targets emiterlang:map_get/2. -
#18—try/afterandreceive: Neither special form was handled intranslate_expr/1, so compiled Elixirtry/afterandreceiveblocks turned into phantom local calls (Mod:'try'/1,Mod:'receive'/1) and lost return-type inference. Both now translate to proper ErlangtryandreceiveAST nodes. -
#22— Bitstring segmentsize(...):<<x::size(n)>>emitted a phantomerlang:size/1call inside binary segments instead of extracting the size expression into the Erlangbin_elementsize slot. -
#19— Struct clause before plain-map clauses: A%MyStruct{}pattern is a map with'__struct__' := MyStruct, butprisma_infertreated it as coveringany_map, causing subsequent reachable plain-map clauses (%{k: v}orwhen is_map(v)) to report falsedead_code. Struct patterns no longer shadow plain-map clauses.
2.2 Overloaded Specs and BIF Discrepancy Deduplication (#23, #24)
-
#23— Overloaded@specs in hybrid mode: A function with multiple overloaded specs (e.g.,f(integer()) :: integer(); f(atom()) :: atom()) could silently pass hybrid analysis even when its implementation returned a type outside every declared overload.prisma_checkernow checks that the inferred return type is compatible with the union of declared overload return types. -
#24— Duplicatediscrepancyforabs/1: When the OTP.pplttable was loaded, a single invalidabs/1call emitted twodiscrepancywarnings (one fromprisma_infer's BIF check and one fromprisma_checker's external-spec check). The duplicate is now deduplicated.
2.3 Mix Task & PPLT Integrity (#20, #21, #25)
-
#20— Stale dependency.ppltin the same Mix env: Recompiling a dependency in the same Mix environment could reuse an incompatible.ppltfile.prisma_locknow validates dependency source/BEAM fingerprints and invalidates stale tables cleanly. -
#21— Unreadable implicit Elixir.pplt: Just like#11previously fixed for explicit dependency.pplts, an unreadable implicit Elixir.ppltsilently dropped type information and turned real mismatches into clean passes. It now surfaces the error instead of failing open. -
#25— OTP tables from Mix (mix prisma): Added support for requesting and verifying OTP application tables directly from the Mix task configuration and CLI.
3. Closing the Gap: A PropEr Suite for Compiled Elixir (prop_prisma_elixir)
Looking at #17, #18, #19, and #22 together made one pattern obvious: our existing PropEr suite (prop_prisma_infer and prop_prisma_type) generated Erlang forms, so gaps in prisma_elixir's elixir_v1 translation were only discovered when users hit them in the wild.
Right after v0.2.11, we added test/prop_prisma_elixir.erl, which:
-
Compiles real Elixir modules in-memory with
'Elixir.Code':compile_string/1. -
Executes
Mod:run()at runtime and analyzes the compiled.beams withprisma:analyze_beams/2. -
Asserts three invariants across Elixir constructs (
case,cond,with,for,try/after,receive/after,<<x::size(...)>>, zero-arity remote calls vs.m.k, and struct-vs-map clauses) with both valid and intentionally incompatible@specs:-
Zero phantom calls (
Mod:'try','receive','for','with','cond',erlang:size). -
Runtime return value is a member of
inferred_type(prisma_oracle:member/2). -
gradual_mismatchfires if and only if the@specis incompatible, with no falsediscrepancyordead_code.
-
Zero phantom calls (
On its very first runs, prop_prisma_elixir immediately uncovered two more gaps that are now fixed in v0.2.11 (republished with --replace):
-
cond,with, andforinprisma_elixir: All three were missing fromtranslate_expr/1and emitted phantom local calls.condnow lowers to truthiness-preservingcasechains,withtocasechains withelsehandling, andfortolc/bccomprehensions (includinginto:andreduce:vialists:foldl/3). -
erlang:map_get/2inprisma_infer: Field reads likem.ktranslated toerlang:map_get(:k, m), which lacked entries inbif_signature/2andbif_return_type/4, causingm.kto inferanyand miss@specmismatches.map_get/2now resolves the field type directly from{map, Fields}and map unions.
With those fixes in place, the test suite stands at 311/311 EUnit tests and 19/19 PropEr properties (including 100/100 cases in prop_prisma_elixir).
4. Still on the Roadmap
The three longer-term items from our earlier roadmap remain open:
-
Nominal Types (
-nominal, EEP-69 / OTP 28+): Parsed askind = nominal, still expanded structurally. -
Native Records (
-record #name{}, EEP-79 / OTP 29+): Not yet extracted or checked. -
Value-Correlated Spec Overloads & Formalization: Dispatch correlations like
rabbit_ff_controller:run_callback/5and the standaloneTYPESYSTEM.md/ Lean 4 / Rocq formalization.