Skip to content

[ty] Support typevar-specialized dynamic types in generic type aliases#21730

Merged
sharkdp merged 2 commits intomainfrom
david/fix-specialized-unknown
Dec 3, 2025
Merged

[ty] Support typevar-specialized dynamic types in generic type aliases#21730
sharkdp merged 2 commits intomainfrom
david/fix-specialized-unknown

Conversation

@sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Dec 1, 2025

Summary

For a type alias like the one below, where UnknownClass is something with a dynamic type, we previously lost track of the fact that this dynamic type was explicitly specialized with a type variable. If that alias is then later explicitly specialized itself (MyAlias[int]), we would miscount the number of legacy type variables and emit a invalid-type-arguments diagnostic (playground).

T = TypeVar("T")

MyAlias: TypeAlias = UnknownClass[T] | None

The solution implemented here is not pretty, but we can hopefully get rid of it via astral-sh/ty#1711. Also, once we properly support ParamSpec and Concatenate, we should be able to remove some of this code.

This addresses many of the invalid-type-arguments false-positives in astral-sh/ty#1685. With this change, there are still some diagnostics of this type left. Instead of implementing even more (rather sophisticated) workarounds for these cases as well, it might be much easier to wait for full ParamSpec/Concatenate support and then try again.

A disadvantage of this implementation is that we lose track of some @Todo types and replace them with Unknown. We could spend more effort and try to preserve them, but I'm unsure if this is the best use of our time right now.

Test Plan

New Markdown tests.

@sharkdp sharkdp added the ty Multi-file analysis & type inference label Dec 1, 2025
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 1, 2025

Diagnostic diff on typing conformance tests

Changes were detected when running ty on typing conformance tests
--- old-output.txt	2025-12-03 08:27:30.384262987 +0000
+++ new-output.txt	2025-12-03 08:27:34.022271510 +0000
@@ -4,25 +4,21 @@
 _directives_deprecated_library.py:41:25: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `int | float`
 _directives_deprecated_library.py:45:24: error[invalid-return-type] Function always implicitly returns `None`, which is not assignable to return type `str`
 aliases_explicit.py:41:24: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `tuple[str, str]`?
-aliases_explicit.py:41:36: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
-aliases_explicit.py:57:5: error[type-assertion-failure] Type `(int, str, str, /) -> None` does not match asserted type `(...) -> Unknown`
+aliases_explicit.py:57:5: error[type-assertion-failure] Type `(int, str, str, /) -> None` does not match asserted type `Unknown`
 aliases_explicit.py:60:5: error[type-assertion-failure] Type `(...) -> None` does not match asserted type `@Todo(Callable[..] specialized with ParamSpec)`
 aliases_explicit.py:67:24: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
 aliases_explicit.py:68:24: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
 aliases_explicit.py:69:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
 aliases_explicit.py:70:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
-aliases_explicit.py:71:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
 aliases_explicit.py:101:6: error[call-non-callable] Object of type `UnionType` is not callable
 aliases_explicit.py:102:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
 aliases_implicit.py:54:24: error[invalid-type-form] List literals are not allowed in this context in a type expression: Did you mean `tuple[str, str]`?
-aliases_implicit.py:54:36: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
-aliases_implicit.py:68:5: error[type-assertion-failure] Type `(int, str, str, /) -> None` does not match asserted type `(...) -> Unknown`
+aliases_implicit.py:68:5: error[type-assertion-failure] Type `(int, str, str, /) -> None` does not match asserted type `Unknown`
 aliases_implicit.py:72:5: error[type-assertion-failure] Type `(...) -> None` does not match asserted type `@Todo(Callable[..] specialized with ParamSpec)`
 aliases_implicit.py:76:24: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
 aliases_implicit.py:77:24: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
 aliases_implicit.py:78:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
 aliases_implicit.py:79:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
-aliases_implicit.py:80:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
 aliases_implicit.py:81:25: error[invalid-type-arguments] Type `str` is not assignable to upper bound `int | float` of type variable `TFloat@GoodTypeAlias12`
 aliases_implicit.py:107:9: error[invalid-type-form] Variable of type `list[Unknown | <class 'int'> | <class 'str'>]` is not allowed in a type expression
 aliases_implicit.py:108:9: error[invalid-type-form] Variable of type `tuple[tuple[<class 'int'>, <class 'str'>]]` is not allowed in a type expression
@@ -141,10 +137,6 @@
 callables_annotation.py:58:5: error[invalid-type-form] Special form `typing.Callable` expected exactly two arguments (parameter types and return type)
 callables_annotation.py:58:14: error[invalid-type-form] The first argument to `Callable` must be either a list of types, ParamSpec, Concatenate, or `...`
 callables_annotation.py:157:20: error[invalid-assignment] Object of type `Proto7` is not assignable to `Proto6`
-callables_annotation.py:172:19: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
-callables_annotation.py:175:19: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
-callables_annotation.py:188:25: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
-callables_annotation.py:189:25: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
 callables_kwargs.py:24:5: error[type-assertion-failure] Type `int` does not match asserted type `@Todo(`Unpack[]` special form)`
 callables_kwargs.py:32:9: error[type-assertion-failure] Type `str` does not match asserted type `@Todo(`Unpack[]` special form)`
 callables_kwargs.py:35:5: error[type-assertion-failure] Type `str` does not match asserted type `@Todo(`Unpack[]` special form)`
@@ -1028,4 +1020,4 @@
 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] Unknown key "title" for 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
-Found 1030 diagnostics
+Found 1022 diagnostics

@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 1, 2025

mypy_primer results

Changes were detected when running on open source projects
beartype (https://github.com/beartype/beartype)
- beartype/claw/_package/clawpkgtrie.py:66:29: warning[unsupported-base] Unsupported class base with type `<class 'dict[str, PackagesTrieBlacklist]'> | <class 'dict[str, Divergent]'>`
- beartype/claw/_package/clawpkgtrie.py:247:29: warning[unsupported-base] Unsupported class base with type `<class 'dict[str, PackagesTrieWhitelist]'> | <class 'dict[str, Divergent]'>`
- Found 494 diagnostics
+ Found 492 diagnostics

scrapy (https://github.com/scrapy/scrapy)
- scrapy/commands/parse.py:331:25: error[no-matching-overload] No overload of function `getattr` matches arguments
- tests/test_downloadermiddleware_offsite.py:90:44: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `((...) -> Any) | None`, found `Unknown | dict[Unknown, Unknown]`
- Found 1737 diagnostics
+ Found 1735 diagnostics

Tanjun (https://github.com/FasterSpeeding/Tanjun)
- tanjun/_internal/__init__.py:81:68: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/_internal/__init__.py:88:86: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:90:81: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:91:83: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:92:89: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:93:85: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:95:84: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:96:86: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:97:92: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:98:88: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:100:66: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:101:68: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:102:74: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:103:70: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:105:96: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:163:24: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:177:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:184:40: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:239:43: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:242:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:245:79: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2076:51: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2161:59: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2228:52: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2292:51: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2356:48: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2469:57: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2526:43: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2541:44: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2794:79: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2799:77: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:2804:77: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:3236:93: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:3452:85: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:3469:83: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:3888:93: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:4378:90: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/abc.py:4399:88: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/annotations.py:1538:79: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(...) -> Coroutine[Any, Any, Any] | Any`, found `object`
- tanjun/annotations.py:1538:79: error[invalid-argument-type] Argument to bound method `__init__` is incorrect: Expected `(...) -> Coroutine[Any, Any, Any] | Any`, found `object`
- tanjun/checks.py:975:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:981:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:987:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:992:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1020:53: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1032:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1032:68: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1062:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1064:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1071:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1073:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1080:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1082:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1088:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1088:69: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1123:38: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1152:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1154:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1211:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1213:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1224:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1226:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1237:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1239:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1249:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/checks.py:1251:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/clients.py:83:102: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/clients.py:758:65: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/clients.py:758:105: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/clients.py:1218:100: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/clients.py:2078:97: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/clients.py:2097:95: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/base.py:57:44: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/base.py:63:64: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/base.py:100:50: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/base.py:108:51: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/menu.py:55:96: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/menu.py:56:90: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/menu.py:65:92: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:86:51: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:86:74: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:86:95: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:90:96: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:91:100: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:92:96: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:446:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:450:51: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:450:72: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:496:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:498:51: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:498:72: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:545:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:547:51: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:547:74: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1658:69: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1659:67: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1660:67: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1678:86: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1683:84: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1688:84: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1929:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1936:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1936:76: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1953:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1955:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1955:76: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1970:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1978:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:1978:76: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2130:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2132:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2132:76: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2149:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2151:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2151:76: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2166:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2173:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2173:76: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2286:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2288:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2288:78: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2306:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2308:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2308:78: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2324:46: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2331:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2331:78: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2870:82: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:2958:80: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/commands/slash.py:3038:80: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/components.py:59:102: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/components.py:205:83: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/components.py:305:100: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/components.py:985:92: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/components.py:1003:90: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:52:87: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:53:89: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:54:95: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:55:91: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:57:90: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:58:92: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:59:98: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:60:94: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:62:72: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:63:74: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:64:80: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:65:76: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:93:57: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:94:65: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:95:60: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:96:61: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:97:54: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:145:58: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:150:58: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:198:66: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:203:66: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:244:59: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:249:59: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:287:58: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:292:58: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:330:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/hooks.py:335:55: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- tanjun/parsing.py:1553:37: error[invalid-argument-type] Argument to bound method `_add_converter` is incorrect: Expected `(...) -> Coroutine[Any, Any, Any] | Any`, found `object`
- Found 295 diagnostics
+ Found 132 diagnostics

prefect (https://github.com/PrefectHQ/prefect)
- src/prefect/server/database/dependencies.py:170:36: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/database/dependencies.py:170:57: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/database/dependencies.py:174:38: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/database/dependencies.py:178:30: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/database/dependencies.py:178:52: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/database/dependencies.py:179:23: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/database/dependencies.py:251:45: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/database/dependencies.py:254:47: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/database/dependencies.py:257:43: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/database/dependencies.py:257:65: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/database/dependencies.py:260:49: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/database/dependencies.py:260:71: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/database/dependencies.py:265:36: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/database/dependencies.py:314:55: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/database/dependencies.py:320:36: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/utilities/database.py:70:36: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/utilities/database.py:70:57: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/utilities/database.py:74:38: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/utilities/database.py:78:30: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- src/prefect/server/utilities/database.py:78:52: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- src/prefect/server/utilities/database.py:79:23: error[invalid-type-arguments] Too many type arguments: expected 1, got 3
- Found 3396 diagnostics
+ Found 3375 diagnostics

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
+ src/scikit_build_core/_logging.py:153:13: warning[unsupported-base] Unsupported class base with type `<class 'Mapping[str, Style]'> | <class 'Mapping[str, Divergent]'>`
- Found 41 diagnostics
+ Found 42 diagnostics

arviz (https://github.com/arviz-devs/arviz)
- arviz/stats/ecdf_utils.py:83:12: error[invalid-return-type] Return type does not match returned value: expected `tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[Any]]]`, found `tuple[int | float | Any, int | float | Any]`
+ arviz/stats/ecdf_utils.py:83:12: error[invalid-return-type] Return type does not match returned value: expected `tuple[ndarray[tuple[Any, ...], dtype[Any]], ndarray[tuple[Any, ...], dtype[Any]]]`, found `tuple[int | float | Unknown, int | float | Unknown]`

altair (https://github.com/vega/altair)
- altair/datasets/_readimpl.py:221:37: error[invalid-type-arguments] Type `IntoDataFrameT@scan_fn` is not assignable to upper bound `NativeLazyFrame` of type variable `IntoLazyFrameT@LazyFrame`
+ altair/datasets/_readimpl.py:221:37: error[invalid-type-arguments] Type `IntoDataFrameT@into_scan` is not assignable to upper bound `NativeLazyFrame` of type variable `IntoLazyFrameT@LazyFrame`
- altair/datasets/_readimpl.py:223:62: error[invalid-type-arguments] Type `IntoDataFrameT@scan_fn` is not assignable to upper bound `NativeLazyFrame` of type variable `IntoLazyFrameT@LazyFrame`
+ altair/datasets/_readimpl.py:223:62: error[invalid-type-arguments] Type `IntoDataFrameT@into_scan` is not assignable to upper bound `NativeLazyFrame` of type variable `IntoLazyFrameT@LazyFrame`
- altair/utils/_transformed_data.py:119:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ altair/utils/_transformed_data.py:119:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- altair/utils/save.py:283:14: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ altair/utils/save.py:283:14: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ altair/vegalite/v6/schema/channels.py:22003:35: error[unsupported-operator] Operator `|` is unsupported between objects of type `<class 'str'>` and `<class 'Detail'>`
+ altair/vegalite/v6/schema/channels.py:22519:22: error[unsupported-operator] Operator `|` is unsupported between objects of type `<class 'str'>` and `<class 'Detail'>`
- tests/test_jupyter_chart.py:52:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/test_jupyter_chart.py:52:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/test_jupyter_chart.py:78:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/test_jupyter_chart.py:78:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/test_jupyter_chart.py:146:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/test_jupyter_chart.py:146:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/test_jupyter_chart.py:206:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/test_jupyter_chart.py:206:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/test_jupyter_chart.py:269:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/test_jupyter_chart.py:269:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/utils/test_mimebundle.py:231:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/utils/test_mimebundle.py:231:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/utils/test_mimebundle.py:245:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/utils/test_mimebundle.py:245:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:211:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:211:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:215:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:215:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:222:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:222:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:226:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:226:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:986:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:986:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:995:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:995:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1518:10: error[invalid-context-manager] Object of type `PluginEnabler[@Todo, ThemeConfig]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1518:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, ThemeConfig]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1523:10: error[invalid-context-manager] Object of type `PluginEnabler[@Todo, ThemeConfig]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1523:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, ThemeConfig]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1529:10: error[invalid-context-manager] Object of type `PluginEnabler[@Todo, ThemeConfig]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1529:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, ThemeConfig]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1562:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1562:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1565:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1565:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1592:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1592:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1597:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1597:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1605:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1605:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1609:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1609:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_api.py:1911:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_api.py:1911:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_data.py:15:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_data.py:15:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_data.py:27:13: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_data.py:27:13: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:32:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:32:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:52:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:52:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:72:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:72:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:102:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:102:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:122:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:122:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:132:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:132:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:168:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:168:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_geo_interface.py:210:10: error[invalid-context-manager] Object of type `PluginEnabler[(...) -> Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_geo_interface.py:210:10: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, Unknown]` cannot be used with `with` because it does not correctly implement `__exit__`
- tests/vegalite/v6/test_theme.py:48:14: error[invalid-context-manager] Object of type `PluginEnabler[@Todo, ThemeConfig]` cannot be used with `with` because it does not correctly implement `__exit__`
+ tests/vegalite/v6/test_theme.py:48:14: error[invalid-context-manager] Object of type `PluginEnabler[Unknown, ThemeConfig]` cannot be used with `with` because it does not correctly implement `__exit__`
- Found 1105 diagnostics
+ Found 1107 diagnostics

