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

[Type propagation] - Support for :__block__ #49

Open
Dwctor opened this issue Nov 18, 2023 · 0 comments
Open

[Type propagation] - Support for :__block__ #49

Dwctor opened this issue Nov 18, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Dwctor
Copy link
Collaborator

Dwctor commented Nov 18, 2023

How Type Propagation works

Currently type propagation works in the type_propagation.ex file by using the Macro.postwalk function to go through all AST elements and solve their types. That means that to make type propagation work with new structures, all we need to do is to support them in the functions located inside the Macro.postwalk. More specifically the get_typeset_from_segment and it's function calls.

What should be solved for this issue

We still don't support some native Elixir AST elements. One of these missing elements is the :__block__, responsible for blocks of code. As an example:

{:=, [metadata], [lhs, rhs]}
where:
    lhs = any_variable
    rhs = {:__block__, [metadata], [segments]}

Currently does not give any type to the lhs or to the := thanks to __block__ not showing up in extract_types_from_segment, falling in the default empty case of the function. We wish that the metadata is updated with the correct type by assessing what is the type of the last segment in the block. It is up to the issue solver if it makes more sense to make the fix inside extract_types_from_segment or its caller get_typeset_from_segment, but ideally the fix is located inside one of these.

@Dwctor Dwctor added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant