[ty] Fix panic for unclosed string literal in type annotation position (#21592)

This commit is contained in:
Micha Reiser
2025-11-23 16:51:58 +01:00
committed by GitHub
parent d24c891a4b
commit aec225d825
2 changed files with 21 additions and 3 deletions

View File

@@ -715,3 +715,17 @@ def _(a: int, b: str, c: int | str):
x9: int | str | None = f(lst(c))
reveal_type(x9) # revealed: int | str | None
```
## Forward annotation with unclosed string literal
Regression test for [#1611](https://github.com/astral-sh/ty/issues/1611).
<!-- blacken-docs:off -->
```py
# error: [invalid-syntax]
# error: [invalid-syntax-in-forward-annotation]
a:'
```
<!-- blacken-docs:on -->