scipy-stubs (https://github.com/scipy/scipy-stubs)
- scipy-stubs/differentiate/_differentiate.pyi:70:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/differentiate/_differentiate.pyi:85:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/differentiate/_differentiate.pyi:100:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/differentiate/_differentiate.pyi:115:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/differentiate/_differentiate.pyi:130:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:22:38: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:22:58: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:22:82: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:22:106: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:88:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:95:19: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:119:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:125:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:126:19: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:127:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:128:27: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:131:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:131:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:136:22: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:137:19: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:138:22: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:150:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:168:18: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:169:17: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:170:26: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:171:25: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:177:14: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:180:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:181:19: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:182:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:183:27: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:189:14: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:194:18: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:195:17: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:200:26: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:201:25: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:209:20: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:210:19: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:215:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_bvp.pyi:216:27: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_ivp/ivp.pyi:73:72: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_rules/_base.pyi:22:36: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_rules/_base.pyi:25:36: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_rules/_base.pyi:51:23: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:25:40: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/integrate/_tanhsinh.pyi:26:43: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/integrate/_tanhsinh.pyi:106:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:107:23: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:121:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:122:23: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:136:43: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:137:24: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:166:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:167:23: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:181:42: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:182:23: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:196:43: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/integrate/_tanhsinh.pyi:197:24: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/interpolate/_ndbspline.pyi:72:25: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/interpolate/_ndbspline.pyi:77:88: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/interpolate/_rgi.pyi:40:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/interpolate/_rgi.pyi:53:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/interpolate/_rgi.pyi:66:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/linalg/_decomp_svd.pyi:39:14: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
+ scipy-stubs/linalg/_decomp_svd.pyi:39:26: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- scipy-stubs/linalg/_decomp_svd.pyi:48:14: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
+ scipy-stubs/linalg/_decomp_svd.pyi:48:26: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- scipy-stubs/linalg/_decomp_svd.pyi:57:14: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
+ scipy-stubs/linalg/_decomp_svd.pyi:57:29: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- scipy-stubs/linalg/_decomp_svd.pyi:66:14: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
+ scipy-stubs/linalg/_decomp_svd.pyi:66:28: error[invalid-type-arguments] Too many type arguments: expected 1, got 2
- scipy-stubs/linalg/_matfuncs.pyi:219:45: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/linalg/_matfuncs.pyi:221:45: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/linalg/_matfuncs.pyi:223:52: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/linalg/_matfuncs.pyi:225:52: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/linalg/_matfuncs.pyi:227:54: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/linalg/_matfuncs.pyi:229:54: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_filters.pyi:583:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:595:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:607:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:619:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:631:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:643:30: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:725:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:737:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:749:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:761:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:773:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_filters.pyi:785:29: error[invalid-type-arguments] Too many type arguments: expected 0, got 2
- scipy-stubs/ndimage/_measurements.pyi:244:17: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:248:17: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:252:17: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:256:17: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:258:105: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:262:17: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:264:120: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:268:17: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:272:36: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/ndimage/_measurements.pyi:278:35: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/optimize/_differentiable_functions.pyi:35:36: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/optimize/_differentiable_functions.pyi:36:32: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/optimize/_differentiable_functions.pyi:37:34: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/optimize/_differentiable_functions.pyi:60:27: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/optimize/_differentiable_functions.pyi:66:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/optimize/_differentiable_functions.pyi:72:28: error[invalid-type-arguments] Too many type arguments: expected 0, got 1
- scipy-stubs/optimize/_differentiable_functions.pyi:91:25: error[invalid-type-arguments] Too many 

... (truncated 918 lines) ...

No memory usage changes detected ✅

@sharkdp sharkdp force-pushed the david/fix-specialized-unknown branch from d9f5c84 to 55e61e7 Compare December 2, 2025 11:53
@astral-sh-bot
Copy link

astral-sh-bot bot commented Dec 2, 2025

ecosystem-analyzer results

Lint rule Added Removed Changed
invalid-type-arguments 0 416 19
type-assertion-failure 0 0 358
invalid-context-manager 0 0 36
invalid-argument-type 2 4 0
possibly-missing-attribute 0 0 3
unsupported-base 0 3 0
unsupported-operator 2 0 1
no-matching-overload 0 2 0
invalid-return-type 0 0 1
unused-ignore-comment 1 0 0
Total 5 425 418

Full report with detailed diff (timing results)

@sharkdp sharkdp force-pushed the david/fix-specialized-unknown branch from 55e61e7 to 7cab1a0 Compare December 2, 2025 13:52
@sharkdp sharkdp changed the title [ty] Support generic type aliases involving unknown generic classes [ty] Support typevar-specialized dynamic types in generic type aliases Dec 2, 2025
@sharkdp sharkdp force-pushed the david/fix-specialized-unknown branch from 7cab1a0 to ea286c2 Compare December 2, 2025 15:11
@sharkdp sharkdp force-pushed the david/fix-specialized-unknown branch from ea286c2 to 7072614 Compare December 2, 2025 16:26
@sharkdp sharkdp marked this pull request as ready for review December 2, 2025 16:40
@carljm
Copy link
Contributor

carljm commented Dec 3, 2025

The conformance suite results here look fine. Most of the changes are around ParamSpec, in the direction of issuing fewer diagnostics on our failure to understand them, which makes sense since they are currently a Todo type so end up being a case of "explicitly specializing a dynamic type". In some cases we stop erroring on lines we should error on, but we were previously erroring for the wrong reason, so that's still good.

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

Comment on lines +220 to +238
# TODO: should be (list[int], /) -> int
reveal_type(c) # revealed: (Unknown, /) -> int

K = TypeVar("K")
V = TypeVar("V")

MyDict = TypeAliasType("MyDict", dict[K, V], type_params=(K, V))

MyAlias6 = Callable[[MyDict[K, V]], int]

def _(c: MyAlias6[str, bytes]):
# TODO: should be (dict[str, bytes], /) -> int
reveal_type(c) # revealed: (Unknown, /) -> int

ListOrDict: TypeAlias = MyList[T] | dict[str, T]

def _(x: ListOrDict[int]):
# TODO: should be list[int] | dict[str, int]
reveal_type(x) # revealed: Unknown | dict[str, int]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's our barrier to getting these three TODOs right? I guess it's just that we currently don't support generics at all on "manual" PEP 695 type aliases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, exactly. I considered this to be a (maybe lower-priority?) task separate from the generic implicit/PEP613 type alias work. I opened astral-sh/ty#1737.

);
let generic_context =
GenericContext::from_typevar_instances(self.db(), variables);
Type::Dynamic(DynamicType::UnknownGeneric(generic_context))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a TODO here, yeah?

And we should probably file a follow-up issue for supporting generics in "manual" PEP 695 type aliases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a TODO here, yeah?

Yes, I think in my mind, the whole DynamicType::UnknownGeneric variant was a sort of "Todo" marker, but I added an explicit TODO comment now 👍

And we should probably file a follow-up issue for supporting generics in "manual" PEP 695 type aliases?

astral-sh/ty#1737

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, get_size2::GetSize)]
pub enum SuperOwnerKind<'db> {
Dynamic(DynamicType),
Dynamic(DynamicType<'db>),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, this lifetime was just removed a week or so ago...

@sharkdp sharkdp force-pushed the david/fix-specialized-unknown branch from 7072614 to 3e2ef9b Compare December 3, 2025 08:25
@sharkdp
Copy link
Contributor Author

sharkdp commented Dec 3, 2025

The conformance suite results here look fine.

Thank you for checking, I was so focused on the ecosystem impact (which was erratically changing with every push), I forgot to take a look at the conformance results.

@sharkdp sharkdp merged commit 21e5a57 into main Dec 3, 2025
42 checks passed
@sharkdp sharkdp deleted the david/fix-specialized-unknown branch December 3, 2025 09:00
dcreager added a commit that referenced this pull request Dec 3, 2025
* origin/main:
  [ty] Improve `@override`, `@final` and Liskov checks in cases where there are multiple reachable definitions (#21767)
  [ty] Extend `invalid-explicit-override` to also cover properties decorated with `@override` that do not override anything (#21756)
  [ty] Enable LRU collection for parsed module (#21749)
  [ty] Support typevar-specialized dynamic types in generic type aliases (#21730)
  Add token based `parenthesized_ranges` implementation (#21738)
  [ty] Default-specialization of generic type aliases (#21765)
  [ty] Suppress false positives when `dataclasses.dataclass(...)(cls)` is called imperatively (#21729)
  [syntax-error] Default type parameter followed by non-default type parameter (#21657)
  new module for parsing ranged suppressions (#21441)
  [ty] `type[T]` is assignable to an inferable typevar (#21766)
  Fix syntax error false positives for `await` outside functions (#21763)
  [ty] Improve diagnostics for unsupported comparison operations (#21737)
  Move `Token`, `TokenKind` and `Tokens` to `ruff-python-ast` (#21760)
  [ty] Don't confuse multiple occurrences of `typing.Self` when binding bound methods (#21754)
  Use our org-wide Renovate preset (#21759)
  Delete `my-script.py` (#21751)
  [ty] Move `all_members`, and related types/routines, out of `ide_support.rs` (#21695)
dcreager added a commit that referenced this pull request Dec 3, 2025
* origin/main:
  [ty] Reachability constraints: minor documentation fixes (#21774)
  [ty] Fix non-determinism in `ConstraintSet.specialize_constrained` (#21744)
  [ty] Improve `@override`, `@final` and Liskov checks in cases where there are multiple reachable definitions (#21767)
  [ty] Extend `invalid-explicit-override` to also cover properties decorated with `@override` that do not override anything (#21756)
  [ty] Enable LRU collection for parsed module (#21749)
  [ty] Support typevar-specialized dynamic types in generic type aliases (#21730)
  Add token based `parenthesized_ranges` implementation (#21738)
  [ty] Default-specialization of generic type aliases (#21765)
  [ty] Suppress false positives when `dataclasses.dataclass(...)(cls)` is called imperatively (#21729)
  [syntax-error] Default type parameter followed by non-default type parameter (#21657)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ecosystem-analyzer ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants