Skip to content

Speed up type evaluation by deferring unused diagnostics and caching context-independent speculative args - #12092

Draft
Bill Schnurr (bschnurr) wants to merge 4 commits into
microsoft:mainfrom
bschnurr:pyright-speculative-and-diag-perf
Draft

Bill Schnurr (bschnurr) wants to merge 4 commits into
microsoft:mainfrom
bschnurr:pyright-speculative-and-diag-perf

Conversation

@bschnurr

Copy link
Copy Markdown
Member

Summary

Optimizes Pyright's type evaluation hot paths during overload resolution and speculative argument checking:

  1. Skip unused diagnostic construction: Avoid allocating and populating DiagnosticAddendum trees in typeCompatibility.ts / typeEvaluator.ts when diagnostics are not requested.
  2. Cache context-independent speculative argument expressions:
    • Statically reuse speculative type cache entries for expressions that never depend on expectedType.
    • Dynamically track SpeculativeTypeEntry.isContextIndependent in SpeculativeTypeTracker and getTypeOfExpressionWithCache / writeTypeCache so non-trivial expressions (Call, BinaryOperation, etc.) that never read inferenceContext.expectedType are reused across overloads regardless of expectedType.
    • Defer reading inferenceContext.expectedType in validateArgTypesWithContext until after requiresSpecialization(returnType) is checked, and avoid redundant makeInferenceContext cloning in validateCallForFunction.
  3. Skip duplicate expected-type check in speculative validateArgType: Pass an internal skipExpectedTypeCheck flag from validateArgType when speculative mode is active, since validateArgType immediately runs assignType itself and discards typeErrors.

Benchmark (pandas-dev/pandas, commit fff774c, 340 checked files)

Measured across 3 unprofiled runs each with 0 diagnostic diffs vs baseline (261 errors, 1 warning, 0 informations):

Stage Median Wall Median Check vs Baseline (Check)
Baseline (main) 40.07 s 35.24 s —
Core deferred diagnostics + static speculative cache 34.11 s 29.15 s -17.3%
Combined with dynamic isContextIndependent + skipExpectedTypeCheck + companion member-lookup/reachability PR 33.01 s–33.34 s 27.96 s–28.20 s -20.0% to -20.7%

Testing

  • Prettier + ESLint check on changed files — passed
  • pyright-internal TypeScript build — passed
  • Pyright Jest suites (typeEvaluator1–8, diagnostics, overloadResult, overloadResultController, typeCacheIsolation, typeCacheUtils) — 13/13 suites, 1,648/1,648 tests passed
  • pandas-dev/pandas full check — 0 diagnostic diffs vs baseline

…context-independent speculative args

- Avoid building unused DiagnosticAddendum trees in assignClass / assignType when no diagnostics are collected (e.g., overload resolution and speculative checks).
- Cache context-independent argument expressions across overload evaluations (both statically for simple expressions and dynamically via SpeculativeTypeEntry.isContextIndependent when inferenceContext.expectedType is not read).
- Defer reading inferenceContext.expectedType in validateArgTypesWithContext until specialization is needed, remove redundant makeInferenceContext copying in validateCallForFunction, and skip duplicate expected-type assignType checks in getTypeOfExpressionWithCache during speculative validateArgType.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ff5a8fd-cdd9-4386-b8d9-e74377cd287e
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@heejaechang

Copy link
Copy Markdown
Collaborator

🟢 Pyright CLI QA — 1ca093fd — verdict: green

Automated CLI checks compared this change with its base revision.
20 focused check(s) completed.

No new behavior difference was detected.

…iagAddendum

Remove isExpressionContextIndependent (string literals, names, member accesses,
and index expressions can depend on expectedType, e.g. LiteralString in ibis)
and rely solely on dynamic inferenceContextRead tracking. Also keep populating
expectedTypeDiagAddendum on failed expected-type checks even in speculative mode
so cached results used for diagnostics retain full addendum lines (fixing sympy
and other mypy_primer diffs) while still skipping DiagnosticAddendum allocation
on the common passing path.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ff5a8fd-cdd9-4386-b8d9-e74377cd287e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ff5a8fd-cdd9-4386-b8d9-e74377cd287e
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

ibis (https://github.com/ibis-project/ibis)
-   .../projects/ibis/ibis/common/patterns.py:581:26 - error: Argument of type "Generator[str | Unknown, None, None]" cannot be assigned to parameter "iterable" of type "Iterable[LiteralString]" in function "join"
-     "Generator[str | Unknown, None, None]" is not assignable to "Iterable[LiteralString]"
-       Type parameter "_T_co@Iterable" is covariant, but "str | Unknown" is not a subtype of "LiteralString"
-         Type "str | Unknown" is not assignable to type "LiteralString"
-           "str" is not assignable to "LiteralString" (reportArgumentType)
- 7235 errors, 247 warnings, 0 informations
+ 7234 errors, 247 warnings, 0 informations

sympy (https://github.com/sympy/sympy)
-   .../projects/sympy/sympy/matrices/expressions/tests/test_kronecker.py:115:44 - error: Argument of type "dict[MatrixSymbol, MutableDenseMatrix]" cannot be assigned to parameter "arg1" of type "Iterable[tuple[Basic | complex, Basic | complex]]" in function "subs"
+   .../projects/sympy/sympy/matrices/expressions/tests/test_kronecker.py:115:44 - error: Argument of type "dict[MatrixSymbol, MutableDenseMatrix]" cannot be assigned to parameter "arg1" of type "Iterable[tuple[Basic | complex, Basic | complex]]" in function "subs" (reportArgumentType)
-     "MatrixSymbol" is not assignable to "tuple[Basic | complex, Basic | complex]"
-     "MatrixSymbol" is not assignable to "tuple[Basic | complex, Basic | complex]" (reportArgumentType)
-   .../projects/sympy/sympy/matrices/expressions/tests/test_kronecker.py:119:45 - error: Argument of type "dict[MatrixSymbol, MutableDenseMatrix]" cannot be assigned to parameter "arg1" of type "Iterable[tuple[Basic | complex, Basic | complex]]" in function "subs"
+   .../projects/sympy/sympy/matrices/expressions/tests/test_kronecker.py:119:45 - error: Argument of type "dict[MatrixSymbol, MutableDenseMatrix]" cannot be assigned to parameter "arg1" of type "Iterable[tuple[Basic | complex, Basic | complex]]" in function "subs" (reportArgumentType)
-     "MatrixSymbol" is not assignable to "tuple[Basic | complex, Basic | complex]"
-     "MatrixSymbol" is not assignable to "tuple[Basic | complex, Basic | complex]" (reportArgumentType)
-   .../projects/sympy/sympy/ntheory/continued_fraction.py:249:30 - error: Cannot access attribute "radsimp" for class "Basic"
-     Attribute "radsimp" is unknown (reportAttributeAccessIssue)
-     "dict[Expr, int]" is not assignable to "Mapping[Expr, Expr]"
+     "dict[Expr, int]" is not assignable to "Mapping[Tbasic@xreplace, Expr]"
-     "dict[Expr, int]" is not assignable to "Mapping[Expr, Expr]"
+     "dict[Expr, int]" is not assignable to "Mapping[Tbasic@xreplace, Expr]"
-   .../projects/sympy/sympy/physics/quantum/boson.py:147:48 - error: Operator "-" not supported for types "Expr | Basic" and "Literal[1]"
+   .../projects/sympy/sympy/physics/quantum/boson.py:147:48 - error: Operator "-" not supported for types "Unknown | Basic" and "Literal[1]"
-   .../projects/sympy/sympy/physics/quantum/boson.py:149:25 - error: Operator "+" not supported for types "Expr | Basic" and "Literal[1]"
+   .../projects/sympy/sympy/physics/quantum/boson.py:149:25 - error: Operator "+" not supported for types "Unknown | Basic" and "Literal[1]"
-   .../projects/sympy/sympy/physics/quantum/boson.py:149:52 - error: Operator "+" not supported for types "Expr | Basic" and "Literal[1]"
+   .../projects/sympy/sympy/physics/quantum/boson.py:149:52 - error: Operator "+" not supported for types "Unknown | Basic" and "Literal[1]"
-   .../projects/sympy/sympy/physics/quantum/boson.py:209:30 - error: Argument of type "Expr | Basic" cannot be assigned to parameter "x" of type "SupportsAbs[_T@abs]" in function "abs"
+   .../projects/sympy/sympy/physics/quantum/boson.py:209:30 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "x" of type "SupportsAbs[_T@abs]" in function "abs"
-     Type "Expr | Basic" is not assignable to type "SupportsAbs[_T@abs]"
+     Type "Unknown | Basic" is not assignable to type "SupportsAbs[_T@abs]"
-   .../projects/sympy/sympy/physics/quantum/boson.py:209:67 - error: Operator "*" not supported for types "Expr" and "Expr | Basic"
+   .../projects/sympy/sympy/physics/quantum/boson.py:209:67 - error: Operator "*" not supported for types "Expr" and "Unknown | Basic"
-   .../projects/sympy/sympy/physics/quantum/boson.py:213:20 - error: Operator "*" not supported for types "Expr | Basic" and "Self@BosonCoherentKet"
+   .../projects/sympy/sympy/physics/quantum/boson.py:213:20 - error: Operator "*" not supported for types "Unknown | Basic" and "Self@BosonCoherentKet"
-   .../projects/sympy/sympy/physics/quantum/boson.py:242:20 - error: Operator "*" not supported for types "Expr | Basic" and "Self@BosonCoherentBra"
+   .../projects/sympy/sympy/physics/quantum/boson.py:242:20 - error: Operator "*" not supported for types "Unknown | Basic" and "Self@BosonCoherentBra"
-   .../projects/sympy/sympy/physics/quantum/cartesian.py:173:20 - error: Operator "*" not supported for types "Expr" and "Expr | Basic"
+   .../projects/sympy/sympy/physics/quantum/cartesian.py:173:20 - error: Operator "*" not supported for types "Expr" and "Unknown | Basic"
-   .../projects/sympy/sympy/physics/quantum/cartesian.py:282:20 - error: Operator "*" not supported for types "ImaginaryUnit" and "Expr | Basic"
+   .../projects/sympy/sympy/physics/quantum/cartesian.py:282:20 - error: Operator "*" not supported for types "ImaginaryUnit" and "Unknown | Basic"
-     Return type mismatch: base method returns type "tuple[Expr, ...]", override returns type "Tuple"
+     Return type mismatch: base method returns type "tuple[Unknown, ...]", override returns type "Tuple"
-       "Tuple" is not assignable to "tuple[Expr, ...]" (reportIncompatibleMethodOverride)
+       "Tuple" is not assignable to "tuple[Unknown, ...]" (reportIncompatibleMethodOverride)
-   .../projects/sympy/sympy/physics/quantum/gate.py:377:26 - error: Cannot access attribute "targets" for class "Expr"
-     Attribute "targets" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/physics/quantum/gate.py:382:22 - error: Argument of type "Expr | Basic" cannot be assigned to parameter "iterable" of type "Iterable[_T_co@tuple]" in function "__new__"
+   .../projects/sympy/sympy/physics/quantum/gate.py:382:22 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "iterable" of type "Iterable[_T_co@tuple]" in function "__new__"
-     Type "Expr | Basic" is not assignable to type "Iterable[_T_co@tuple]"
+     Type "Unknown | Basic" is not assignable to type "Iterable[_T_co@tuple]"
-   .../projects/sympy/sympy/physics/quantum/gate.py:394:26 - error: Cannot access attribute "get_target_matrix" for class "Expr"
-     Attribute "get_target_matrix" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/physics/quantum/gate.py:404:27 - error: Cannot access attribute "targets" for class "Expr"
-     Attribute "targets" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/physics/quantum/gate.py:455:26 - error: Cannot access attribute "gate_name" for class "Expr"
-     Attribute "gate_name" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/physics/quantum/gate.py:456:27 - error: Cannot access attribute "plot_gate_plus" for class "Expr"
-     Attribute "plot_gate_plus" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/physics/quantum/gate.py:457:28 - error: Cannot access attribute "gate_name" for class "Expr"
-     Attribute "gate_name" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/physics/quantum/gate.py:460:27 - error: Cannot access attribute "plot_gate" for class "Expr"
-     Attribute "plot_gate" is unknown (reportAttributeAccessIssue)
-     Attribute "plot_gate" is unknown (reportAttributeAccessIssue)
-   .../projects/sympy/sympy/physics/quantum/gate.py:462:23 - error: Cannot access attribute "plot_gate" for class "Expr"
-   .../projects/sympy/sympy/physics/quantum/gate.py:547:22 - error: Argument of type "Expr | Basic" cannot be assigned to parameter "iterable" of type "Iterable[_T_co@tuple]" in function "__new__"
+   .../projects/sympy/sympy/physics/quantum/gate.py:547:22 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "iterable" of type "Iterable[_T_co@tuple]" in function "__new__"
-     Type "Expr | Basic" is not assignable to type "Iterable[_T_co@tuple]"
+     Type "Unknown | Basic" is not assignable to type "Iterable[_T_co@tuple]"
-   .../projects/sympy/sympy/physics/quantum/gate.py:591:27 - error: Argument of type "Expr | Basic" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
+   .../projects/sympy/sympy/physics/quantum/gate.py:591:27 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
-     Type "Expr | Basic" is not assignable to type "ConvertibleToInt"
+     Type "Unknown | Basic" is not assignable to type "ConvertibleToInt"
-   .../projects/sympy/sympy/physics/quantum/gate.py:591:27 - error: Argument of type "Expr | Basic" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
+   .../projects/sympy/sympy/physics/quantum/gate.py:591:27 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
-     Type "Expr | Basic" is not assignable to type "ConvertibleToInt"
+     Type "Unknown | Basic" is not assignable to type "ConvertibleToInt"
-   .../projects/sympy/sympy/physics/quantum/gate.py:727:27 - error: Argument of type "Expr | Basic" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
+   .../projects/sympy/sympy/physics/quantum/gate.py:727:27 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
-     Type "Expr | Basic" is not assignable to type "ConvertibleToInt"
+     Type "Unknown | Basic" is not assignable to type "ConvertibleToInt"
-   .../projects/sympy/sympy/physics/quantum/gate.py:727:27 - error: Argument of type "Expr | Basic" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
+   .../projects/sympy/sympy/physics/quantum/gate.py:727:27 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "x" of type "ConvertibleToInt" in function "__new__"
-     Type "Expr | Basic" is not assignable to type "ConvertibleToInt"
+     Type "Unknown | Basic" is not assignable to type "ConvertibleToInt"

... (truncated 328 lines) ...

scikit-learn (https://github.com/scikit-learn/scikit-learn)
-           "__getitem__" is an incompatible type (reportArgumentType)
+           "__getitem__" is an incompatible type
+     ... (reportArgumentType)
-   .../projects/scikit-learn/sklearn/impute/_base.py:155:45 - error: Argument of type "tuple[SparseABC | Unknown, Unknown]" cannot be assigned to parameter "blocks" of type "Sequence[_spbase[Any, tuple[Any, ...]]]" in function "__call__"
+   .../projects/scikit-learn/sklearn/impute/_base.py:155:44 - error: Argument of type "tuple[SparseABC | Unknown, Unknown]" cannot be assigned to parameter "blocks" of type "Sequence[_spbase[Any, tuple[Any, ...]]]" in function "__call__"
+     "tuple[SparseABC | Unknown, Unknown]" is not assignable to "Sequence[_spbase[Any, tuple[Any, ...]]]"
+       Type parameter "_T_co@Sequence" is covariant, but "SparseABC | Unknown" is not a subtype of "_spbase[Any, tuple[Any, ...]]"
-     Type "SparseABC | Unknown" is not assignable to type "_spbase[Any, tuple[Any, ...]]"
+         Type "SparseABC | Unknown" is not assignable to type "_spbase[Any, tuple[Any, ...]]"
-       "SparseABC" is not assignable to "_spbase[Any, tuple[Any, ...]]" (reportArgumentType)
+           "SparseABC" is not assignable to "_spbase[Any, tuple[Any, ...]]" (reportArgumentType)
-   .../projects/scikit-learn/sklearn/linear_model/_least_angle.py:803:34 - error: Argument of type "tuple[slice[None, int | Unknown, None], slice[int | Unknown, None, None]]" cannot be assigned to parameter "key" of type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" in function "__getitem__"
+   .../projects/scikit-learn/sklearn/linear_model/_least_angle.py:803:34 - error: Argument of type "tuple[slice[None, int, None], slice[int, None, None]]" cannot be assigned to parameter "key" of type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" in function "__getitem__"
-     Type "tuple[slice[None, int | Unknown, None], slice[int | Unknown, None, None]]" is not assignable to type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]"
+     Type "tuple[slice[None, int, None], slice[int, None, None]]" is not assignable to type "SupportsIndex | slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]"
-       "tuple[slice[None, int | Unknown, None], slice[int | Unknown, None, None]]" is incompatible with protocol "SupportsIndex"
+       "tuple[slice[None, int, None], slice[int, None, None]]" is incompatible with protocol "SupportsIndex"
-       "tuple[slice[None, int | Unknown, None], slice[int | Unknown, None, None]]" is not assignable to "slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" (reportArgumentType)
+       "tuple[slice[None, int, None], slice[int, None, None]]" is not assignable to "slice[SupportsIndex | None, SupportsIndex | None, SupportsIndex | None]" (reportArgumentType)
+           "__len__" is not present
+     ... (reportArgumentType)
+   .../projects/scikit-learn/sklearn/metrics/cluster/_unsupervised.py:146:18 - error: No overloads for "mean" match the provided arguments (reportCallIssue)
+   .../projects/scikit-learn/sklearn/metrics/cluster/_unsupervised.py:146:26 - error: Argument of type "Array" cannot be assigned to parameter "a" of type "_ArrayLikeComplex_co | _ArrayLikeObject_co" in function "mean"
+     Type "Array" is not assignable to type "_ArrayLikeComplex_co | _ArrayLikeObject_co"
+       "Array" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
+         "__array__" is not present
+       "Array" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
+         "__len__" is not present
+         "__contains__" is not present
+         "__iter__" is not present
+         "__reversed__" is not present
+     ... (reportArgumentType)
+   .../projects/scikit-learn/sklearn/metrics/cluster/tests/test_unsupervised.py:209:13 - error: Argument of type "Array" cannot be assigned to parameter "rel" of type "float | Decimal | timedelta | None" in function "approx"
+     Type "Array" is not assignable to type "float | Decimal | timedelta | None"
+       "Array" is not assignable to "float"
+       "Array" is not assignable to "Decimal"
+       "Array" is not assignable to "timedelta"
+       "Array" is not assignable to "None" (reportArgumentType)
+   .../projects/scikit-learn/sklearn/metrics/cluster/tests/test_unsupervised.py:292:5 - error: No overloads for "assert_allclose" match the provided arguments (reportCallIssue)
+   .../projects/scikit-learn/sklearn/metrics/cluster/tests/test_unsupervised.py:292:21 - error: Argument of type "Array" cannot be assigned to parameter "actual" of type "_NumericArrayLike" in function "assert_allclose"
+     Type "Array" is not assignable to type "_NumericArrayLike"
+       "Array" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
+         "__array__" is not present
+       "Array" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
+         "__len__" is not present
+         "__contains__" is not present
+         "__iter__" is not present
+         "__reversed__" is not present
+     ... (reportArgumentType)
+   .../projects/scikit-learn/sklearn/metrics/cluster/tests/test_unsupervised.py:292:47 - error: Argument of type "Array" cannot be assigned to parameter "desired" of type "_NumericArrayLike" in function "assert_allclose"
+     Type "Array" is not assignable to type "_NumericArrayLike"
+       "Array" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
+         "__array__" is not present
+       "Array" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
+         "__len__" is not present
+         "__contains__" is not present
+         "__iter__" is not present
+         "__reversed__" is not present
+     ... (reportArgumentType)
+   .../projects/scikit-learn/sklearn/metrics/cluster/tests/test_unsupervised.py:308:5 - error: No overloads for "assert_allclose" match the provided arguments (reportCallIssue)
+   .../projects/scikit-learn/sklearn/metrics/cluster/tests/test_unsupervised.py:308:21 - error: Argument of type "Array" cannot be assigned to parameter "actual" of type "_NumericArrayLike" in function "assert_allclose"
+     Type "Array" is not assignable to type "_NumericArrayLike"
+       "Array" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
+         "__array__" is not present
+       "Array" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
+         "__len__" is not present
+         "__contains__" is not present
+         "__iter__" is not present
+         "__reversed__" is not present
+     ... (reportArgumentType)
+   .../projects/scikit-learn/sklearn/metrics/cluster/tests/test_unsupervised.py:308:47 - error: Argument of type "Array" cannot be assigned to parameter "desired" of type "_NumericArrayLike" in function "assert_allclose"
+     Type "Array" is not assignable to type "_NumericArrayLike"
+       "Array" is incompatible with protocol "_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]"
+         "__array__" is not present
+       "Array" is incompatible with protocol "_NestedSequence[_SupportsArray[dtype[numpy.bool[builtins.bool] | number[Any, int | float | complex]]]]"
+         "__len__" is not present
+         "__contains__" is not present
+         "__iter__" is not present
+         "__reversed__" is not present
+     ... (reportArgumentType)
+     "tuple[coo_array[Any, tuple[Any, ...]] | str | tuple[str, str] | Unknown | Any | tuple[Unknown, Unknown | Any] | <subclass of SparseABC and spmatrix[Any]> | SparseABC, ndarray[_AnyShape, dtype[float64]]]" is not assignable to "Sequence[_CanStack[_StackedSparseMatrix[Any]]]"
+       Type parameter "_T_co@Sequence" is covariant, but "coo_array[Any, tuple[Any, ...]] | str | tuple[str, str] | Unknown | Any | tuple[Unknown, Unknown | Any] | <subclass of SparseABC and spmatrix[Any]> | SparseABC | ndarray[_AnyShape, dtype[float64]]" is not a subtype of "_CanStack[_StackedSparseMatrix[Any]]"
-     Type "coo_array[Any, tuple[Any, ...]] | str | tuple[str, str] | Unknown | Any | tuple[Unknown, Unknown | Any] | <subclass of SparseABC and spmatrix[Any]> | SparseABC" is not assignable to type "_CanStack[_StackedSparseMatrix[Any]]"
+         Type "coo_array[Any, tuple[Any, ...]] | str | tuple[str, str] | Unknown | Any | tuple[Unknown, Unknown | Any] | <subclass of SparseABC and spmatrix[Any]> | SparseABC | ndarray[_AnyShape, dtype[float64]]" is not assignable to type "_CanStack[_StackedSparseMatrix[Any]]"
-       "SparseABC" is incompatible with protocol "_CanStack[_StackedSparseMatrix[Any]]"
+           "SparseABC" is incompatible with protocol "_CanStack[_StackedSparseMatrix[Any]]"
-         "__assoc_stacked__" is not present
-     "ndarray[_AnyShape, dtype[float64]]" is incompatible with protocol "_CanStack[_StackedSparseMatrix[Any]]"
-       "__assoc_stacked__" is not present (reportArgumentType)
+             "__assoc_stacked__" is not present (reportArgumentType)
+   .../projects/scikit-learn/sklearn/neighbors/_nca.py:313:26 - error: No overloads for "ravel" match the provided arguments (reportCallIssue)
+   .../projects/scikit-learn/sklearn/neighbors/_nca.py:313:35 - error: Argument of type "Unknown | _Array2D[float64] | NDArray[float64] | Any | None" cannot be assigned to parameter "a" of type "ArrayLike" in function "ravel"

... (truncated 9 lines) ...

comtypes (https://github.com/enthought/comtypes)
-   .../projects/comtypes/comtypes/tools/tlbparser.py:180:20 - error: Type "ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to return type "ParsedType | SpecType"
-     Type "ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to type "ParsedType | SpecType"
-       Type "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to type "ParsedType | SpecType"
-         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to "TypeLib"
-         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to "Constant"
-         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to "External"
-         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to "CoClass"
-         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to "ComInterface"
-         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]]" is not assignable to "DispInterface"
+   .../projects/comtypes/comtypes/tools/tlbparser.py:180:20 - error: Type "ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to return type "ParsedType | SpecType"
+     Type "ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to type "ParsedType | SpecType"
+       Type "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to type "ParsedType | SpecType"
+         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to "TypeLib"
+         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to "Constant"
+         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to "External"
+         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to "CoClass"
+         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to "ComInterface"
+         "ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]] | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType | ArrayType[ParsedType | SpecType]]]]" is not assignable to "DispInterface"

streamlit (https://github.com/streamlit/streamlit)
+ .../projects/streamlit/lib/tests/streamlit/runtime/scriptrunner_utils/query_run_stats_test.py
+   .../projects/streamlit/lib/tests/streamlit/runtime/scriptrunner_utils/query_run_stats_test.py:44:56 - error: Argument of type "type[QueryTotals]" cannot be assigned to parameter "class_or_instance" of type "DataclassInstance | type[DataclassInstance]" in function "fields"
+     Type "type[QueryTotals]" is not assignable to type "DataclassInstance | type[DataclassInstance]"
+       "__dataclass_fields__" is defined as a ClassVar in protocol (reportArgumentType)
- 9493 errors, 39 warnings, 0 informations
+ 9494 errors, 39 warnings, 0 informations

core (https://github.com/home-assistant/core)
+   .../projects/core/homeassistant/components/bluetooth/passive_update_processor.py:44:76 - error: Argument of type "type[DeviceInfo]" cannot be assigned to parameter "class_or_instance" of type "DataclassInstance | type[DataclassInstance]" in function "fields"
+     Type "type[DeviceInfo]" is not assignable to type "DataclassInstance | type[DataclassInstance]"
+       "__dataclass_fields__" is defined as a ClassVar in protocol (reportArgumentType)
+   .../projects/core/homeassistant/components/stream/worker.py:663:29 - error: Argument of type "type[StreamSettings]" cannot be assigned to parameter "class_or_instance" of type "DataclassInstance | type[DataclassInstance]" in function "fields"
+     Type "type[StreamSettings]" is not assignable to type "DataclassInstance | type[DataclassInstance]"
+       "__dataclass_fields__" is defined as a ClassVar in protocol (reportArgumentType)
+   .../projects/core/homeassistant/components/zwave_js/config_flow.py:112:37 - error: Argument of type "type[Self@SecurityKeys]" cannot be assigned to parameter "class_or_instance" of type "DataclassInstance | type[DataclassInstance]" in function "fields"
+     Type "type[Self@SecurityKeys]" is not assignable to type "DataclassInstance | type[DataclassInstance]"
+       "__dataclass_fields__" is defined as a ClassVar in protocol (reportArgumentType)
+   .../projects/core/homeassistant/components/zwave_js/config_flow.py:121:37 - error: Argument of type "Self@SecurityKeys" cannot be assigned to parameter "class_or_instance" of type "DataclassInstance | type[DataclassInstance]" in function "fields"
+     Type "Self@SecurityKeys" is not assignable to type "DataclassInstance | type[DataclassInstance]"
+       Type "Self@SecurityKeys" is not assignable to type "type[DataclassInstance]" (reportArgumentType)
+   .../projects/core/homeassistant/components/zwave_js/config_flow.py:127:23 - error: Argument of type "Self@SecurityKeys" cannot be assigned to parameter "obj" of type "DataclassInstance" in function "asdict" (reportArgumentType)
+   .../projects/core/homeassistant/components/zwave_js/config_flow.py:139:37 - error: Argument of type "Self@SecurityKeys" cannot be assigned to parameter "class_or_instance" of type "DataclassInstance | type[DataclassInstance]" in function "fields"
+     Type "Self@SecurityKeys" is not assignable to type "DataclassInstance | type[DataclassInstance]"
+       Type "Self@SecurityKeys" is not assignable to type "type[DataclassInstance]" (reportArgumentType)
+   .../projects/core/homeassistant/components/zwave_js/config_flow.py:143:33 - error: Argument of type "Self@SecurityKeys" cannot be assigned to parameter "class_or_instance" of type "DataclassInstance | type[DataclassInstance]" in function "fields"
+     Type "Self@SecurityKeys" is not assignable to type "DataclassInstance | type[DataclassInstance]"
+       Type "Self@SecurityKeys" is not assignable to type "type[DataclassInstance]" (reportArgumentType)

... (truncated 448 lines) ...```

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Compared candidate 620844cfa9441fe9cf9f8b04a3802b02e15ea47b against its first parent 0806db94aedd3f1218d0138115bad263d3e8c578.

Release history charts were not rendered for this run. See the workflow run for details.

Type checker benchmark

🟢 No performance regressions detected.

Regression threshold: 20.0%
Statistic: median
Variance guard: >1.0s time and >100.0 MB memory

Package Checker Files checked Time Time delta Peak memory Memory delta Status
ansible pyright 583 15.402s -3.2% 1094.5 MB +1.2% 🟢 Pass
click pyright 17 2.405s -0.2% 357.5 MB -0.1% 🟢 Pass
homeassistant pyright 9850 150.218s +1.2% 5993.2 MB +0.2% 🟢 Pass
numpy pyright 356 28.464s -31.2% 1144.6 MB -7.0% 🟢 Pass
pandas pyright 1459 67.452s -12.4% 3513.0 MB -1.6% 🟢 Pass
pytest pyright 243 9.932s -4.0% 869.9 MB +1.2% 🟢 Pass
requests pyright 19 1.883s -1.3% 347.4 MB -0.0% 🟢 Pass
torch pyright 2400 96.404s +4.5% 4792.0 MB +3.7% 🟢 Pass
transformers pyright 2901 104.763s -12.2% 4968.7 MB +1.6% 🟢 Pass

Pyright stats

Package Parsed/bound Checked Find Read Tokenize Parse Imports Bind Check Cycles
ansible 989 583 0.030s 0.070s 0.283s 0.577s 0.163s 0.770s 12.977s 0.000s
click 111 17 0.000s 0.010s 0.093s 0.163s 0.033s 0.217s 1.637s 0.000s
homeassistant 11154 9850 0.703s 0.747s 3.217s 5.833s 1.983s 7.250s 124.507s 0.000s
numpy 606 356 0.010s 0.070s 0.360s 0.643s 0.250s 0.843s 25.750s 0.000s
pandas 1899 1459 0.040s 0.170s 0.810s 1.777s 0.217s 2.533s 60.853s 0.000s
pytest 545 243 0.010s 0.043s 0.287s 0.407s 0.077s 0.557s 8.310s 0.000s
requests 167 19 0.000s 0.020s 0.093s 0.167s 0.043s 0.227s 1.103s 0.000s
torch 3078 2400 0.100s 0.337s 1.337s 3.040s 0.527s 3.510s 83.007s 0.000s
transformers 3546 2901 0.153s 0.410s 2.030s 3.640s 0.900s 8.710s 92.667s 0.000s

… cache hits

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5ff5a8fd-cdd9-4386-b8d9-e74377cd287e

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants