Fixes https://github.com/astral-sh/ty/issues/1716. ## Test plan I added a corpus snippet that causes us to panic on `main` (I tested by running `cargo run -p ty_python_semantic --test=corpus` without the fix applied).
Fixes https://github.com/astral-sh/ty/issues/1716. ## Test plan I added a corpus snippet that causes us to panic on `main` (I tested by running `cargo run -p ty_python_semantic --test=corpus` without the fix applied).