Skip to content

Conversation

@asukaminato0721
Copy link
Contributor

Summary

Fixes #1903

Guarded Ast::expr_lvalue so it ignores ExprNames whose TextRange is empty, preventing dummy identifiers emitted by the parser from ever being registered as l-values and later requested from the binding table

Test Plan

add a test

@meta-cla meta-cla bot added the cla signed label Dec 19, 2025
@asukaminato0721 asukaminato0721 marked this pull request as ready for review December 19, 2025 19:36
Copilot AI review requested due to automatic review settings December 19, 2025 19:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a panic (issue #1903) caused by dummy identifiers with empty TextRanges being registered as l-values and later requested from the binding table. The fix adds a guard to filter out ExprNames with empty ranges in the expr_lvalue function.

  • Added a guard condition to skip ExprNames with empty TextRanges in Ast::expr_lvalue
  • Added a regression test for the specific malformed syntax pattern (:=).: that triggered the original panic

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pyrefly/lib/test/simple.rs Adds regression test for issue #1903 with the pattern that previously caused a panic
crates/pyrefly_python/src/ast.rs Guards expr_lvalue to ignore ExprNames with empty ranges, preventing dummy identifiers from being registered

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grievejia grievejia self-assigned this Dec 22, 2025
@meta-codesync
Copy link

meta-codesync bot commented Dec 22, 2025

@grievejia has imported this pull request. If you are a Meta employee, you can view this in D89686559.

Copy link
Contributor

@yangdanny97 yangdanny97 left a comment

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync
Copy link

meta-codesync bot commented Dec 23, 2025

@grievejia merged this pull request in b4be85d.

@asukaminato0721 asukaminato0721 deleted the 1903 branch December 24, 2025 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic Internal error: key lacking binding key=Key::Definition( 1:2), key-debug=Definition(ShortIdentifier(1..1)) in lib/binding/bindings.rs

4 participants