[ty] Short circuit ReachabilityConstraints::analyze_single for dynamic types (#19867)

This commit is contained in:
Micha Reiser 2025-08-11 21:58:34 +02:00 committed by GitHub
parent dc84645c36
commit 2abd683376
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 0 deletions

View file

@ -505,3 +505,16 @@ class Abstract(Protocol):
class Concrete(Abstract):
def method(self) -> str: ... # error: [invalid-return-type]
```
## Diagnostics for `invalid-return-type` on dynamic type
```toml
environment.python-version = "3.12"
```
```py
from typing import Never, Any
def f(func: Any) -> Never: # error: [invalid-return-type]
func()
```