Fix bug where classmethods and staticmethods were considered subtypes of types.FunctionType - #21145
Closed
AlexWaygood wants to merge 4 commits into
Closed
Fix bug where classmethods and staticmethods were considered subtypes of types.FunctionType#21145AlexWaygood wants to merge 4 commits into
types.FunctionType#21145AlexWaygood wants to merge 4 commits into
Conversation
Contributor
Diagnostic diff on typing conformance testsChanges were detected when running ty on typing conformance tests--- old-output.txt 2025-10-30 15:52:43.228799809 +0000
+++ new-output.txt 2025-10-30 15:52:46.359792522 +0000
@@ -1,4 +1,4 @@
-fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/cdd0b85/src/function/execute.rs:419:17 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(17843)): execute: too many cycle iterations`
+fatal[panic] Panicked at /home/runner/.cargo/git/checkouts/salsa-e6f3bb7c2a062968/cdd0b85/src/function/execute.rs:419:17 when checking `/home/runner/work/ruff/ruff/typing/conformance/tests/aliases_typealiastype.py`: `infer_definition_types(Id(17c43)): execute: too many cycle iterations`
_directives_deprecated_library.py:15:31: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `int`
_directives_deprecated_library.py:30:26: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `str`
_directives_deprecated_library.py:36:41: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `Self@__add__`
@@ -737,6 +737,8 @@
narrowing_typeis.py:72:9: error[type-assertion-failure] Argument does not have asserted type `int`
narrowing_typeis.py:76:9: error[type-assertion-failure] Argument does not have asserted type `int`
narrowing_typeis.py:80:9: error[type-assertion-failure] Argument does not have asserted type `int`
+narrowing_typeis.py:84:9: error[type-assertion-failure] Argument does not have asserted type `int`
+narrowing_typeis.py:88:9: error[type-assertion-failure] Argument does not have asserted type `int`
narrowing_typeis.py:92:9: error[type-assertion-failure] Argument does not have asserted type `B`
narrowing_typeis.py:96:9: error[type-assertion-failure] Argument does not have asserted type `B`
narrowing_typeis.py:132:20: error[invalid-argument-type] Argument to function `takes_callable_str` is incorrect: Expected `(object, /) -> str`, found `def simple_typeguard(val: object) -> TypeIs[int]`
@@ -946,5 +948,5 @@
typeddicts_usage.py:28:17: error[missing-typed-dict-key] Missing required key 'name' in TypedDict `Movie` constructor
typeddicts_usage.py:28:18: error[invalid-key] Invalid key access on TypedDict `Movie`: Unknown key "title"
typeddicts_usage.py:40:24: error[invalid-type-form] The special form `typing.TypedDict` is not allowed in type expressions. Did you mean to use a concrete TypedDict or `collections.abc.Mapping[str, object]` instead?
-Found 948 diagnostics
+Found 950 diagnostics
WARN A fatal error occurred while checking some files. Not all project files were analyzed. See the diagnostics list above for details. |
Contributor
|
Contributor
|
| Lint rule | Added | Removed | Changed |
|---|---|---|---|
invalid-argument-type |
7 | 0 | 79 |
too-many-positional-arguments |
9 | 12 | 1 |
unknown-argument |
9 | 0 | 0 |
unresolved-attribute |
0 | 9 | 0 |
missing-argument |
4 | 0 | 1 |
invalid-type-form |
0 | 0 | 3 |
invalid-assignment |
2 | 0 | 0 |
no-matching-overload |
0 | 0 | 2 |
parameter-already-assigned |
0 | 0 | 1 |
| Total | 31 | 21 | 87 |
Member
Author
|
the minimal repro of the corpus panic is from typing_extensions import ParamSpec
ParamSpec("P")... |
Member
Author
|
Going to abandon this for now: it doesn't seem high-priority; I've already spent too much time on it; and this isn't really an attractive fix. A better fix would probably be to add separate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes astral-sh/ty#1452