Skip to content

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Jul 19, 2025

Summary

Follow up to https://github.com/astral-sh/ruff/pull/19417/files#r2215520292

Extract the enclosing CallExpr when resolving the KeywordArgument goto target (where we have access to the ancestor chain)
instead of doing another tree traversal.

Not only is this faster. It's also less confusing (I assumed that there was more to it then just picking the parent call expression because it did use a second traversal).

Test Plan

cargo test

@MichaReiser MichaReiser added internal An internal refactor or improvement ty Multi-file analysis & type inference labels Jul 19, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jul 19, 2025

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

@MichaReiser MichaReiser force-pushed the micha/call-expr-goto-target branch from fdfc2ee to e1b7ac5 Compare July 19, 2025 13:44
Copy link
Collaborator

@UnboundVariable UnboundVariable left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I misunderstood the feedback from your previous code review. This looks fine to me.

@MichaReiser
Copy link
Member Author

Thanks, I misunderstood the feedback from your previous code review. This looks fine to me.

I'm sorry that my comment was unclear.

@MichaReiser MichaReiser merged commit 93a9fab into main Jul 19, 2025
37 checks passed
@MichaReiser MichaReiser deleted the micha/call-expr-goto-target branch July 19, 2025 16:21
UnboundVariable pushed a commit to UnboundVariable/ruff that referenced this pull request Jul 19, 2025
* main:
  [ty] Avoid secondary tree traversal to get call expression for keyword arguments (astral-sh#19429)
  [ty] Add goto definition to playground (astral-sh#19425)
  [ty] Add support for `@warnings.deprecated` (astral-sh#19376)
  [ty] make `del x` force local resolution of `x` in the current scope (astral-sh#19389)

# Conflicts:
#	crates/ty_ide/src/goto.rs
dcreager added a commit that referenced this pull request Jul 21, 2025
* main: (25 commits)
  [ty] Sync vendored typeshed stubs (#19461)
  [ty] Extend tuple `__len__` and `__bool__` special casing to also cover tuple subclasses (#19289)
  [ty] bump docstring-adder pin (#19458)
  [ty] Disallow assignment to `Final` class attributes (#19457)
  Update dependency ruff to v0.12.4 (#19442)
  Update pre-commit hook astral-sh/ruff-pre-commit to v0.12.4 (#19443)
  Update rui314/setup-mold digest to 702b190 (#19441)
  Update taiki-e/install-action action to v2.56.19 (#19448)
  Update Rust crate strum_macros to v0.27.2 (#19447)
  Update Rust crate strum to v0.27.2 (#19446)
  Update Rust crate rand to v0.9.2 (#19444)
  Update Rust crate serde_json to v1.0.141 (#19445)
  Fix `unreachable` panic in parser (#19183)
  [`ruff`] Support byte strings (`RUF055`) (#18926)
  [ty] Avoid second lookup for `infer_maybe_standalone_expression` (#19439)
  [ty] Implemented "go to definition" support for import statements (#19428)
  [ty] Avoid secondary tree traversal to get call expression for keyword arguments (#19429)
  [ty] Add goto definition to playground (#19425)
  [ty] Add support for `@warnings.deprecated` (#19376)
  [ty] make `del x` force local resolution of `x` in the current scope (#19389)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal An internal refactor or improvement ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants