Skip to content

Preserve bound receivers during contextual return inference - #11953

Merged
Rich Chiodo (rchiodo) merged 6 commits into
microsoft:mainfrom
rchiodo:rchiodo-contextual-receiver-binding
Nov 4, 2026
Merged

Rich Chiodo (rchiodo) merged 6 commits into
microsoft:mainfrom
rchiodo:rchiodo-contextual-receiver-binding

Conversation

@rchiodo

@rchiodo Rich Chiodo (rchiodo) commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

Contextual return inference can lose the actual receiver of an inherited bound method:

class Base:
    def pick(self, argument):
        if argument:
            return self
        return argument

class Derived(Base):
    def derived_only(self) -> int:
        return 42

def demonstrate(value: Derived):
    selected = value.pick(1)
    reveal_type(selected)  # Before: Self@Base. After: Derived.
    selected.derived_only()  # Previously a false missing-member error.

This predates the reflected-operator work in microsoft/pyright#11662. The change is independent of operator dispatch: it neither changes reflected-method precedence nor filters legitimate NotImplemented alternatives.

Approach

Replace the broader receiver-metadata/cache implementation with result specialization: reapply the bound receiver at the end of _getInferredReturnTypeResult, after contextual inference or its fallback.

  • Require the receiver to derive from the method owner. A synthetic property's __get__ can retain the original getter's methodClass while binding to the property descriptor; that descriptor must not replace the getter's Self.
  • If the receiver is a class-bound expansion of synthesized Self, recover the original Self type variable from its condition rather than materializing its class bound. This preserves inherited forwarding, including further-derived and generic receivers.
  • Preserve ordinary bounded/constrained receiver correlations and leave static-method behavior unchanged.

The production diff is 23 added lines in typeEvaluator.ts. No receiver metadata, speculative-cache isolation, inferred-return freshness change, constructor recovery, or inference retry is introduced. Supporting changes from the earlier implementation are removed; the newer upstream base and remote history are preserved.

Coverage

Focused samples cover distinct and repeated receivers, receiver unions, generic int/str receivers, inherited factory forwarding, further-derived forwarding, classmethods, unknown-argument fallbacks, unbound calls, concrete/declared returns, static methods, recursive properties, constrained/bounded TypeVars, and direct __pow__ retaining NotImplemented.

Local validation on the updated PR tree: all 425 tests in the complete typeEvaluator4, typeEvaluator8, and typeUtils suites pass, as do the core build, changed-file ESLint/Prettier, and whitespace checks. Existing upstream expectations are unchanged.

Ecosystem comparison

The full pinned mypy_primer rerun compared the verified minimal implementation with cd578624fcba7afa372a9628ac94945bc435d26d, using the same project revisions, environments, production builds, and Node heap setting:

Project Baseline errors Original 10-line candidate Repaired candidate
SymPy 38,735 38,876 38,523
Spack 2,737 2,739 2,737

All 147 projects were attempted; 146 yielded valid comparisons. Materialize retains its pre-existing incomplete Windows-checkout exclusion. Every repeated baseline diagnostic multiset reproduced exactly.

There are 139 baseline-identical projects and the same five previously reviewed display-only project differences, with unchanged diagnostic sites and multiplicities. All 144 valid projects outside SymPy/Spack have exactly the same complete diagnostics as the 10-line run. No additional projects are affected. Aggregate impact versus baseline is 212 fewer errors; warnings/information are unchanged.

SymPy is not zero-diff: 27 new sites and 178 removed sites remain. Receiver-loss regressions in Add/Mul forwarding and the redundant root-type alternatives are repaired, but downstream dictionary/property models and constructor unions still produce differences. Diagnostic removals are not automatically treated as precision improvements.

These are pinned older-baseline ecosystem results, not a new full-corpus run against the newer upstream base now used by this PR. No performance claim is made. Broader virtual-property dispatch, generic member-return inference, and sklearn-style fit_transform inference are not claimed solved.

@heejaechang

Copy link
Copy Markdown
Collaborator

🔒 Automated review in progress — Heejae Chang (@heejaechang) is auto-reviewing this PR.

@bschnurr

Bill Schnurr (bschnurr) commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

🔒 Automated review in progress — Bill Schnurr (@bschnurr) is auto-reviewing this PR.

@bschnurr

Copy link
Copy Markdown
Member

Result: 🔴 could-not-verify

Verification details

Verification: Automated verification is best effort. The PR author remains responsible for testing.

Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "2e254667b0a30855b83d1e2a3518c94802b3a6204c681c99868131e484df69f1": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found

Test runs: none recorded.

@bschnurr Bill Schnurr (bschnurr) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved via Review Center.

@bschnurr Bill Schnurr (bschnurr) added the review-auto:approved Automated review: no blocking findings (approval posted). label Oct 30, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@heejaechang

Heejae Chang (heejaechang) commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

🔴 Pyright CLI QA — d6e7d4d1 — verdict: red

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

Needs review: Diagnostics changed for this example

The base and PR report different diagnostics for the same example. Is this change intended?

Reproduction and observed results

Create these files in an empty directory:

classmethod.py

from typing import TypeVar
reveal_type(0)
class Base:
    @classmethod
    def make(cls, flag):
        if flag:
            return cls()
        return flag
class Middle(Base):
    @classmethod
    def forward(cls, flag):
        return super().make(flag)
class Derived(Middle):
    pass
T = TypeVar("T", bound=Derived)
def preserve(cls: type[T]) -> T:
    return cls.forward(1)

control.py

from typing import Self, TypeVar
reveal_type(0)
class Base:
    def pick(self, flag):
        if flag:
            return self
        return flag
class Middle(Base):
    def typed_forward(self, flag: int) -> Self:
        return self
class Derived(Middle):
    pass
T = TypeVar("T", bound=Derived)
def preserve(value: T) -> T:
    return value.pick(1)
def typed(value: T) -> T:
    return value.typed_forward(1)

explicit.py

from typing import TypeVar
reveal_type(0)
class Base:
    def pick(self, flag):
        if flag:
            return self
        return flag
class Middle(Base):
    def forward(self, flag):
        return super(Middle, self).pick(flag)
class Derived(Middle):
    pass
T = TypeVar("T", bound=Derived)
def preserve(value: T) -> T:
    return value.forward(1)

main.py

from typing import TypeVar
reveal_type(0)
class Base:
    def pick(self, flag):
        if flag:
            return self
        return flag
class Middle(Base):
    def forward(self, flag):
        return super().pick(flag)
class Derived(Middle):
    pass
T = TypeVar("T", bound=Derived)
def preserve(value: T) -> T:
    return value.forward(1)

pyrightconfig.json

{"include": ["main.py", "explicit.py", "control.py", "super_constrained.py", "classmethod.py"], "pythonVersion": "3.11", "typeCheckingMode": "basic"}

super_constrained.py

from typing import TypeVar
reveal_type(0)
class Base:
    def pick(self, flag):
        if flag:
            return self
        return flag
class Middle(Base):
    def forward(self, flag):
        return super().pick(flag)
class Derived(Middle):
    pass
class Other(Middle):
    pass
T = TypeVar("T", Derived, Other)
def preserve(value: T) -> T:
    return value.forward(1)

From that directory, run each built Pyright revision:

node <pyright-cli-entrypoint> --outputjson -p .

Base 74743ab17950a6bd205935e21808102a610d40a1

