[ty] make del x force local resolution of x in the current scope by oconnor663 · Pull Request #19389 · astral-sh/ruff (original) (raw)

@oconnor663 oconnor663 added the ty

Multi-file analysis & type inference

label

Jul 16, 2025

oconnor663

@oconnor663

Fixes astral-sh/ty#769.

The preferred approach here is to keep the SemanticIndex simple (del of any name marks that name "bound" in the current scope) and to move complexity to type inference (free variable resolution stops when it finds a binding, unless that binding is declared nonlocal). As part of this change, free variable resolution will now union the types it finds as it walks in enclosing scopes. This approach is still incomplete, because it doesn't consider inner scopes or sibling scopes, but it improves the common case.

oconnor663

@oconnor663

@oconnor663

@carljm

@carljm

@carljm carljm deleted the del_mark_bound branch

July 18, 2025 21:58

UnboundVariable pushed a commit to UnboundVariable/ruff that referenced this pull request

Jul 19, 2025

Conflicts:

crates/ty_ide/src/goto.rs

dcreager added a commit that referenced this pull request

Jul 21, 2025

@dcreager

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})