Skip to content

[ty] Validate Generic and Protocol arguments directly - #29146

Open
charliermarsh wants to merge 1 commit into
mainfrom
charlie/codex-generic-base-validation
Open

charliermarsh wants to merge 1 commit into
mainfrom
charlie/codex-generic-base-validation

Conversation

@charliermarsh

Copy link
Copy Markdown
Member

Summary

We validate the arguments to Generic[...] and Protocol[...] directly. An invalid argument can contain a TypeVarTuple in one of its members, but that does not make it a valid type parameter. We now report the invalid argument instead of treating it as an unsupported variadic form.

This also avoids expanding unrelated members and recursive bounds while validating a class's generic parameters.

@charliermarsh charliermarsh added bug An issue describing something that isn't working, or a PR that fixes a bug ty The ty type checker labels Oct 6, 2026
@charliermarsh
charliermarsh added this pull request to stack #29150 October 6, 2026 20:05
@astral-sh-bot

astral-sh-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 98.24%. The percentage of expected errors that received a diagnostic held steady at 98.24%. The number of fully passing files held steady at 134/146.

@astral-sh-bot

astral-sh-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

Memory usage report

Memory usage unchanged ✅

@astral-sh-bot

astral-sh-bot Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Full report with detailed diff (timing results)

@charliermarsh
charliermarsh marked this pull request as ready for review October 6, 2026 20:36
@charliermarsh
charliermarsh requested a review from a team as a code owner October 6, 2026 20:36
@astral-sh-bot
astral-sh-bot Bot requested a review from ibraheemdev October 6, 2026 20:36
@charliermarsh
charliermarsh removed this pull request from stack #29150 October 6, 2026 23:50
@charliermarsh
charliermarsh added this pull request to stack #29156 October 6, 2026 23:50
Reject instance arguments even when their members or type arguments contain TypeVarTuple objects. Avoid searching those members, which can recurse through changing specializations.

Co-authored-by: Ibraheem Ahmed <ibraheem@ibraheem.ca>
@charliermarsh
charliermarsh force-pushed the charlie/codex-generic-base-validation branch from 79eaa65 to 09950dc Compare October 7, 2026 02:00

This branch was successfully deployed

1 active deployment
automations — 09950dce Deployed Oct 7, 2026 by charliermarsh via security-review / security review #90916
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug An issue describing something that isn't working, or a PR that fixes a bug ty The ty type checker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant