Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialyzer Diagnostics #95

Open
scohen opened this issue Apr 5, 2023 · 4 comments
Open

Dialyzer Diagnostics #95

scohen opened this issue Apr 5, 2023 · 4 comments

Comments

@scohen
Copy link
Collaborator

scohen commented Apr 5, 2023

This is a big feature, but we should start small

Dialyzer creates files called persistent lookup tables or .plts. These tables are extremely specific to code. We should generate .plt files for

  1. The erlang release
  2. The elixir release
  3. Your application's code

I believe these tables can be updated via code, but we need to be extremely careful about when we do so and how we do so. They're effectively caches, and caches are evil.
This is also an area where elixir_ls doesn't do so well, and one of the reasons why deleting your .elixir-ls directory is the way to fix problems.

So to start small, we should create a dialyzer subdirectory in .elixir-ls and in that directory, store various .plt files. These files will need to be named after the elixir and erlang releases they index.

Then we need to create a plt for our app. This is going to be tough, since the code there changes so much. I'm wide open to ideas, but we should probably walk the module tree when we compile the first time and keep md5s of each module. Then, when a module is compiled, we need to write the md5 to the cache, and update that module in dialyzer.

@scottming
Copy link
Collaborator

Regarding whether a module is stale or not, elixir compiler has an implementation

@Moosieus
Copy link
Collaborator

OTP 26 added an incremental mode to Dialyzer that makes syncing the lookup tables a lot less painful. That given, I think an effort to add Dialyzer to Lexical would be best served by only enabling it for OTP 26 and forward.

@scohen
Copy link
Collaborator Author

scohen commented May 20, 2024

Why not just use dialyxir?

@scohen
Copy link
Collaborator Author

scohen commented May 20, 2024

My perspective is that lexical's namespacing allows us to use libraries like dialyxir in remote control. This would confer the following benefits:

  • we'd use the project's configs and plt files
  • the error messages are improved
  • we don't have to build the infrastructure to do all the dialyzer stuff
  • it's likely easier to add incremental mode to dialyxir than to build dialyzer support from the ground up.
  • We'd help another project (and one we use)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants