Repository navigation
Preserve container types for ambiguous overload returns - #11732
Conversation
Address #11731 by retaining shared generic structure for nested Any and Unknown overload ambiguity, including specialized self and inferred constructors. Keep conservative fallbacks for unsupported shapes and differing non-invariant type arguments. Classification B: Pyright inference limitation. No typeshed change. Following python/typing#2350, replace top-level gradual results with assignable gradual containers where supported; preserve existing concrete precision and assert missing-member diagnostics. Co-authored-by: Copilot App <[email protected]>
|
🔒 Automated review in progress — Bill Schnurr (@bschnurr) is auto-reviewing this PR. |
This comment has been minimized.
This comment has been minimized.
|
Result: 🔴 Verification detailsVerification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. Summary: Targeted overload evaluator tests could not run because the offline cache lacked the baseline `[email protected]` tarball. Consequently, the package-local Jest runner was unavailable. The PR adds substantial regression coverage, but no meaningful tests executed, so confidence is low. Test runs: 1 passed, 2 not run
|
Classification B: Pyright inference limitation; no typeshed changes. Preserve correlated protocol self signatures and the Spark Series[int] result, while retaining legacy inference outside newly recognized alternatives. The four reviewed pandas-stubs precision changes are documented in PR #11732: the old timedelta-only results excluded valid integer results. Co-authored-by: Copilot App <[email protected]>
Analyze all eight primer shards using trusted preparation, read-only Copilot analysis, and separately validated publication. Preserve raw primer comments and activate the workflow after it lands on main. Co-authored-by: Copilot App <[email protected]>
This comment has been minimized.
This comment has been minimized.
Apply Prettier's full-file formatting to the new assertion; no type expectations or behavior change. Co-authored-by: Copilot App <[email protected]>
|
/benchmark |
This comment has been minimized.
This comment has been minimized.
|
Result: 🔴 Verification detailsVerification: Isolated verification observed failures whose relationship to this PR could not be determined: Offline dependency bootstrap; this review is not fully verified. Summary: No meaningful tests ran. Offline dependency installation failed because `js-yaml-4.1.1` was absent from the sandbox cache, leaving the package-local Jest runner unavailable. One Jest attempt also encountered a verification-environment file-lock error. The PR adds substantial targeted coverage, but execution could not be verified. Test runs: 1 passed, 1 failed, 2 not run
|
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Copilot App <[email protected]>
|
Addressed all three assertion comments in 9491918 and replied in the individual threads. For the separate
This commit strengthens assertions only; it does not change checker or workflow behavior. |
This comment has been minimized.
This comment has been minimized.
|
Result: 🔴 Verification detailsVerification: The relevant tests could not be fully run in the isolated environment; this review is not fully verified. Summary: The targeted suites cover overload inference, protocol-bound signatures, and the new mypy_primer workflow. Verification could not execute because `pnpm install --offline --frozen-lockfile` lacked the cached `js-yaml-4.1.1` tarball, leaving Jest unavailable. All three targeted commands consequently stopped with `MODULE_NOT_FOUND` before collecting tests. No meaningful test ran, so the verdict is **could-not-verify**. Test runs: 4 not run
|
Bill Schnurr (bschnurr)
left a comment
There was a problem hiding this comment.
Approved via Review Center.
Preserve headerless diagnostic details as separate evidence and counts, require their analysis, and regenerate the agentic workflow. Co-authored-by: Copilot App <[email protected]>
|
Diff from mypy_primer, showing the effect of this PR on open source code: sympy (https://github.com/sympy/sympy)
+ .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:225:45 - error: Cannot access attribute "has" for class "tuple[Expr, int]"
+ Attribute "has" is unknown (reportAttributeAccessIssue)
- .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:223:22 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:223:25 - error: Argument of type "Unknown | One | NegativeOne | Zero | Integer | tuple[Expr, int]" cannot be assigned to parameter "arg" of type "Expr" in function "__new__"
- Type "Unknown | One | NegativeOne | Zero | Integer | tuple[Expr, int]" is not assignable to type "Expr"
- "tuple[Expr, int]" is not assignable to "Expr" (reportArgumentType)
- .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:238:40 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/solvers/ode/nonhomogeneous.py:238:50 - error: Argument of type "Unknown | One | NegativeOne | Zero | Integer | tuple[Expr, int]" cannot be assigned to parameter "arg" of type "Expr" in function "__new__"
- Type "Unknown | One | NegativeOne | Zero | Integer | tuple[Expr, int]" is not assignable to type "Expr"
- "tuple[Expr, int]" is not assignable to "Expr" (reportArgumentType)
- .../projects/sympy/sympy/solvers/ode/ode.py:1433:17 - error: Argument of type "One | NegativeOne | Zero | Integer | Unknown | Rational | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
+ .../projects/sympy/sympy/solvers/ode/ode.py:1433:17 - error: Argument of type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
- Type "One | NegativeOne | Zero | Integer | Unknown | Rational | Number | Expr" is not assignable to type "Zero"
+ Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
- .../projects/sympy/sympy/solvers/ode/ode.py:2961:17 - error: Argument of type "One | NegativeOne | Zero | Integer | Unknown | Rational | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
+ .../projects/sympy/sympy/solvers/ode/ode.py:2961:17 - error: Argument of type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
- Type "One | NegativeOne | Zero | Integer | Unknown | Rational | Number | Expr" is not assignable to type "Zero"
+ Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr" is not assignable to type "Zero"
- .../projects/sympy/sympy/solvers/ode/single.py:867:9 - error: Expression with type "tuple[ComplexInfinity | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown]] | tuple[ComplexInfinity | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown], list[tuple[Unknown, Unknown]] | list[Unknown]]" cannot be assigned to target tuple
+ .../projects/sympy/sympy/solvers/ode/single.py:867:9 - error: Expression with type "tuple[ComplexInfinity | NaN | Rational | Zero | Infinity | NegativeInfinity | Float | NotImplementedType | Expr | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown]] | tuple[ComplexInfinity | NaN | Rational | Zero | Infinity | NegativeInfinity | Float | NotImplementedType | Expr | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown], list[tuple[Unknown, Unknown]] | list[Unknown]]" cannot be assigned to target tuple
- Type "tuple[ComplexInfinity | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown], list[tuple[Unknown, Unknown]] | list[Unknown]]" is incompatible with target tuple
+ Type "tuple[ComplexInfinity | NaN | Rational | Zero | Infinity | NegativeInfinity | Float | NotImplementedType | Expr | Unknown | Any, list[tuple[Unknown, Unknown]] | list[Unknown], list[tuple[Unknown, Unknown]] | list[Unknown]]" is incompatible with target tuple
- .../projects/sympy/sympy/solvers/ode/single.py:2375:23 - error: Argument of type "dict[str, Equality | BooleanFalse | BooleanTrue | bool | list[Unknown]]" cannot be assigned to parameter "m" of type "Iterable[tuple[int, Unknown | One | NegativeOne | Zero | Integer | Expr]]" in function "update"
+ .../projects/sympy/sympy/solvers/ode/single.py:2375:23 - error: Argument of type "dict[str, Equality | BooleanFalse | BooleanTrue | bool | list[Unknown]]" cannot be assigned to parameter "m" of type "Iterable[tuple[int, Unknown | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Expr]]" in function "update"
- "Literal['list']" is not assignable to "tuple[int, Unknown | One | NegativeOne | Zero | Integer | Expr]"
+ "Literal['list']" is not assignable to "tuple[int, Unknown | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Expr]"
- "Literal['sol']" is not assignable to "tuple[int, Unknown | One | NegativeOne | Zero | Integer | Expr]"
+ "Literal['sol']" is not assignable to "tuple[int, Unknown | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Expr]"
- "Literal['simpliy_flag']" is not assignable to "tuple[int, Unknown | One | NegativeOne | Zero | Integer | Expr]" (reportArgumentType)
+ "Literal['simpliy_flag']" is not assignable to "tuple[int, Unknown | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Expr]" (reportArgumentType)
- .../projects/sympy/sympy/solvers/ode/single.py:2646:27 - error: Argument of type "One | NegativeOne | Zero | Integer | Unknown | Rational | Number | Expr | NaN | NegativeInfinity | int" cannot be assigned to parameter "stop" of type "SupportsIndex" in function "__new__"
+ .../projects/sympy/sympy/solvers/ode/single.py:2646:27 - error: Argument of type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr | Unknown | int" cannot be assigned to parameter "stop" of type "SupportsIndex" in function "__new__"
- Type "One | NegativeOne | Zero | Integer | Unknown | Rational | Number | Expr | NaN | NegativeInfinity | int" is not assignable to type "SupportsIndex"
+ Type "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Expr | Unknown | int" is not assignable to type "SupportsIndex"
+ .../projects/sympy/sympy/solvers/recurr.py:249:33 - error: Operator "*" not supported for types "One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | NotImplementedType | Expr" and "Basic | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Expr | Unknown"
+ Operator "*" not supported for types "ComplexInfinity" and "Basic"
+ Operator "*" not supported for types "Expr" and "Basic" (reportOperatorIssue)
- .../projects/sympy/sympy/solvers/recurr.py:240:17 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/solvers/recurr.py:240:17 - error: Argument of type "ComplexInfinity | Unknown" cannot be assigned to parameter "value" of type "One" in function "__setitem__"
- Type "ComplexInfinity | Unknown" is not assignable to type "One"
- "ComplexInfinity" is not assignable to "One" (reportArgumentType)
- .../projects/sympy/sympy/solvers/recurr.py:313:18 - error: Operator "+" not supported for types "Expr" and "Basic | One | NegativeOne | Zero | Integer | Unknown | Expr"
+ .../projects/sympy/sympy/solvers/recurr.py:313:18 - error: Operator "+" not supported for types "Expr" and "Basic | One | NegativeOne | Zero | Integer | NaN | ComplexInfinity | Rational | Expr | Unknown"
- .../projects/sympy/sympy/solvers/recurr.py:442:23 - error: Argument of type "Unknown | Basic" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
+ .../projects/sympy/sympy/solvers/recurr.py:442:23 - error: Argument of type "Unknown | Basic | Any" cannot be assigned to parameter "args" of type "Expr | complex" in function "__new__"
- Type "Unknown | Basic" is not assignable to type "Expr | complex"
+ Type "Unknown | Basic | Any" is not assignable to type "Expr | complex"
- .../projects/sympy/sympy/solvers/recurr.py:453:13 - error: No overloads for "__setitem__" match the provided arguments (reportCallIssue)
- .../projects/sympy/sympy/solvers/recurr.py:453:13 - error: Argument of type "One | NegativeOne | Zero | Integer | Unknown" cannot be assigned to parameter "value" of type "Zero" in function "__setitem__"
- Type "One | NegativeOne | Zero | Integer | Unknown" is not assignable to type "Zero"
- "Integer" is not assignable to "Zero" (reportArgumentType)
- .../projects/sympy/sympy/solvers/solvers.py:3281:19 - error: Operator "/" not supported for types "Literal[1]" and "Unknown | Zero | Float | NotImplementedType | float | Any | NaN | Infinity | NegativeInfinity | Expr | Basic"
+ .../projects/sympy/sympy/solvers/solvers.py:3281:19 - error: Operator "/" not supported for types "Literal[1]" and "Unknown | Zero | Float | NotImplementedType | float | Any | NaN | ComplexInfinity | Rational | Infinity | NegativeInfinity | Expr | Basic"
+ .../projects/sympy/sympy/solvers/solveset.py:987:43 - error: Cannot access attribute "p" for class "NaN"
+ Attribute "p" is unknown (reportAttributeAccessIssue)
+ .../projects/sympy/sympy/solvers/solveset.py:987:43 - error: Cannot access attribute "p" for class "ComplexInfinity"
+ Attribute "p" is unknown (reportAttributeAccessIssue)
... (truncated 1333 lines) ...
spark (https://github.com/apache/spark)
+ .../projects/spark/python/pyspark/pandas/tests/computation/test_corr.py:153:52 - error: Argument of type "str" cannot be assigned to parameter "method" of type "Literal['pearson', 'kendall', 'spearman']" in function "corr"
+ Type "str" is not assignable to type "Literal['pearson', 'kendall', 'spearman']"
+ "str" is not assignable to type "Literal['pearson']"
+ "str" is not assignable to type "Literal['kendall']"
+ "str" is not assignable to type "Literal['spearman']" (reportArgumentType)
+ .../projects/spark/python/pyspark/pandas/tests/computation/test_corr.py:184:56 - error: Argument of type "str" cannot be assigned to parameter "method" of type "Literal['pearson', 'kendall', 'spearman']" in function "corr"
+ Type "str" is not assignable to type "Literal['pearson', 'kendall', 'spearman']"
+ "str" is not assignable to type "Literal['pearson']"
+ "str" is not assignable to type "Literal['kendall']"
+ "str" is not assignable to type "Literal['spearman']" (reportArgumentType)
+ .../projects/spark/python/pyspark/pandas/tests/indexes/test_indexing.py:194:75 - error: Argument of type "Series[Any]" cannot be assigned to parameter "other" of type "str | bytes | date | datetime | timedelta | datetime64[date | int | None] | timedelta64[timedelta | int | None] | bool | int | float | Timestamp | Timedelta | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | DataFrame | ((...) -> (str | bytes | date | datetime | timedelta | datetime64[date | int | None] | timedelta64[timedelta | int | None] | bool | int | float | Timestamp | Timedelta | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | DataFrame)) | None" in function "where"
+ Type "Series[Any]" is not assignable to type "str | bytes | date | datetime | timedelta | datetime64[date | int | None] | timedelta64[timedelta | int | None] | bool | int | float | Timestamp | Timedelta | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | DataFrame | ((...) -> (str | bytes | date | datetime | timedelta | datetime64[date | int | None] | timedelta64[timedelta | int | None] | bool | int | float | Timestamp | Timedelta | complex | integer[Any] | floating[Any] | complexfloating[Any, Any] | DataFrame)) | None"
+ "Series[Any]" is not assignable to "str"
+ "Series[Any]" is not assignable to "bytes"
+ "Series[Any]" is not assignable to "date"
+ "Series[Any]" is not assignable to "datetime"
+ "Series[Any]" is not assignable to "timedelta"
+ "Series[Any]" is not assignable to "datetime64[date | int | None]"
+ "Series[Any]" is not assignable to "timedelta64[timedelta | int | None]"
+ ... (reportArgumentType)
- .../projects/spark/python/pyspark/pandas/tests/series/test_datetime.py:56:20 - error: Operator "//" not supported for types "Series[Any]" and "timedelta64[timedelta]" (reportOperatorIssue)
- .../projects/spark/python/pyspark/pandas/tests/series/test_datetime.py:168:17 - error: Operator "/" not supported for types "Series[Any]" and "timedelta64[timedelta]" (reportOperatorIssue)
+ .../projects/spark/python/pyspark/sql/tests/pandas/helper/helper_pandas_transform_with_state.py:2550:43 - error: Argument of type "Series[Any] | Any" cannot be assigned to parameter "expiryTimestampMs" of type "int" in function "registerTimer"
+ Type "Series[Any] | Any" is not assignable to type "int"
+ "Series[Any]" is not assignable to "int" (reportArgumentType)
+ .../projects/spark/python/pyspark/sql/tests/test_udf_in_higher_order_function.py:786:23 - error: No overloads for "transform" match the provided arguments (reportCallIssue)
+ .../projects/spark/python/pyspark/sql/tests/test_udf_in_higher_order_function.py:786:46 - error: Argument of type "(x: Column) -> Series[Any]" cannot be assigned to parameter "f" of type "(Column, Column) -> Column" in function "transform"
+ Type "(x: Column) -> Series[Any]" is not assignable to type "(Column, Column) -> Column"
+ Function accepts too few positional parameters; expected 2 but received 1
+ Function return type "Series[Any]" is incompatible with type "Column"
+ "Series[Any]" is not assignable to "Column" (reportArgumentType)
- 34953 errors, 981 warnings, 0 informations
+ 34957 errors, 981 warnings, 0 informations
pandas-stubs (https://github.com/pandas-dev/pandas-stubs)
- .../projects/pandas-stubs/tests/indexes/test_add.py
- .../projects/pandas-stubs/tests/indexes/test_add.py:28:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:29:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:30:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:33:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:34:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:35:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:43:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:44:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:45:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:48:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:49:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:50:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:106:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_add.py:108:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
+ .../projects/pandas-stubs/tests/indexes/test_floordiv.py:39:71 - error: Unnecessary "# pyright: ignore" rule: "reportOperatorIssue" (reportUnnecessaryTypeIgnoreComment)
+ .../projects/pandas-stubs/tests/indexes/test_floordiv.py:39:91 - error: Unnecessary "# pyright: ignore" rule: "reportUnknownVariableType" (reportUnnecessaryTypeIgnoreComment)
- .../projects/pandas-stubs/tests/indexes/test_floordiv.py:137:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
+ .../projects/pandas-stubs/tests/indexes/test_floordiv.py:47:23 - error: "assert_type" mismatch: expected "TimedeltaIndex" but received "Any" (reportAssertTypeFailure)
+ .../projects/pandas-stubs/tests/indexes/test_floordiv.py:62:71 - error: Unnecessary "# pyright: ignore" rule: "reportOperatorIssue" (reportUnnecessaryTypeIgnoreComment)
+ .../projects/pandas-stubs/tests/indexes/test_floordiv.py:62:91 - error: Unnecessary "# pyright: ignore" rule: "reportUnknownVariableType" (reportUnnecessaryTypeIgnoreComment)
- .../projects/pandas-stubs/tests/indexes/test_mul.py
- .../projects/pandas-stubs/tests/indexes/test_mul.py:28:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:29:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:30:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:33:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:34:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:35:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:43:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:44:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:45:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:48:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:49:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:50:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:106:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_mul.py:108:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_sub.py
- .../projects/pandas-stubs/tests/indexes/test_sub.py:60:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_sub.py:105:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/indexes/test_truediv.py:106:23 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/scalars/test_scalars.py:1728:21 - error: "assert_type" mismatch: expected "Index[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py
- .../projects/pandas-stubs/tests/series/test_add.py:26:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:27:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:28:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:31:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:32:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:33:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:36:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:37:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:38:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:41:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:42:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:43:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:57:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:58:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:59:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:63:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:64:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:65:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:69:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:70:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
- .../projects/pandas-stubs/tests/series/test_add.py:71:23 - error: "assert_type" mismatch: expected "Series[Any]" but received "Any" (reportAssertTypeFailure)
... (truncated 195 lines) ...
|
…11739) * Revert nested overload materialization and dependent checker fixes Selectively roll back #11601, #11621, and checker-only #11732 while preserving primer-analysis tooling and independent subsequent fixes. Retain regression fixtures and document the restored conformance, constructor, and protocol-operation limitations in current-behavior expectations. Co-authored-by: Copilot App <[email protected]> * Restore matching gh-aw compiler and runtime for primer analysis Regenerate with v0.86.2, preserve current artifact action versions, and prevent standalone runtime bumps with a narrow Dependabot ignore and workflow consistency coverage. Co-authored-by: Copilot App <[email protected]> * Preserve constructor constraints and results across union branches Replay each expanded argument using its own overload constraints and retain definitive constructed union branches. Fix the reproduced Werkzeug Mapping-to-dict regression without restoring nested overload materialization, and retain precise positive and negative regression coverage. Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Copilot App <[email protected]>
Summary
Addresses #11731. Fixes the reported shared-container regression and the related Spark timedelta-operation regression. Also adds advisory explanations of mypy_primer differences for future PRs. The broader historical pandas-stubs differences are not all resolved.
AnyorUnknownmakes overload resolution ambiguous, including specializedselfparameters and inferred constructors.Container[Any].copy()retains its container type and nonexistent-member diagnostics.(Timestamp - Series[Any]) // np.timedelta64(...) - 1now resolves toSeries[int]instead of reporting an unsupported operation.Precision rationale
Classification B: Pyright inference limitation; no typeshed changes.
python/typing#2350 permits more precise gradual overload results that satisfy both assignability and supported-operation requirements. The container merge recursively retains compatible generic arguments and tuple shapes, and verifies assignability to every retained return type. Unsupported shapes, differing non-invariant arguments, incompatible nominal families, and mixtures with
Neverretain conservative fallbacks.The Spark follow-up is intentionally limited to protocol-annotated method binding. An experimental broader change affected existing precise expectations and was discarded. Existing Pyright expectations remain unchanged by the Spark follow-up; no assertions or diagnostic expectations were weakened to hide failures.
Reviewed precision changes in pandas-stubs
On unchanged pandas-stubs commit
507243e3c1c1f0a6d92b5c409684fd691e2d6980, the Spark correction introduces these four assertion differences relative to the initial container fix:tests/series/test_floordiv.pySeries[Timedelta]Series[Any]tests/indexes/test_floordiv.pyTimedeltaIndexAnyThese receivers are annotated with
Any. Dividing a timedelta by a numeric container can produce timedeltas, whereas dividing it by a timedelta container can produce integers. Recognizing the additional valid specialization makes the old timedelta-only result unjustified. The Series alternatives retain their common container; the Index alternatives have different nominal families and use the conservativeAnyfallback. Concrete numeric receivers retain their precise timedelta results.These changes were explicitly reviewed and accepted. The mitigation is a narrowly scoped inference change, correlated-return and mixed-overload regression coverage, and this explicit compatibility report; the external expectations were not rewritten. Another 24 ignore directives become unnecessary because the newly supported operations on gradual receivers no longer produce their former errors.
The complete local 356-file corpus comparison is:
The final increase of 28 relative to the initial fix is exactly the four reviewed assertion changes and 24 unnecessary-ignore diagnostics. Other diagnostic-category counts are unchanged. Totals include unrelated dependency/environment diagnostics and are not a count of checker regressions.
Remaining historical differences
The original 19 assertion differences remain. All 19 passed in 1.1.411 and already failed in 1.1.412. Restoring those old types is not necessarily valid under the current overload specification, particularly for candidates with incompatible nominal families or mixtures involving
Never; this PR does not resolve that broader work.The other six Spark diagnostics previously investigated exposed existing literal-argument, stub, narrowing, or decorator-inference limitations rather than the timedelta operation-preservation defect. This PR does not claim to eliminate all Spark or SymPy differences. The new CI primer run must be reviewed independently; historical comparisons do not establish that every new diagnostic is expected.
Advisory mypy_primer workflow
The existing trusted raw-comment workflow hands off the upstream run identity. Deterministic preparation validates the run, attempt, complete eight-shard inventory, PR association, and current head, then counts diagnostic records for every changed project. Copilot reads the evidence with no shell, editing tools, or PR checkout. A separate publisher requires successful threat detection, validates project coverage, rechecks the head, and posts an explanatory table plus a complete report artifact.
The report distinguishes expected improvements, exposed typing limitations, possible regressions, and cases needing human review. It does not approve PRs, change labels, merge changes, or fail CI merely because diagnostics differ. The existing raw comment is preserved.
Activation requires merging the workflow into
mainand repository access to organization-billed Copilot inference. It will not automatically analyze this PR before landing. Limits are 25 AI credits, 30 turns, and 15 minutes. Seedocs/mypy-primer-analysis.mdfor maintenance, provenance limits, and the guarded staged-publication path.Validation
typeEvaluator6,typeUtils, andmypyPrimerAnalysissuites: 184 passing cases.Series[int]; the deliberately invalid concrete timestamp-division case remains rejected.gh awv0.86.2. Trusted staged activation handling was exercised; the checked-in lock is production/non-staged.git diff --check.