mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
![]() ## Summary Closes #16661 This PR includes two changes: - `NotImplementedType` is now a member of `KnownClass` - We skip `is_assignable_to` checks for `NotImplemented` when checking return types ### Limitation ```py def f(cond: bool) -> int: return 1 if cond else NotImplemented ``` The implementation covers cases where `NotImplemented` appears inside a `Union`. However, for more complex types (ex. `Intersection`) it will not worked. In my opinion, supporting such complexity is unnecessary at this point. ## Test Plan Two `mdtest` files were updated: - `mdtest/function/return_type.md` - `mdtest/type_properties/is_singleton.md` To test `KnownClass`, run: ```bash cargo test -p red_knot_python_semantic -- types::class:: ``` |
||
---|---|---|
.. | ||
parameters.md | ||
return_type.md |