I wasn’t able to fix the error, but I was able to move the crash site somewhat: See the bottom for the rest of the story…
- removed the stray close-square-bracket present in
0b8736d
which blocks running any Mix task
- removed all of the
plt_*
options from the Dialyzer config
- remove
:mix
and :hex
from extra_applications
- that one in particular silences the Could not get Core Erlang code for: /Users/mattjones/.asdf/installs/elixir/1.16.2-otp-26/.mix/archives/hex-2.1.1/hex-2.1.1/ebin/Elixir.Hex.Crypto.PublicKey.beam
chatter before the main Dialyzer results
- added
{:hex_core, "~> 0.11.0"},
to deps
- updated all the references to
:mix_hex_*
to instead use the corresponding hex_core
modules named :hex_*
This results in a compiler error:
==> dialyzer_error_rep
Compiling 5 files (.ex)
warning: Hex.Shell.info/1 is undefined (module Hex.Shell is not available or is yet to be defined)
│
141 │ Hex.Shell.info("* public key at #{path} does not match private key, overwriting")
│ ~
│
└─ lib/dialyzer_error_rep/registry_builder.ex:141:19: DialyzerErrorRep.RegistryBuilder.ensure_public_key/2
└─ lib/dialyzer_error_rep/registry_builder.ex:151:17: DialyzerErrorRep.RegistryBuilder.create_directory/1
└─ lib/dialyzer_error_rep/registry_builder.ex:158:17: DialyzerErrorRep.RegistryBuilder.write_file/2
└─ lib/dialyzer_error_rep/registry_builder.ex:161:17: DialyzerErrorRep.RegistryBuilder.write_file/2
└─ lib/dialyzer_error_rep/registry_builder.ex:168:15: DialyzerErrorRep.RegistryBuilder.remove_file/1
as well as the equivalent Dialyzer error:
lib/dialyzer_error_rep/registry_builder.ex:141:unknown_function
Function Hex.Shell.info/1 does not exist.
________________________________________________________________________________
lib/dialyzer_error_rep/registry_builder.ex:151:unknown_function
Function Hex.Shell.info/1 does not exist.
________________________________________________________________________________
lib/dialyzer_error_rep/registry_builder.ex:158:unknown_function
Function Hex.Shell.info/1 does not exist.
________________________________________________________________________________
lib/dialyzer_error_rep/registry_builder.ex:168:unknown_function
Function Hex.Shell.info/1 does not exist.
________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2
Looking at the definition of Hex.Shell.info/1
, it’s a trivial wrapper over Mix.shell().info/1
.
Replacing those calls in RegistryBuilder
causes Dialyzer to emit a new complaint:
lib/dialyzer_error_rep/registry_builder.ex:141:unknown_function
Function Mix.shell/0 does not exist.
________________________________________________________________________________
lib/dialyzer_error_rep/registry_builder.ex:151:unknown_function
Function Mix.shell/0 does not exist.
________________________________________________________________________________
lib/dialyzer_error_rep/registry_builder.ex:158:unknown_function
Function Mix.shell/0 does not exist.
________________________________________________________________________________
lib/dialyzer_error_rep/registry_builder.ex:168:unknown_function
Function Mix.shell/0 does not exist.
________________________________________________________________________________
done (warnings were emitted)
This can finally be silenced by adding plt_add_apps: [:mix],
to the Dialyzer config in mix.exs
, producing a clean Dialyzer report!
Generated dialyzer_error_rep app
Finding suitable PLTs
Checking PLT...
[:asn1, :compiler, :cowboy, :cowboy_telemetry, :cowlib, :crypto, :dialyzer_error_rep, :eex, :elixir, :hex_core, :inets, :kernel, :logger, :mime, :mix, :plug, :plug_cowboy, :plug_crypto, :public_key, :ranch, :ssl, :stdlib, :telemetry]
Looking up modules in dialyzer.plt
Finding applications for dialyzer.plt
Finding modules for dialyzer.plt
Checking 852 modules in dialyzer.plt
Adding 95 modules to dialyzer.plt
done in 0m3.48s
ignore_warnings: dialyzer_ignore.exs
Starting Dialyzer
[
check_plt: false,
init_plt: ~c"/Users/mattjones/src/dialyzer-unknown-error-rep/dialyzer_cache/dialyzer.plt",
files: [~c"/Users/mattjones/src/dialyzer-unknown-error-rep/_build/dev/lib/dialyzer_error_rep/ebin/Elixir.DialyzerErrorRep.Application.beam",
~c"/Users/mattjones/src/dialyzer-unknown-error-rep/_build/dev/lib/dialyzer_error_rep/ebin/Elixir.DialyzerErrorRep.RegistryBuilder.beam",
~c"/Users/mattjones/src/dialyzer-unknown-error-rep/_build/dev/lib/dialyzer_error_rep/ebin/Elixir.DialyzerErrorRep.Router.beam",
~c"/Users/mattjones/src/dialyzer-unknown-error-rep/_build/dev/lib/dialyzer_error_rep/ebin/Elixir.DialyzerErrorRep.Static.beam",
~c"/Users/mattjones/src/dialyzer-unknown-error-rep/_build/dev/lib/dialyzer_error_rep/ebin/Elixir.HexRegistry.beam"],
warnings: [:unknown]
]
Total errors: 0, Skipped: 0, Unnecessary Skips: 0
done in 0m1.33s
done (passed successfully)