Skip to content

Commit 5316ae7

Browse files
lukaszsamsonclaude
andcommitted
Record why spec'd functions have no inferred signature
All 30 current no_signature entries are protocol modules: signature inference is deliberately skipped for protocols (Module.Types -- "those will be replaced anyway", i.e. consolidation rewrites the dispatch). Carry the checker mode in the JSON so the coverage gap is self-explanatory rather than a bare MFA list. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent daab005 commit 5316ae7

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

lib/elixir/scripts/compare_specs_and_signatures.exs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,18 @@ defmodule Main do
892892
Map.merge(base, %{verdict: :untranslatable, why: inspect(why, limit: 5)})
893893
end
894894

895-
_ ->
896-
Map.put(base, :verdict, :no_signature)
895+
other ->
896+
# No inferred signature to compare against. In practice these are
897+
# exclusively protocol modules: signature inference is skipped for
898+
# protocols (Module.Types, "those will be replaced anyway" -- the
899+
# dispatch is rewritten by consolidation).
900+
why =
901+
case other do
902+
{:ok, mode, _deprecated, _sig} -> mode
903+
_ -> :missing
904+
end
905+
906+
Map.merge(base, %{verdict: :no_signature, why: why})
897907
end
898908
end
899909

@@ -1045,8 +1055,10 @@ defmodule Main do
10451055
tightening_hints: Enum.map(hints, &entry_json/1),
10461056
body_warnings: body_warnings,
10471057
# Functions with a spec but no inferred signature: nothing to compare,
1048-
# so they receive no coverage from this tool -- listed for visibility.
1049-
no_signature: Enum.map(no_signature, &mfa_string/1),
1058+
# so they receive no coverage from this tool -- listed for visibility
1059+
# with the checker mode explaining why (:protocol = inference is
1060+
# skipped for protocols since consolidation rewrites them).
1061+
no_signature: Enum.map(no_signature, &%{mfa: mfa_string(&1), why: &1[:why]}),
10501062
# How many compared functions involved an inexact (over-approximated)
10511063
# spec translation somewhere; per-slice precision flags carry details.
10521064
approximate_translations: inexact

0 commit comments

Comments
 (0)