Skip to content

fix Preserve class-scoped type parameters when converting __new__ to a callable #4267#4271

Open
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:4267
Open

fix Preserve class-scoped type parameters when converting __new__ to a callable #4267#4271
asukaminato0721 wants to merge 1 commit into
facebook:mainfrom
asukaminato0721:4267

Conversation

@asukaminato0721

Copy link
Copy Markdown
Collaborator

Summary

Fixes #4267

Bare generic classes now preserve class-scoped type parameters when converting __new__ to a callable.

Class8 correctly infers Class8[str] and rejects inconsistent constructor arguments.

Test Plan

Added regression coverage and updated generated conformance results.

@github-actions

Copy link
Copy Markdown

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

rotki (https://github.com/rotki/rotki)
+ ERROR rotkehlchen/db/settings.py:286:60-92: `frozenset[_T_co]` is not assignable to `frozenset[ExchangeLocationID]` [bad-assignment]

scikit-build-core (https://github.com/scikit-build/scikit-build-core)
+ ERROR src/scikit_build_core/build/_wheelfile.py:74:30-74: `frozenset[_T_co]` is not assignable to `AbstractSet[Tag]` [bad-assignment]

streamlit (https://github.com/streamlit/streamlit)
+ ERROR lib/streamlit/runtime/scriptrunner_utils/script_requests.py:61:45-77: `frozenset[_T_co]` is not assignable to `frozenset[str]` [bad-assignment]
+ ERROR lib/streamlit/runtime/scriptrunner_utils/script_run_context.py:209:45-77: `frozenset[_T_co]` is not assignable to `frozenset[str]` [bad-assignment]

ibis (https://github.com/ibis-project/ibis)
- ERROR ibis/expr/types/relations.py:4963:21-68: `list[tuple[Unknown, ...]]` is not assignable to variable `names` with type `Iterable[str] | None` [bad-assignment]
+ ERROR ibis/expr/types/relations.py:4963:21-68: `list[tuple[str, ...]]` is not assignable to variable `names` with type `Iterable[str] | None` [bad-assignment]

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve class-scoped type parameters when converting __new__ to a callable

2 participants