{
  "exit_code": 1,
  "diagnostics": [
    {
      "file": "classmethod.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    },
    {
      "file": "control.py",
      "severity": "error",
      "rule": "reportReturnType",
      "message": "Type \"Self@Base\" is not assignable to return type \"T@preserve\"\n  Type \"Self@Base\" is not assignable to type \"T@preserve\"",
      "range": {
        "start": [
          14,
          11
        ],
        "end": [
          14,
          24
        ]
      }
    },
    {
      "file": "control.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    },
    {
      "file": "explicit.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    },
    {
      "file": "main.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    },
    {
      "file": "super_constrained.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    }
  ]
}

PR d6e7d4d110ebd18f390ca30b85b10d2442ff953f

{
  "exit_code": 1,
  "diagnostics": [
    {
      "file": "classmethod.py",
      "severity": "error",
      "rule": "reportReturnType",
      "message": "Type \"Base | Unknown\" is not assignable to return type \"T@preserve\"\n  Type \"Base | Unknown\" is not assignable to type \"T@preserve\"",
      "range": {
        "start": [
          16,
          11
        ],
        "end": [
          16,
          25
        ]
      }
    },
    {
      "file": "classmethod.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    },
    {
      "file": "control.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    },
    {
      "file": "explicit.py",
      "severity": "error",
      "rule": "reportReturnType",
      "message": "Type \"Base | Unknown\" is not assignable to return type \"T@preserve\"\n  Type \"Base | Unknown\" is not assignable to type \"T@preserve\"",
      "range": {
        "start": [
          14,
          11
        ],
        "end": [
          14,
          27
        ]
      }
    },
    {
      "file": "explicit.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    },
    {
      "file": "main.py",
      "severity": "error",
      "rule": "reportReturnType",
      "message": "Type \"Base | Unknown\" is not assignable to return type \"T@preserve\"\n  Type \"Base | Unknown\" is not assignable to type \"T@preserve\"",
      "range": {
        "start": [
          14,
          11
        ],
        "end": [
          14,
          27
        ]
      }
    },
    {
      "file": "main.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    },
    {
      "file": "super_constrained.py",
      "severity": "error",
      "rule": "reportReturnType",
      "message": "Type \"Base* | Unknown\" is not assignable to return type \"T@preserve\"\n  Type \"Base* | Unknown\" is not assignable to type \"T@preserve\"",
      "range": {
        "start": [
          16,
          11
        ],
        "end": [
          16,
          27
        ]
      }
    },
    {
      "file": "super_constrained.py",
      "severity": "information",
      "rule": null,
      "message": "Type of \"0\" is \"Literal[0]\"",
      "range": {
        "start": [
          1,
          12
        ],
        "end": [
          1,
          13
        ]
      }
    }
  ]
}

Diagnostic ranges use zero-based line and character positions.

@rchiodo

Copy link
Copy Markdown
Collaborator Author

Fixed — In response to this feedback:

Union member access now retains bound functions whose boundSelfType values differ, so call-site return inference evaluates both receiver alternatives instead of deduplicating the second branch. Added end-to-end and union-deduplication coverage in commit 3f657ea.

Rich Chiodo (rchiodo) and others added 2 commits October 30, 2026 19:32
Keep contextual speculative caches isolated, preserve return specialization without freezing inferred Unknown, and recover unsolved constructor type variables. Add receiver, forwarding, cache-isolation, and freshness regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rchiodo
Rich Chiodo (rchiodo) force-pushed the rchiodo-contextual-receiver-binding branch from 3f657ea to 5c701be Compare October 31, 2026 02:34
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@bschnurr

Copy link
Copy Markdown
Member

Result: 🔴 could-not-verify

Verification details

Verification: Automated verification is best effort. The PR author remains responsible for testing.

Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "d13618545599ed6b20dd1691143a823d8defd97e85a6e092ea0bcbaf10930629": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found

Test runs: none recorded.

Replace the broader receiver metadata, cache, freshness, and constructor changes with post-inference receiver specialization. Preserve the owner-MRO guard and conditional synthesized Self, and cover receiver unions without discarding alternatives.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@bschnurr

Copy link
Copy Markdown
Member

Result: 🔴 could-not-verify

Verification details

Verification: Automated verification is best effort. The PR author remains responsible for testing.

Summary: [unavailable] Container verification could not start and local execution was not authorized for this PR HEAD: C:\Program Files\RedHat\Podman\podman.EXE --connection pyrx-automation failed: stderr: Error: unable to start container "4f703cc5061d7f1e691154e7b1a59d47cf395c5c71384291c0b82ff9f84b7780": crun: open `memory.max` for writing: No such file or directory: OCI runtime attempted to invoke a command that was not found

Test runs: none recorded.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Rich Chiodo (rchiodo) and others added 2 commits November 4, 2026 09:46
Capture arguments in the caller context and isolate speculative results during contextual body inference. Preserve borrowed bound type variables and resolve constructor-owned variables during recovery, with regression coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Compare each remaining source subtype with the destination TypeVar after filtering Any and Unknown. TypeForm metadata can preserve duplicate equivalent arms, so comparing the entire union incorrectly rejected caller-bound variables.

Classification: B (Pyright limitation). Preserve TypeForm metadata and type precision; add failing-before cofactor coverage and native equality controls for assignment flags, gradual types, and incompatible neighbors. No typeshed change.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Nov 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/backends/impala/tests/conftest.py:134:25 - error: No overloads for "__init__" match the provided arguments (reportCallIssue)
-   .../projects/ibis/ibis/backends/impala/tests/conftest.py:134:30 - error: Argument of type "zip[Unknown]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__"
-     "zip[Unknown]" is incompatible with protocol "Iterable[list[bytes]]"
-       "__iter__" is an incompatible type
-         Type "() -> zip[Unknown]" is not assignable to type "() -> Iterator[_T_co@Iterable]"
-           Function return type "zip[Unknown]" is incompatible with type "Iterator[_T_co@Iterable]"
-             "zip[Unknown]" is incompatible with protocol "Iterator[_T_co@Iterable]" (reportArgumentType)
-   .../projects/ibis/ibis/backends/trino/tests/conftest.py:152:13 - error: No overloads for "__init__" match the provided arguments (reportCallIssue)
-   .../projects/ibis/ibis/backends/trino/tests/conftest.py:152:18 - error: Argument of type "zip[Unknown]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__"
-     "zip[Unknown]" is incompatible with protocol "Iterable[list[bytes]]"
-       "__iter__" is an incompatible type
-         Type "() -> zip[Unknown]" is not assignable to type "() -> Iterator[_T_co@Iterable]"
-           Function return type "zip[Unknown]" is incompatible with type "Iterator[_T_co@Iterable]"
-             "zip[Unknown]" is incompatible with protocol "Iterator[_T_co@Iterable]" (reportArgumentType)
-   .../projects/ibis/ibis/common/graph.py:721:26 - error: Argument of type "reversed[Unknown]" cannot be assigned to parameter "iterable" of type "Iterable[Node]" in function "extend"
-     "reversed[Unknown]" is incompatible with protocol "Iterable[Node]"
-       "__iter__" is an incompatible type
-         Type "() -> reversed[Unknown]" is not assignable to type "() -> Iterator[_T_co@Iterable]"
-           Function return type "reversed[Unknown]" is incompatible with type "Iterator[_T_co@Iterable]"
-             "reversed[Unknown]" is incompatible with protocol "Iterator[_T_co@Iterable]" (reportArgumentType)
-   .../projects/ibis/ibis/expr/api.py:265:35 - error: Argument of type "zip[Unknown]" cannot be assigned to parameter "values" of type "Iterable[tuple[str, str | DataType]]" in function "from_tuples"
-     "zip[Unknown]" is incompatible with protocol "Iterable[tuple[str, str | DataType]]"
-       "__iter__" is an incompatible type
-         Type "() -> zip[Unknown]" is not assignable to type "() -> Iterator[_T_co@Iterable]"
-           Function return type "zip[Unknown]" is incompatible with type "Iterator[_T_co@Iterable]"
-             "zip[Unknown]" is incompatible with protocol "Iterator[_T_co@Iterable]" (reportArgumentType)
-   .../projects/ibis/ibis/legacy/udf/vectorized.py:38:12 - error: No overloads for "__init__" match the provided arguments (reportCallIssue)
-   .../projects/ibis/ibis/legacy/udf/vectorized.py:38:12 - error: Type "dict[bytes, bytes]" is not assignable to return type "tuple[Unknown, ...]"
+   .../projects/ibis/ibis/legacy/udf/vectorized.py:38:12 - error: Type "dict[Unknown, Unknown]" is not assignable to return type "tuple[Unknown, ...]"
-     "dict[bytes, bytes]" is not assignable to "tuple[Unknown, ...]" (reportReturnType)
+     "dict[Unknown, Unknown]" is not assignable to "tuple[Unknown, ...]" (reportReturnType)
-   .../projects/ibis/ibis/legacy/udf/vectorized.py:38:17 - error: Argument of type "zip[Unknown]" cannot be assigned to parameter "iterable" of type "Iterable[list[bytes]]" in function "__init__"
-     "zip[Unknown]" is incompatible with protocol "Iterable[list[bytes]]"
-       "__iter__" is an incompatible type
-         Type "() -> zip[Unknown]" is not assignable to type "() -> Iterator[_T_co@Iterable]"
-           Function return type "zip[Unknown]" is incompatible with type "Iterator[_T_co@Iterable]"
-             "zip[Unknown]" is incompatible with protocol "Iterator[_T_co@Iterable]" (reportArgumentType)
- 7244 errors, 247 warnings, 0 informations
+ 7236 errors, 247 warnings, 0 informations

openlibrary (https://github.com/internetarchive/openlibrary)
-   .../projects/openlibrary/openlibrary/accounts/__init__.py:55:52 - error: Object of type "None" cannot be called (reportOptionalCall)
-   .../projects/openlibrary/openlibrary/accounts/__init__.py:63:35 - error: Argument of type "Nothing | Any | Unknown | None" cannot be assigned to parameter "token" of type "str | None" in function "_set_conn_auth_token"
+   .../projects/openlibrary/openlibrary/accounts/__init__.py:63:35 - error: Argument of type "Any | Unknown | Nothing | None" cannot be assigned to parameter "token" of type "str | None" in function "_set_conn_auth_token"
-     Type "Nothing | Any | Unknown | None" is not assignable to type "str | None"
+     Type "Any | Unknown | Nothing | None" is not assignable to type "str | None"
-   .../projects/openlibrary/openlibrary/book_providers.py:231:16 - error: Type "Any | Unknown | list[Unknown] | None" is not assignable to return type "list[str]"
-     Type "Any | Unknown | list[Unknown] | None" is not assignable to type "list[str]"
-       "None" is not assignable to "list[str]" (reportReturnType)
-   .../projects/openlibrary/openlibrary/book_providers.py:233:47 - error: "get" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/openlibrary/openlibrary/book_providers.py:343:21 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/openlibrary/openlibrary/book_providers.py:347:21 - error: Type "list[Unknown | Nothing | None]" is not assignable to return type "list[str]"
+   .../projects/openlibrary/openlibrary/book_providers.py:347:21 - error: Type "list[Unknown | Nothing]" is not assignable to return type "list[str]"
-     Type "Unknown | Nothing | None" is not assignable to type "str"
+     Type "Unknown | Nothing" is not assignable to type "str"
-   .../projects/openlibrary/openlibrary/book_providers.py:350:16 - error: Type "Unknown | list[Unknown] | None" is not assignable to return type "list[str]"
-     Type "Unknown | list[Unknown] | None" is not assignable to type "list[str]"
-       "None" is not assignable to "list[str]" (reportReturnType)
-   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:808:59 - error: Cannot access attribute "split" for class "list[Unknown | list[Unknown] | Any]"
+   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:808:59 - error: Cannot access attribute "split" for class "list[Unknown | list[Unknown | list[Unknown]]]"
-   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:1037:27 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:1067:33 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:1197:14 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
-   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:1199:16 - error: Operator "in" not supported for types "Any | Unknown | None" and "Any | Unknown | Nothing | None"
-     Operator "in" not supported for types "None" and "None" (reportOperatorIssue)
-   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:1200:42 - error: "remove" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:1203:42 - error: "append" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/openlibrary/openlibrary/catalog/add_book/__init__.py:1206:16 - error: Object of type "None" is not subscriptable (reportOptionalSubscript)
-   .../projects/openlibrary/openlibrary/catalog/add_book/load_book.py:107:24 - error: "key" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/openlibrary/openlibrary/catalog/add_book/load_book.py:222:30 - error: "key" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/openlibrary/openlibrary/catalog/utils/__init__.py:115:44 - error: Argument of type "Unknown | Nothing | None" cannot be assigned to parameter "prefix" of type "str | tuple[str, ...]" in function "startswith"
+   .../projects/openlibrary/openlibrary/catalog/utils/__init__.py:115:44 - error: Argument of type "Unknown | Nothing" cannot be assigned to parameter "prefix" of type "str | tuple[str, ...]" in function "startswith"
-     Type "Unknown | Nothing | None" is not assignable to type "str | tuple[str, ...]"
+     Type "Unknown | Nothing" is not assignable to type "str | tuple[str, ...]"
-   .../projects/openlibrary/openlibrary/catalog/utils/__init__.py:115:58 - error: "startswith" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/openlibrary/openlibrary/catalog/utils/__init__.py:118:39 - error: Argument of type "Unknown | Nothing | None" cannot be assigned to parameter "date" of type "str" in function "full_date_parts"
+   .../projects/openlibrary/openlibrary/catalog/utils/__init__.py:118:39 - error: Argument of type "Unknown | Nothing" cannot be assigned to parameter "date" of type "str" in function "full_date_parts"
-     Type "Unknown | Nothing | None" is not assignable to type "str"
+     Type "Unknown | Nothing" is not assignable to type "str"
-   .../projects/openlibrary/openlibrary/catalog/utils/__init__.py:126:29 - error: Argument of type "Unknown | Nothing | None" cannot be assigned to parameter "string" of type "str" in function "search"
+   .../projects/openlibrary/openlibrary/catalog/utils/__init__.py:126:29 - error: Argument of type "Unknown | Nothing" cannot be assigned to parameter "string" of type "str" in function "search"
-     Type "Unknown | Nothing | None" is not assignable to type "str"
+     Type "Unknown | Nothing" is not assignable to type "str"
-   .../projects/openlibrary/openlibrary/core/lending.py:977:36 - error: Argument of type "(item: dict[str, Unknown] | Edition) -> (Unknown | Literal[''] | None)" cannot be assigned to parameter "key" of type "(dict[str, Unknown] | Edition) -> SupportsRichComparison" in function "sort"
-     Type "(item: dict[str, Unknown] | Edition) -> (Unknown | Literal[''] | None)" is not assignable to type "(dict[str, Unknown] | Edition) -> SupportsRichComparison"
-       Function return type "Unknown | Literal[''] | None" is incompatible with type "SupportsRichComparison"
-         Type "Unknown | Literal[''] | None" is not assignable to type "SupportsRichComparison"
-           Type "None" is not assignable to type "SupportsRichComparison"
-             "None" is incompatible with protocol "SupportsDunderLT[Any]"
-             "None" is incompatible with protocol "SupportsDunderGT[Any]" (reportArgumentType)
-   .../projects/openlibrary/openlibrary/core/lists/model.py:121:75 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
-   .../projects/openlibrary/openlibrary/core/lists/model.py:191:72 - error: "key" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/openlibrary/openlibrary/core/lists/model.py:538:34 - error: "key" is not a known attribute of "None" (reportOptionalMemberAccess)
-   .../projects/openlibrary/openlibrary/core/lists/model.py:557:20 - error: Object of type "None" cannot be called (reportOptionalCall)
-   .../projects/openlibrary/openlibrary/core/models.py:137:12 - error: Operator "<" not supported for types "Any | Unknown | Nothing | None" and "Literal[5]"
+   .../projects/openlibrary/openlibrary/core/models.py:137:12 - error: Operator "<" not supported for types "Any | Unknown | Nothing" and "Literal[5]"
-     Operator "<" not supported for types "Nothing" and "Literal[5]"
-     Operator "<" not supported for types "None" and "Literal[5]" (reportOperatorIssue)
+     Operator "<" not supported for types "Nothing" and "Literal[5]" (reportOperatorIssue)
-   .../projects/openlibrary/openlibrary/core/models.py:142:63 - error: Operator "-" not supported for types "Any | Unknown | Nothing | None" and "Literal[1]"
+   .../projects/openlibrary/openlibrary/core/models.py:142:63 - error: Operator "-" not supported for types "Any | Unknown | Nothing" and "Literal[1]"
-     Operator "-" not supported for types "Nothing" and "Literal[1]" when expected type is "int"
-     Operator "-" not supported for types "None" and "Literal[1]" when expected type is "int" (reportOperatorIssue)
+     Operator "-" not supported for types "Nothing" and "Literal[1]" when expected type is "int" (reportOperatorIssue)
-   .../projects/openlibrary/openlibrary/core/models.py:315:16 - error: Object of type "None" cannot be called (reportOptionalCall)
-   .../projects/openlibrary/openlibrary/core/models.py:319:73 - error: Object of type "None" cannot be called (reportOptionalCall)
-   .../projects/openlibrary/openlibrary/core/models.py:325:38 - error: Argument of type "Nothing | Any | Unknown" cannot be assigned to parameter "collections" of type "list[str]" in function "private_collection_in"
+   .../projects/openlibrary/openlibrary/core/models.py:325:38 - error: Argument of type "Any | Unknown | Nothing" cannot be assigned to parameter "collections" of type "list[str]" in function "private_collection_in"
-     Type "Nothing | Any | Unknown" is not assignable to type "list[str]"
+     Type "Any | Unknown | Nothing" is not assignable to type "list[str]"
-   .../projects/openlibrary/openlibrary/core/models.py:355:24 - error: Object of type "None" cannot be called (reportOptionalCall)
-   .../projects/openlibrary/openlibrary/core/models.py:456:20 - error: Object of type "None" cannot be called (reportOptionalCall)
-   .../projects/openlibrary/openlibrary/core/models.py:470:106 - error: Object of type "None" cannot be used as iterable value (reportOptionalIterable)
-   .../projects/openlibrary/openlibrary/core/models.py:637:57 - error: Object of type "None" cannot be called (reportOptionalCall)

... (truncated 92 lines) ...

sympy (https://github.com/sympy/sympy)
+   .../projects/sympy/sympy/assumptions/ask.py:547:43 - error: Argument of type "Basic" cannot be assigned to parameter "assumptions" of type "bool" in function "satask"
+     "Basic" is not assignable to "bool" (reportArgumentType)
+   .../projects/sympy/sympy/assumptions/ask.py:552:51 - error: Argument of type "Basic" cannot be assigned to parameter "assumptions" of type "bool" in function "lra_satask"
+     "Basic" is not assignable to "bool" (reportArgumentType)
-   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:259:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Unknown"
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:259:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Basic | Unknown"
+     Operator "-" not supported for types "type[AppliedUndef]" and "Expr"
-     Operator "-" not supported for types "type[AppliedUndef]" and "Expr" (reportOperatorIssue)
+     Operator "-" not supported for types "type[AppliedUndef]" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:265:12 - error: Operator "-" not supported for types "Expr | Any | Basic | Unknown" and "Expr"
+     Operator "-" not supported for types "Basic" and "Expr" (reportOperatorIssue)
-   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:269:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Unknown"
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:269:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Basic | Unknown"
+     Operator "-" not supported for types "type[AppliedUndef]" and "Expr"
-     Operator "-" not supported for types "type[AppliedUndef]" and "Expr" (reportOperatorIssue)
+     Operator "-" not supported for types "type[AppliedUndef]" and "Basic" (reportOperatorIssue)
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:294:12 - error: Operator "-" not supported for types "Expr | Any | Basic | Unknown" and "Expr"
+     Operator "-" not supported for types "Basic" and "Expr" (reportOperatorIssue)
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:300:12 - error: Operator "-" not supported for types "Basic | Any | Expr | Unknown" and "Expr"
+     Operator "-" not supported for types "Basic" and "Expr" (reportOperatorIssue)
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:316:12 - error: Operator "-" not supported for types "Expr | Any | Basic | Unknown" and "Expr"
+     Operator "-" not supported for types "Basic" and "Expr" (reportOperatorIssue)
-   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:361:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Unknown"
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:361:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Basic | Unknown"
+     Operator "-" not supported for types "type[AppliedUndef]" and "Expr"
-     Operator "-" not supported for types "type[AppliedUndef]" and "Expr" (reportOperatorIssue)
+     Operator "-" not supported for types "type[AppliedUndef]" and "Basic" (reportOperatorIssue)
-   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:362:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Unknown"
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:362:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Basic | Unknown"
+     Operator "-" not supported for types "type[AppliedUndef]" and "Expr"
-     Operator "-" not supported for types "type[AppliedUndef]" and "Expr" (reportOperatorIssue)
+     Operator "-" not supported for types "type[AppliedUndef]" and "Basic" (reportOperatorIssue)
-   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:370:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Unknown"
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:370:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Basic | Unknown"
+     Operator "-" not supported for types "type[AppliedUndef]" and "Expr"
-     Operator "-" not supported for types "type[AppliedUndef]" and "Expr" (reportOperatorIssue)
+     Operator "-" not supported for types "type[AppliedUndef]" and "Basic" (reportOperatorIssue)
-   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:371:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Unknown"
+   .../projects/sympy/sympy/codegen/tests/test_rewriting.py:371:12 - error: Operator "-" not supported for types "type[AppliedUndef]" and "Expr | Basic | Unknown"
+     Operator "-" not supported for types "type[AppliedUndef]" and "Expr"
-     Operator "-" not supported for types "type[AppliedUndef]" and "Expr" (reportOperatorIssue)
+     Operator "-" not supported for types "type[AppliedUndef]" and "Basic" (reportOperatorIssue)
-   .../projects/sympy/sympy/combinatorics/perm_groups.py:2761:13 - error: Type "Symbol | Basic" is not assignable to declared type "Expr | None"
-     Type "Symbol | Basic" is not assignable to type "Expr | None"
-       Type "Basic" is not assignable to type "Expr | None"
-         "Basic" is not assignable to "None" (reportAssignmentType)
-   .../projects/sympy/sympy/concrete/expr_with_limits.py:556:20 - error: Operator "*" not supported for types "Unknown | Literal[1]" and "Unknown | Self@Basic"
+   .../projects/sympy/sympy/concrete/expr_with_limits.py:556:20 - error: Operator "*" not supported for types "Unknown | Literal[1]" and "Unknown | Basic | Piecewise"
-     Operator "*" not supported for types "Literal[1]" and "Basic*" (reportOperatorIssue)
+     Operator "*" not supported for types "Literal[1]" and "Basic" (reportOperatorIssue)
-     Return type mismatch: base method returns type "Basic", override returns type "tuple[Unknown, ...] | Unknown | Self@Basic | Self@Product | Basic | Expr | One"
-       Type "tuple[Unknown, ...] | Unknown | Basic* | Product* | Basic | Expr | One" is not assignable to type "Basic"
+     Return type mismatch: base method returns type "Basic", override returns type "tuple[Unknown, ...] | Unknown | Product | Basic | BooleanFalse | BooleanTrue | Equality | Expr | ComplexInfinity | Float | Infinity | Integer | NaN | NegativeInfinity | NegativeOne | Number | One | Rational | Zero"
+       Type "tuple[Unknown, ...] | Unknown | Product | Basic | BooleanFalse | BooleanTrue | Equality | Expr | ComplexInfinity | Float | Infinity | Integer | NaN | NegativeInfinity | NegativeOne | Number | One | Rational | Zero" is not assignable to type "Basic"
-   .../projects/sympy/sympy/concrete/products.py:283:21 - error: Operator "/" not supported for types "Literal[1]" and "Basic | One | Unknown | Expr | Self@Product"
+   .../projects/sympy/sympy/concrete/products.py:283:21 - error: Operator "/" not supported for types "Literal[1]" and "Basic | One | Unknown | Equality | BooleanFalse | BooleanTrue | NaN | Zero | Expr | NegativeOne | Integer | ComplexInfinity | Rational | Infinity | NegativeInfinity | Float | Number | Self@Product"
+     Operator "/" not supported for types "Literal[1]" and "Equality" (reportOperatorIssue)
-     Return type mismatch: base method returns type "Basic", override returns type "tuple[Unknown, ...] | Unknown | Self@Basic | Self@Sum | Expr | ZeroMatrix | Zero | NaN | Piecewise | Basic | Sum"
+     Return type mismatch: base method returns type "Basic", override returns type "tuple[Unknown, ...] | Unknown | Sum | Expr | ZeroMatrix | Zero | NaN | Piecewise | Basic"
-       Type "tuple[Unknown, ...] | Unknown | Basic* | Sum* | Expr | ZeroMatrix | Zero | NaN | Piecewise | Basic | Sum" is not assignable to type "Basic"
+       Type "tuple[Unknown, ...] | Unknown | Sum | Expr | ZeroMatrix | Zero | NaN | Piecewise | Basic" is not assignable to type "Basic"
-   .../projects/sympy/sympy/concrete/summations.py:266:21 - error: Operator "-" not supported for type "Basic | Zero | Unknown | NaN | Piecewise | Sum | Expr" (reportOperatorIssue)
+   .../projects/sympy/sympy/concrete/summations.py:266:21 - error: Operator "-" not supported for type "Basic | Zero | Unknown | NaN | Piecewise | Sum" (reportOperatorIssue)
-   .../projects/sympy/sympy/concrete/summations.py:517:41 - error: Argument of type "Unknown | Self@Basic" cannot be assigned to parameter "x" of type "SupportsAbs[_T@abs]" in function "abs"
+   .../projects/sympy/sympy/concrete/summations.py:517:41 - error: Argument of type "Dummy* | Basic" cannot be assigned to parameter "x" of type "SupportsAbs[_T@abs]" in function "abs"
-     Type "Unknown | Basic*" is not assignable to type "SupportsAbs[_T@abs]"
+     Type "Dummy* | Basic" is not assignable to type "SupportsAbs[_T@abs]"
-       "Basic*" is incompatible with protocol "SupportsAbs[_T@abs]"
+       "Basic" is incompatible with protocol "SupportsAbs[_T@abs]"
-   .../projects/sympy/sympy/concrete/summations.py:547:34 - error: Operator "*" not supported for types "Dummy" and "Unknown | Self@Basic"
+   .../projects/sympy/sympy/concrete/summations.py:547:34 - error: Operator "*" not supported for types "Dummy" and "Dummy* | Basic"
-     Operator "*" not supported for types "Dummy" and "Basic*" (reportOperatorIssue)
+     Operator "*" not supported for types "Dummy" and "Basic" (reportOperatorIssue)
-   .../projects/sympy/sympy/concrete/summations.py:557:34 - error: Operator "/" not supported for types "Unknown | Self@Basic" and "Unknown | Self@Basic"
+   .../projects/sympy/sympy/concrete/summations.py:557:34 - error: Operator "/" not supported for types "Unknown | Expr* | Basic" and "Dummy* | Basic"
-     Operator "/" not supported for types "Basic*" and "Basic*" (reportOperatorIssue)
-   .../projects/sympy/sympy/concrete/summations.py:570:29 - error: Operator "/" not supported for types "Unknown | Self@Basic" and "Basic | Unknown"

... (truncated 3266 lines) ...

scikit-learn (https://github.com/scikit-learn/scikit-learn)
+   .../projects/scikit-learn/sklearn/compose/_target.py:282:20 - error: Cannot access attribute "ndim" for class "str"
+     Attribute "ndim" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/_target.py:282:20 - error: Cannot access attribute "ndim" for class "tuple[str, str]"
+     Attribute "ndim" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/_target.py:282:20 - error: Cannot access attribute "ndim" for class "tuple[Unknown, Unknown | Any]"
+     Attribute "ndim" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/_target.py:282:42 - error: Cannot access attribute "shape" for class "str"
+     Attribute "shape" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/_target.py:282:42 - error: Cannot access attribute "shape" for class "tuple[str, str]"
+     Attribute "shape" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/_target.py:282:42 - error: Cannot access attribute "shape" for class "tuple[Unknown, Unknown | Any]"
+     Attribute "shape" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/_target.py:283:31 - error: Cannot access attribute "squeeze" for class "str"
+     Attribute "squeeze" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/_target.py:283:31 - error: Cannot access attribute "squeeze" for class "tuple[str, str]"
+     Attribute "squeeze" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/_target.py:283:31 - error: Cannot access attribute "squeeze" for class "tuple[Unknown, Unknown | Any]"
+     Attribute "squeeze" is unknown (reportAttributeAccessIssue)
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:568:20 - error: Cannot access attribute "format" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:568:20 - error: Cannot access attribute "format" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:569:32 - error: Cannot access attribute "toarray" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:569:32 - error: Cannot access attribute "toarray" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2280:32 - error: Cannot access attribute "columns" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2280:32 - error: Cannot access attribute "columns" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2291:31 - error: Cannot access attribute "dtypes" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2291:31 - error: Cannot access attribute "dtypes" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2406:36 - error: Cannot access attribute "columns" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2406:36 - error: Cannot access attribute "columns" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2410:36 - error: Cannot access attribute "columns" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2410:36 - error: Cannot access attribute "columns" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2435:30 - error: Cannot access attribute "columns" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2435:30 - error: Cannot access attribute "columns" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2439:30 - error: Cannot access attribute "columns" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2439:30 - error: Cannot access attribute "columns" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2595:24 - error: Cannot access attribute "columns" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2595:24 - error: Cannot access attribute "columns" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2645:26 - error: Cannot access attribute "columns" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2645:26 - error: Cannot access attribute "columns" for class "NDArray[Unknown | Any]"
-   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2705:19 - error: Cannot access attribute "index" for class "NDArray[Unknown]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_column_transformer.py:2705:19 - error: Cannot access attribute "index" for class "NDArray[Unknown | Any]"
+   .../projects/scikit-learn/sklearn/compose/tests/test_target.py:100:60 - error: Cannot access attribute "squeeze" for class "str"
+     Attribute "squeeze" is unknown (reportAttributeAccessIssue)
+   .../projects/scikit-learn/sklearn/compose/tests/test_target.py:100:60 - error: Cannot access attribute "squeeze" for class "tuple[str, str]"

... (truncated 510 lines) ...```

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

mypy_primer analysis

Advisory AI analysis of primer run 41914670543, attempt 1
for commit 9834bc02fa7376b158c5bfdd0fb90c6fa9668e9f. This is not an approval or proof of correctness.

Regression review required. Potential regressions or recorded warning signals are listed first; causation must be established separately.

Potential regressions

ibis: Iterator overload results lose element precision, and a dict comprehension becomes dict[Unknown, Unknown], so invalid key/value use may no longer be checked.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.

AI assessment: Possible regression (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline reported concrete incompatibilities involving zip/reversed iterators. At ibis/legacy/udf/vectorized.py:38 it retained bytes for both sides of the comprehension, yielding dict[bytes, bytes]. These are observed primer diagnostics/types, not assertion expectations.

After / PR evidence: The iterator incompatibility diagnostics disappear, and vectorized.py:38 is reported as dict[Unknown, Unknown]. The outer dict API survives, but its key and value constraints are erased.

Why this matters: Downstream code can no longer rely on Pyright to reject non-bytes keys or values obtained from this expression; lookups, assignments, decoding, and bytes-only calls can flow through Unknown. The removed iterator errors may likewise indicate that an incompatible retained overload arm stopped participating in checking.

Causal analysis:

The PR preserves a bound receiver while contextually inferring a call's return type, captures caller argument types before speculative inference, and relaxes a TypeVar/Any-or-Unknown union check. That can select or specialize a different generic overload and propagate its result into zip/reversed and the comprehension. Here the result is not merely a better container: dict's parameters become Unknown and previous checks vanish, which is a credible checking regression even if the PR behavior is intentional. The raw artifact establishes the transition, but the exact ibis overload declarations and synthetic merge checkout were not available, so it remains possible that a previously invalid overload inference was corrected while exposing annotation gaps.

Uncertainty / next check: Resolve the synthetic merge SHA and recorded ibis revision, then compare the relevant iterator overload candidates. A minimal control should reveal the comprehension and attempt both a bytes-only operation and insertion of str; the negative control should remain rejected without relying on an asserted expected type.

openlibrary: Many Optional hazards disappear because None is dropped from inferred results; this may suppress real call, member, subscript, and iteration checks.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.

AI assessment: Possible regression (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline retained None in values used at accounts/__init__.py:55, book_providers.py:233 and :343, and many model/plugin sites, producing optional-call, optional-member, optional-subscript, optional-iterable, and optional-operand diagnostics.

After / PR evidence: The corresponding diagnostics disappear after inferred unions lose None at those uses. The artifact does not show unchanged context, so it cannot establish whether each producer truly guarantees a non-None result.

Why this matters: Callers may no longer be warned before calling, indexing, iterating, or dereferencing a value that annotations permit to be None. If the selected overload is not justified by the arguments, downstream users lose Optional safety across multiple APIs; if it is justified, the removals are useful precision recovery.

Causal analysis:

The PR changes contextual return inference to retain and reapply the bound receiver, while caching argument types outside isolated speculative inference. That can solve receiver-dependent overloads more concretely and remove None from their return unions. The breadth and consistency make the PR a likely trigger, but neither fewer errors nor a non-Optional result proves correctness. The recorded raw diff lacks enough declaration context to show that each selected branch excludes None, and the exact synthetic merge commit was not resolved. Because multiple categories of safety check disappear, the ecosystem effect is a credible possible regression rather than an expected improvement.

Uncertainty / next check: At the recorded openlibrary revision, inspect the producer overloads at the three representative sites and verify which arguments/receiver select a non-None branch. Positive control: valid branch supports the operation. Negative control: an input matching the nullable branch must preserve the Optional diagnostic.

sympy: Receiver-dependent Self results are extensively reshaped; some become concrete unions, but many argument, attribute, and operator checks disappear without proof the operations are safe.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.
  • Changed diagnostic details introduce Any/Unknown.

AI assessment: Possible regression (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline commonly retained Self@Basic/Self@Product or Basic* branches. It rejected, for example, Basic-like values passed where Expr was required throughout integrals/manualintegrate.py and flagged missing members such as as_poly/as_numer_denom.

After / PR evidence: Many Self arms become concrete SymPy subclasses or Basic, sometimes adding useful diagnostics (ask.py:547, :552) but also removing numerous Expr argument, member, and operator errors in manualintegrate.py and elsewhere. Geometry sites expand one generic receiver error into concrete Point/Segment class errors.

Why this matters: Concrete receiver recovery can expose genuinely invalid operations, but vanished Expr-boundary and member checks mean downstream symbolic code may no longer be protected from passing a merely Basic object to APIs requiring Expr. The changed large unions can also alter overload selection and operator support far from the original call.

Causal analysis:

This is the PR's core mechanism: after contextual return inference, Pyright partially specializes the result with a preserved bound receiver and may recover a synthesized Self from type conditions. SymPy's pervasive generic constructors and receiver-returning methods amplify that change, replacing Self placeholders with concrete class unions. Some changes are plausibly improved checking, but the raw artifact also shows wholesale disappearance of checks in manualintegrate.py:335, 1883, 2005 and many later sites. Intentional removal of a synthesized Self is not enough to establish those values satisfy Expr. Without the exact SymPy declarations and synthetic merge checkout, this mixed project cannot be classified benignly.

Uncertainty / next check: Inspect one removed manualintegrate Expr diagnostic through its constructor/method overload and one newly added ask.py error at the recorded revision. Controls should show a concrete Expr subclass remains accepted while a Basic-only subclass is still rejected at the Expr parameter.

scikit-learn: Changed overload specialization introduces tuple/string receiver branches and Never tuple elements while also removing at least one iterable check; the net safety effect is mixed.

Regression warning signals require review, regardless of the AI assessment:

  • Changed diagnostic details introduce Any/Unknown.

AI assessment: Needs human review (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline did not report str/tuple member errors at compose/_target.py:282-283. Covariance loader results contained tuple[NDArray[float64], Unknown], and datasets/_samples_generator.py:1141 reported that object* was not iterable.

After / PR evidence: _target.py:282-283 now reports ndim/shape/squeeze access on str and several tuple branches. Many loader result details replace Unknown with Never, while NDArray details often gain Any. The _samples_generator iterable error disappears.

Why this matters: The new diagnostics may reveal that a receiver-dependent overload can return non-array forms, but they may also be false positives from an over-broad candidate. Never and Any alter reachability and checking: Never can erase a valid result arm, while Any weakens element operations. The removed iterable diagnostic may suppress a misuse.

Causal analysis:

The exact-head changes preserve bound receivers during contextual return inference, retain caller TypeVars, and alter constructor recovery. Those mechanisms can select more specific return variants for scikit-learn's heavily overloaded array/container APIs, matching the simultaneous tuple/string branches and Unknown-to-Never substitutions. However, the raw diff does not include the relevant overload declarations, and the project has both stricter and weaker outcomes. It is therefore unknown whether `_target` now exposes valid non-array returns, whether Never correctly marks an impossible option, or whether the inference selected incompatible branches. The PR is the likely trigger, but regression direction remains unresolved.

Uncertainty / next check: At the recorded revision, inspect the transform/load overloads feeding _target.py:282 and covariance tests. A positive control should preserve ndarray members for the array-returning arguments; a negative control selecting tuple/string must reject ndarray-only members. Also verify the removed iterable site remains checked for an object-only result.

core: A Home Assistant overload mismatch and an object-member error disappear, potentially reflecting better receiver binding or suppressed checks; declarations were not available to decide.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.

AI assessment: Needs human review (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline rejected async_run_hass_job at helpers/service.py:893 for no matching overload and reported an object* member error in the tellduslive integration.

After / PR evidence: Both diagnostics disappear in the recorded diff. No replacement type detail is present, so the artifact does not show whether a valid overload became provable or the results became gradual.

Why this matters: If the new binding is sound, valid Home Assistant calls stop producing noise. If not, users lose argument-shape enforcement for job scheduling and member validation for the tellduslive value.

Causal analysis:

Preserving the bound receiver and capturing caller argument types before speculative contextual inference can materially change overload applicability for callback/job APIs. That makes this PR a likely trigger for the removed async_run_hass_job mismatch. But a removed overload error is not proof of an improvement, and the concise artifact gives no inferred replacement type at either site. The method declarations, callback type, and exact ecosystem checkout were not inspected, so whether the previously rejected call satisfies a retained overload remains unresolved.

Uncertainty / next check: Inspect async_run_hass_job overloads and the service.py:893 argument types at the recorded revision. Positive control: the actual callback/job form selects one overload. Negative control: alter its parameters or return contract and ensure no overload remains. Reveal the tellduslive receiver to exclude Any/Unknown.

xarray: Overload selection becomes inconsistent: new isel errors bind one positional ndarray against keyword-only alternatives, while many ndarray indexer/member checks disappear.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.
  • Changed diagnostic details introduce Any/Unknown.

AI assessment: Possible regression (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline retained diagnostics for ndarray/indexer operations including where, get_duck_array, vindex, and oindex. It did not emit the repeated new isel argument errors shown in the changed run.

After / PR evidence: Multiple isel calls now diagnose a positional NDArray[int64] against several keyword parameters, suggesting an altered overload/call branch. Meanwhile prior ndarray member and argument errors disappear at other sites, with no replacement types in the concise artifact.

Why this matters: Valid indexing code may acquire false positives, while invalid use of xarray's specialized indexers may stop being checked. Losing vindex/oindex/get_duck_array checks can hide API misuse; selecting a wrong isel candidate can reject valid programs.

Causal analysis:

The PR captures argument types before speculative contextual inference and reapplies bound receiver specialization to returns. In overload-heavy xarray indexing, that can change both which call candidate survives and the specialized indexer type passed downstream. The repeated isel mapping of one positional argument to multiple keyword parameters is counterevidence to treating all new errors as restored checking, while vanished member errors are counterevidence to treating fewer errors as improvement. Without the recorded xarray overload declarations and synthetic merge SHA, a single sound causal path cannot be proven, but the implementation and pattern make the PR a likely trigger and a regression credible.

Uncertainty / next check: Inspect the recorded isel signature/overloads and one vanished vindex/oindex producer. Positive control: a valid positional mapping must select the intended parameter and preserve its specialized indexer API. Negative control: wrong ndarray shape/type and unsupported member access must still fail.

pytensor: More specialized symbolic result types appear, but zip/object iteration and ConvertibleToInt constructor checks also vanish, so stronger inference may be suppressing useful boundaries.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.

AI assessment: Needs human review (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline reported several non-iterable object/zip paths and rejected values that did not satisfy ConvertibleToInt at constructor boundaries. Other details retained broader or unknown symbolic types.

After / PR evidence: Several symbolic variables become more specialized, while those iterator and constructor diagnostics disappear. The artifact does not reveal replacement types at all removed sites, so it cannot show that iteration or conversion is guaranteed.

Why this matters: Users may gain better symbolic-variable completion, but could lose checks that prevent iterating non-iterables or constructing integer-like objects from unsupported values. Those are static safety regressions even without a runtime failure.

Causal analysis:

PyTensor relies heavily on generic symbolic constructors and receiver-dependent operations. The PR's receiver preservation and constructor-scope recovery can specialize these results and alter overload applicability, matching both the improved symbolic details and removed constructor/iterator errors. Yet specialization is not automatically sound: a concrete outer symbolic type does not establish that each iterable element or ConvertibleToInt constraint is preserved. The relevant overload sets and exact project checkout were unavailable, so the mixed effect needs review rather than being classified as an exposed typing issue or expected improvement.

Uncertainty / next check: Trace one removed ConvertibleToInt diagnostic through its constructor signature and one removed zip iteration through the producer return. Controls should accept an actual int-convertible/iterable symbolic value while rejecting a value lacking __int__/__index__ or __iter__.

cloud-init: A return improves from list[Unknown] to list[str], but None-specific member errors become generic object-attribute errors, weakening the diagnostic's narrowing information.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.

AI assessment: Needs human review (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: One return was inferred as list[Unknown]. At other sites the diagnostics explicitly identified None as an invalid member receiver, preserving Optional-specific information.

After / PR evidence: The return becomes list[str], which restores element checking. Separate member diagnostics remain but describe object rather than None, so the check survives while its explanation and inferred union structure become less precise.

Why this matters: String element operations can now be checked usefully, but users lose direct evidence that a failing path is nullable. A generic object error can make correct narrowing harder and may indicate that unrelated receiver branches were merged.

Causal analysis:

Preserving and reapplying a bound receiver can solve a generic iterable return to str, explaining list[Unknown] to list[str]. The same mechanism can reshape receiver unions, but object replacing None is not unambiguously better: it retains an attribute check while discarding actionable Optional information. Because this project contains both a clear precision gain and diagnostic-detail degradation, and the producer declarations were not inspected at the recorded revision, the overall result needs review. The exact synthetic merge commit was not resolved.

Uncertainty / next check: Inspect the producers for the list and member receivers. A list control should reject appending non-str. For the member sites, a nullable input should still produce an Optional-specific branch after narrowing; a genuinely object-typed input should produce the generic object error.

spack: Bool indexing/member errors vanish at test/config.py:640-647, so an invalid bool-shaped result may now pass through unchecked despite other benign specialization changes.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.
  • Changed diagnostic details introduce Any/Unknown.

AI assessment: Possible regression (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline rejected indexing/member operations on bool at test/config.py:640-647, explicitly preserving the possibility that the receiver was a boolean rather than the expected container/object.

After / PR evidence: Those diagnostics disappear. Other Spack changes mostly alter display or specialization, but the artifact provides no concrete replacement type at these six sites.

Why this matters: Downstream configuration code can no longer rely on Pyright to reject subscripting or member access when the API returns bool. If bool is still a valid return branch, real branch-handling mistakes are hidden; if it is impossible for these arguments, the removal is useful.

Causal analysis:

Receiver-preserving contextual return inference can select a more specific overload branch for configuration APIs and remove bool from the result. That is likely what triggered this clustered change, but the PR's intended specialization does not prove the selected branch is justified. Six related bool checks disappearing without replacement type evidence is a credible regression signal. The exact Spack declarations and recorded checkout were not available, so this cannot be distinguished from correction of an over-broad prior union solely from the artifact.

Uncertainty / next check: Inspect the configuration getter overload and arguments at lines 640-647. Positive control: the exact key/default combination must guarantee the object/container branch. Negative control: a key/default combination that permits bool must retain subscript and member errors.

jax: _DimExpr Self results become _DimExpr | int, exposing a new int.T error and an Array/NDArray assignment failure while some sparse tuple details improve.

Regression warning signals require review, regardless of the AI assessment:

  • Changed diagnostic details introduce Any/Unknown.

AI assessment: Needs human review (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline represented affected dimension-expression results with receiver-dependent Self forms and did not report the new `.T` access on int. A sparse tuple detail included Unknown and a literal 1.

After / PR evidence: The receiver result is widened/concretized to _DimExpr | int. The int branch now causes a `.T` attribute error and an Array | NDArray[Any] assignment error appears; sparse tuple detail removes Unknown but widens Literal[1] to int.

Why this matters: If int is a real return variant, the new diagnostics restore useful checking. If contextual inference incorrectly retains it for these arguments, valid JAX shape code gets false positives. NDArray[Any] preserves the array API but loses element precision; widening Literal[1] to int can lose shape-specific information.

Causal analysis:

The PR's synthesized Self recovery and bound-receiver specialization directly fit _DimExpr Self becoming a concrete union that includes int. This can expose unsupported members on an actual retained candidate, which is not inherently a regression. Counterevidence is the simultaneous Any element precision and literal widening, plus the absence of inspected JAX overloads proving int is feasible at the representative call. Therefore the PR is likely causal but the ecosystem effect is mixed and needs review rather than being labeled an expected improvement.

Uncertainty / next check: Inspect the _DimExpr method/operator declaration and call arguments at the recorded JAX revision. Positive control: an operation guaranteed to return _DimExpr supports `.T` if declared; negative control: a path that may return int must reject `.T`. Reveal sparse tuple shape to test whether Literal[1] should survive.

pywin32: Three Optional member/subscript warnings disappear in Scintilla configuration code, while a separate operator improves to float; nullable safety may have been lost.

Regression warning signals require review, regardless of the AI assessment:

  • Type-checking diagnostics disappear without replacements at the same locations.

AI assessment: Possible regression (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline reported Optional member/subscript hazards at scintilla/config.py:208, :292, and :306. Separately, an operator type contained Unknown | float.

After / PR evidence: The three Optional diagnostics disappear. The separate operator becomes float, a useful precision gain, but the concise artifact does not show replacement types for the nullable configuration values.

Why this matters: Users gain reliable float operations at one site, but may lose warnings before dereferencing or subscripting an absent configuration value at three others. If None remains possible at runtime, those are meaningful static regressions.

Causal analysis:

The PR can specialize a receiver-dependent return using captured caller arguments, removing Unknown or None from a selected overload result. That plausibly explains both float recovery and the clustered Optional removals. The float transition is positive evidence that specialization can improve precision, but it does not prove the Scintilla calls select non-null branches. Because the producer overloads and exact PyWin32 revision were not inspected, the nullable removals remain credible regressions and attribution is likely but not fully proven.

Uncertainty / next check: Inspect the Scintilla configuration getter overloads and arguments at lines 208, 292, and 306. A missing-key/default path must retain Optional warnings; a guaranteed-present path should narrow to the concrete value. Also ensure the float path rejects nonnumeric operators.

Unresolved investigations

vision: An object* non-iterable error disappears while another operator's expected-type detail changes; missing declarations prevent determining whether iteration became valid or unchecked.

AI assessment: Needs human review (low confidence). PR attribution: Not established.

Before / baseline evidence: The baseline reported that object* was not iterable at one TorchVision site. A separate operator diagnostic carried a different expected-type detail.

After / PR evidence: The iterable diagnostic is absent, and the operator diagnostic's detail changes. The concise artifact does not provide a replacement inferred type or enough context to connect both changes to one overload.

Why this matters: The missing error may allow iteration of a value whose annotation does not guarantee __iter__, or it may remove a false positive after a generic return is correctly specialized. Users cannot infer from this artifact whether element operations remain checked.

Causal analysis:

The PR can specialize a contextual return using a preserved receiver, plausibly turning object* into an iterable result. However, the relevant TorchVision producer and overload set were not inspected, and the operator detail could be unrelated or merely explanatory. There is no evidence that the result became a concrete iterable rather than Any/Unknown. The exact synthetic merge checkout is also unresolved, so causal attribution and correctness remain unclear.

Uncertainty / next check: At the recorded TorchVision revision, reveal the producer result and inspect its receiver-dependent overload. A valid receiver should infer Iterable[T] and preserve T's operations; an invalid/non-iterable receiver should still produce the missing __iter__ diagnostic.

manticore: Symbolic BitVec unions are substantially reshaped, adding iterable/Optional operand errors while removing other subclass branches and checks; correctness is mixed.

AI assessment: Needs human review (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline carried broader receiver-dependent symbolic unions, including Self-like/subclass branches, and emitted a different set of member/operator checks.

After / PR evidence: The changed run reports new non-iterable and Optional-operand failures while some prior subclass branches and diagnostics disappear. The concise diff shows changed unions but not enough declarations to prove which symbolic result variants are feasible.

Why this matters: New errors may restore checks on genuinely nullable or non-iterable symbolic values, but removed branches can reject supported symbolic operations or suppress checks by changing overload selection. This affects static modeling of Manticore expressions even without a runtime defect.

Causal analysis:

Manticore's symbolic classes are a direct stress case for preserved bound receivers and synthesized Self recovery. The PR can replace a generic Self branch with concrete symbolic subclasses, changing operators, iteration, and Optional propagation. The presence of both newly exposed hazards and vanished checks prevents a one-direction assessment. No inspected declaration establishes that the retained concrete candidates support exactly the operations now accepted, and the exact synthetic merge/environment is unresolved. The PR is likely causal, but whether it improves or regresses Manticore's symbolic API model requires targeted review.

Uncertainty / next check: Inspect one changed BitVec-returning method and its overloads at the recorded revision. Controls should preserve operators supported by every retained return candidate, reject iteration for genuinely non-iterable results, and keep an Optional operand error until None is narrowed.

Other project assessments

mkdocs: The same weak_property diagnostics remain, but the receiver is displayed as concrete weak_property rather than synthetic Self, improving actionable type information.

AI assessment: Expected improvement (high confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: At the recorded MkDocs sites, diagnostics referred to Self@weak_property. The checks themselves were already present; the artifact provides no evidence of a location or rule disappearing.

After / PR evidence: The same diagnostic locations and checks remain, with the receiver rendered as weak_property. This removes a synthetic Self placeholder from the explanation without erasing the outer type or a supported operation.

Why this matters: Users retain the same error detection and receive a more concrete receiver name when diagnosing the weak_property use. No downstream operation shown by the artifact becomes unchecked.

Causal analysis:

The PR explicitly preserves and reapplies a bound receiver after contextual return inference and can recover a synthesized Self from type conditions. That directly explains a display/detail transition from Self@weak_property to the concrete class. Because the diagnostic headers remain at the same sites and only the explanatory receiver is more concrete, this evidence supports an expected precision improvement rather than suppression. The exact synthetic merge SHA was not resolved, but the causal implementation is present at the manifest's exact head.

Uncertainty / next check: The raw concise diff lacks unchanged surrounding detail. Confirm against the complete recorded diagnostics that rule, severity, and locations are identical; a minimal reveal_type control on weak_property should produce the concrete receiver while preserving an invalid-member negative control.

streamlit: An ExceptionGroup constructor error remains, but its expected argument is concretized from a TypeVar form to Sequence[Exception].

AI assessment: Expected improvement (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline constructor diagnostic exposed a generic TypeVar-based expected type for the ExceptionGroup argument. This was an observed diagnostic detail, not evidence that the call was accepted.

After / PR evidence: The same call remains rejected, with the expected type shown as Sequence[Exception]. The check is preserved and its contract becomes understandable without following an internal TypeVar.

Why this matters: No shown invalid constructor call becomes accepted. Users gain a concrete sequence element requirement, making it clearer how to correct the argument and retaining element-type checking.

Causal analysis:

The PR retains caller-bound TypeVars and reapplies receiver specialization during contextual return inference; constructor recovery also replaces unsolved variables by constructor scope. Those changes can resolve an internal constructor TypeVar to Sequence[Exception]. Since the diagnostic remains at the same site and the new type is more concrete rather than Any/Unknown, the recorded effect is an expected information improvement. The exact Streamlit revision and synthetic merge SHA were not independently resolved, so confidence is medium rather than high.

Uncertainty / next check: Inspect the recorded ExceptionGroup constructor call and overload to ensure Sequence[Exception] is the selected contract. A control passing Sequence[Exception] should succeed; Sequence[str] should retain an element incompatibility.

  • Exact PR head changes unsolved constructor-variable recovery, matching the concrete ExceptionGroup expected type.:
    ): Type | undefined {
    const specializedType = evaluator.solveAndApplyConstraints(ClassType.cloneAsInstance(type), constraints, {
    replaceUnsolved: {
    scopeIds: getTypeVarScopeIds(type),
    tupleClassType: evaluator.getTupleClassType(),
    },
    });
    if (!evaluator.assignType(expectedSubtype, specializedType)) {
  • Exact head keeps caller TypeVars bound outside lexical scope during result inference.:
    }
    override transformTypeVar(typeVar: TypeVarType) {
    // A borrowed caller variable remains bound even outside its lexical scope.
    if (!TypeVarType.isBound(typeVar) && !this._isTypeVarLive(typeVar)) {
    return TypeVarType.cloneAsUnificationVar(typeVar, this._usageOffset);
    }
    return undefined;

setuptools: A preserved warning gains TarInfo as a concrete branch while retaining Unknown and None, adding useful information without hiding the unsafe cases.

AI assessment: Expected improvement (medium confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline diagnostic described the relevant value as Unknown | None. The warning was present, so unsafe Optional/unknown use was already checked.

After / PR evidence: At the same diagnostic, the type becomes TarInfo | Unknown | None. TarInfo is now visible as a supported concrete result while Unknown and None continue to trigger the warning.

Why this matters: Users can reason about and narrow the normal archive-member result using TarInfo APIs, while still receiving protection for absent or unknown results. No demonstrated operation loses checking.

Causal analysis:

Reapplying a bound receiver after contextual return inference can recover a concrete generic return branch that was previously represented only as Unknown. The exact-head implementation directly fits the addition of TarInfo. Because the existing diagnostic remains and neither Unknown nor None is erased, this is a precision improvement rather than success-shaped suppression. The exact setuptools checkout was not resolved, limiting confidence about every unchanged detail.

Uncertainty / next check: Confirm the complete diagnostic keeps the same rule/location. A control should narrow `isinstance(x, TarInfo)` to TarInfo and allow TarInfo members, while use without excluding None must retain the existing warning.

pip: The same diagnostic now names cached_property concretely instead of cached_property*, with no observed loss of a check or API precision.

AI assessment: Expected improvement (high confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: The baseline detail rendered the receiver as cached_property*, an internally specialized/bound form. The diagnostic itself was already emitted.

After / PR evidence: The same location is rendered with concrete cached_property. No diagnostic header disappears and no type changes to Any or Unknown in the recorded evidence.

Why this matters: Checking is preserved while the message becomes easier to map to pip's declared descriptor class. Downstream users do not lose any operation or invalid-use diagnostic shown by the artifact.

Causal analysis:

The PR reapplies a preserved bound receiver after contextual return inference and changes how caller-bound variables remain bound. This directly accounts for replacing an internal starred receiver display with its concrete class. Because the check remains and only the diagnostic detail is normalized, the ecosystem effect is an expected presentation/precision improvement. The exact synthetic merge SHA remains unknown, but the head implementation and artifact align closely.

Uncertainty / next check: Confirm the complete diagnostic has identical rule, severity, and location. A descriptor control should infer cached_property concretely while an invalid attribute or call remains rejected.

pandera: Unknown is removed from str | Unknown | None across serialization tests while every shown None-related operator and argument error remains.

AI assessment: Expected improvement (high confidence). PR attribution: Likely caused by the PR.

Before / baseline evidence: Diagnostics at tests/ibis/test_ibis_io.py and tests/io sites described serialized text as str | Unknown | None. The unsafe use was already rejected.

After / PR evidence: The same locations remain errors, but the value is str | None. Examples include pandas_io.py:1341/1344 and serdes_minimal.py:66/82/106-107. Only the gradual Unknown branch disappears.

Why this matters: Users retain all shown Optional safety checks while gaining a precise non-null branch. After narrowing None, string operations can be checked as str rather than contaminated by Unknown; invalid stream, len, and membership uses remain diagnosed.

Causal analysis:

Preserving and reapplying a bound receiver during contextual return inference can recover a concrete str return where the prior generic path left Unknown. This is the beneficial opposite of type erasure: the gradual branch is removed, the outer API becomes more precise, and the diagnostic headers remain. Across the shown ibis, pandas, polars, serde, and pyspark tests, there is no evidence of a suppressed check. The exact synthetic merge SHA was not resolved, but the exact-head implementation directly supports the transition.

Uncertainty / next check: Confirm complete diagnostics preserve rules and locations beyond the concise lines. A positive control should narrow `value is not None` to str and permit string operations; without narrowing, membership, len, write, and safe_load misuse should continue to fail.

Full evidence and limitations: download mypy-primer-analysis-report from this analysis run.
The original raw primer comment is unchanged. Treat uncertainty and possible regressions as requests for human review.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Compared candidate a20e6237f62cbf1085d8eb1417627e684c5bba54 against its first parent bd343ad2adbbdedbfb748fc96a0fae7c0558d304.

View the full release history charts with the base and PR results.

Execution time history

Execution time history

Peak memory history

Peak memory history

Download the chart artifact.

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 21.302s +0.6% 1091.9 MB -0.1% 🟢 Pass
click pyright 17 3.290s -0.5% 357.9 MB -0.4% 🟢 Pass
homeassistant pyright 9850 114.496s -4.6% 6092.3 MB +0.0% 🟢 Pass
numpy pyright 356 38.002s +4.7% 1387.8 MB +4.2% 🟢 Pass
pandas pyright 1459 105.966s -7.0% 3753.3 MB +6.3% 🟢 Pass
pytest pyright 243 8.341s -3.2% 857.2 MB -0.2% 🟢 Pass
requests pyright 19 2.439s +0.2% 341.3 MB -1.2% 🟢 Pass
torch pyright 2400 93.495s +16.4% 4704.1 MB -6.7% 🟢 Pass
transformers pyright 2901 72.527s -0.2% 5006.1 MB +0.4% 🟢 Pass

Pyright stats

Package Parsed/bound Checked Find Read Tokenize Parse Imports Bind Check Cycles
ansible 988 583 0.050s 0.083s 0.407s 0.773s 0.223s 1.027s 18.080s 0.000s
click 111 17 0.000s 0.017s 0.123s 0.240s 0.040s 0.283s 2.230s 0.000s
homeassistant 11150 9850 0.420s 0.887s 2.287s 4.097s 1.963s 6.287s 95.607s 0.000s
numpy 606 356 0.010s 0.067s 0.363s 0.733s 0.263s 0.887s 35.060s 0.000s
pandas 1899 1459 0.050s 0.203s 0.970s 1.967s 0.260s 2.130s 98.990s 0.000s
pytest 545 243 0.010s 0.043s 0.237s 0.347s 0.080s 0.537s 6.557s 0.000s
requests 167 19 0.000s 0.013s 0.130s 0.220s 0.057s 0.280s 1.430s 0.000s
torch 3078 2400 0.103s 0.297s 1.237s 2.540s 0.470s 3.400s 82.740s 0.000s
transformers 3536 2901 0.083s 0.257s 1.337s 2.443s 0.587s 5.763s 61.180s 0.000s

@rchiodo

Copy link
Copy Markdown
Collaborator Author

Inspected the mypy_primer differences. They should all be expected or tolerated as better diagnostics.

@rchiodo
Rich Chiodo (rchiodo) merged commit b57fefa into microsoft:main Nov 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-auto:approved Automated review: no blocking findings (approval posted).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants