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

[red-knot] handle synthetic 'self' argument in call-binding diagnostics #15362

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

carljm
Copy link
Contributor

@carljm carljm commented Jan 8, 2025

Summary

In binding calls, we store an argument index with argument-specific binding errors, so that we can emit the diagnostic on the specific argument node at the call site.

We need to account for the synthetic self argument for methods, or else our argument index is off by one and can result in a panic where we are looking for an argument node that doesn't exist in the call.

Fixes #15360

Test Plan

Added mdtest.

Also verified that with this fix, red-knot can again run on Black codebase without panic.

@carljm carljm added the red-knot Multi-file analysis & type inference label Jan 8, 2025
Copy link
Contributor

github-actions bot commented Jan 8, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@carljm carljm merged commit a95deec into main Jan 9, 2025
21 checks passed
@carljm carljm deleted the cjm/callbindpanic branch January 9, 2025 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[red-knot] Panic in call/bind.rs (argument index should not be out of range)
2 participants