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

Make expansion AST pass to be typed-based #297

Open
josevalim opened this issue Oct 7, 2024 · 0 comments
Open

Make expansion AST pass to be typed-based #297

josevalim opened this issue Oct 7, 2024 · 0 comments

Comments

@josevalim
Copy link

Today, the pass returns the expanded AST. However, I don't think elixir_sense actually needs the AST. Instead, it must pass type information around. My suggestion is for it to track at first:

  • {:struct, name}
  • {:atom, name}
  • dynamic

Dynamic can be the default type for anything you don't know what the return is.

This also means the current implementation can be simplified:

  1. There is no need to build the ast for quote
  2. There is no need to traverse the right side of :: in binaries (the implementation can be much simpler)

Open questions and Elixir improvements:

  1. Do you need to port Elixir's rewrite rules? If so, we should expose this in Elixir itself
  2. Can we support Record, Protocol, ExUnit.Case without adding special rules? Carrying type information, especially atoms, may actually help here. Should we improve something in Elixir to make this possible?
  3. There may be other complex areas we should ask Elixir to expose. If so, which?

These topics have been first brought up here: #293

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

1 participant