Skip to content

Commit b6bb5fe

Browse files
lukaszsamsonclaude
andcommitted
Keep full body-check diagnostics and document them in prompt mode
Two review findings: body-warning formatting kept only the first diagnostic line, dropping the expected/got detail from findings such as "incompatible types given to Kernel.++/2" in static mode -- the full diagnostic is now preserved (indented in the report, verbatim in JSON). And prompt mode included body_warnings in its payload without telling reviewers what to do with them -- the instructions now explain body_check/body_warnings and ask for a defensive-code vs spec-bug vs code-bug classification. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 640e7cf commit b6bb5fe

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

lib/elixir/scripts/compare_specs_and_signatures.exs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ defmodule Main do
798798
message =
799799
try do
800800
%{message: message} = warning_module.format_diagnostic(warning)
801-
message |> IO.iodata_to_binary() |> String.split("\n") |> hd()
801+
message |> IO.iodata_to_binary() |> String.trim_trailing()
802802
rescue
803803
_ -> inspect(warning, limit: 5)
804804
end
@@ -1089,7 +1089,8 @@ defmodule Main do
10891089
warnings ->
10901090
lines =
10911091
Enum.map_join(warnings, "\n", fn w ->
1092-
" #{w.mfa} (#{w.location}): #{w.message}"
1092+
message = String.replace(w.message, "\n", "\n ")
1093+
" #{w.mfa} (#{w.location}): #{message}"
10931094
end)
10941095

10951096
[
@@ -1139,13 +1140,20 @@ defmodule Main do
11391140
(e.g. non_neg_integer() -> integer()); do not draw conclusions that
11401141
depend on precision the translation lost;
11411142
- "dynamic_args" is the checker's return prediction for a call with
1142-
fully-unknown arguments and its relation to the spec return.
1143+
fully-unknown arguments and its relation to the spec return;
1144+
- "body_check" is the return type inferred by re-checking the function
1145+
BODY with arguments assumed spec-typed, and "body_warnings" are the
1146+
warnings that re-check emitted (informational, not gated).
11431147
11441148
For each entry, judge:
11451149
1. contradiction: which side is wrong, and what should change?
11461150
2. mixed: characterize the difference and whether it is actionable.
11471151
3. untranslatable: which typespec construct is unsupported and whether
11481152
a sound over-approximation could be added to the translator.
1153+
4. body_warnings: classify each as defensive code for out-of-spec
1154+
inputs (expected; no action), a spec narrower than the inputs the
1155+
function intends to support (spec bug), or a genuinely dead or
1156+
buggy code path (code bug).
11491157
11501158
Be concise; order by severity; reference module.function/arity.
11511159

0 commit comments

Comments
 (0)