Skip to content

[Type propagation] - Support for :__block__ #49

@Dwctor

Description

@Dwctor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions