Skip to content

Fix type-case#839

Merged
soutaro merged 1 commit intomasterfrom
variable-narrowing
Jul 6, 2023
Merged

Fix type-case#839
soutaro merged 1 commit intomasterfrom
variable-narrowing

Conversation

@soutaro
Copy link
Owner

@soutaro soutaro commented Jul 6, 2023

Fixes #838

The problem was because of test_node = test.updated(:send, [test, :===, cond]), where cond is reused and given multiple times to synthesize which results in updating the type of the cond node.

This PR introduces simplified transformation. The condition node is transformed using a fresh local variable var_name. And the type of var_name is propagated to the original value_node when it's type checking body of each when/else clauses.

@soutaro soutaro added this to the Steep 1.5 milestone Jul 6, 2023
@soutaro soutaro merged commit b1d0fcc into master Jul 6, 2023
@soutaro soutaro deleted the variable-narrowing branch July 6, 2023 07:06
@soutaro soutaro added the Released The PR is already included in a published release label Jul 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Released The PR is already included in a published release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Go to Type Definition sometimes jumps to unexpected location

1 participant