[ty] Fix panic for attribute expressions with empty value (#19069)

## Summary

closes https://github.com/astral-sh/ty/issues/738

## Test Plan

Added corpus test
This commit is contained in:
David Peter 2025-07-09 08:46:33 +02:00 committed by GitHub
parent 05139a323b
commit ab3af924ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -5754,6 +5754,13 @@ impl<'db, 'ast> TypeInferenceBuilder<'db, 'ast> {
};
(place, None)
} else {
if expr_ref
.as_name_expr()
.is_some_and(|name| name.is_invalid())
{
return (Place::Unbound, None);
}
let use_id = expr_ref.scoped_use_id(db, scope);
let place = place_from_bindings(db, use_def.bindings_at_use(use_id));
(place, Some(use_id))