[ty] Ban legacy TypeVar bounds or constraints from containing type variables#22949
[ty] Ban legacy TypeVar bounds or constraints from containing type variables#22949AlexWaygood merged 2 commits intomainfrom
TypeVar bounds or constraints from containing type variables#22949Conversation
Typing conformance results improved 🎉The percentage of diagnostics emitted that were expected errors increased from 80.00% to 80.04%. The percentage of expected errors that received a diagnostic increased from 71.42% to 71.60%. Summary
True positives addedDetails
|
bfae86a to
5219d09
Compare
|
|
Note that #21984 is already open. |
Ugh, I completely forgot. Thank you. The typing conformance diff for that PR looks wholly different to the one here, though, so I think my version is more comprehensive when it comes to legacy type variables |
TypeVar bounds or constraints from containing type variablesTypeVar bounds or constraints from containing type variables
Co-authored-by: Shunsuke Shibayama <sbym1346@gmail.com>
9da532d to
1a7caef
Compare
|
@mtshiba -- it looks like I accidentally recreated part of your PR. I've listed you as a co-author here; I hope that's okay. I think there were some parts I did slightly better and some parts you did slightly better, so I've tried to combine the work we both did here :-) |
* main: (76 commits) [ty] Improve the check for `NewType`s with generic bases (#22961) [ty] Ban legacy `TypeVar` bounds or constraints from containing type variables (#22949) Bump the typing conformance suite pin (#22960) [ty] Emit an error if a TypeVarTuple is used to subscript `Generic` or `Protocol` without being unpacked (#22952) [ty] Reduce false positives when subscripting classes generic over `TypeVarTuple`s (#22950) [ty] Detect invalid attempts to subclass `Protocol[]` and `Generic[]` simultaneously (#22948) Fix suppression indentation matching (#22903) Remove hidden `--output-format` warning (#22944) [ty] Validate signatures of dataclass `__post_init__` methods (#22730) [ty] extend special-cased `numbers` diagnostic to `invalid-argument-type` errors (#22938) [ty] Avoid false positive for `not-iterable` with no-positive intersection types (#22089) [ty] Preserve pure negation types in descriptor protocol (#22907) [ty] add special-case diagnostic for `numbers` module (#22931) [ty] Move the location of more `invalid-overload` diagnostics (#22933) [ty] Fix unary and comparison operators for TypeVars with union bounds (#22925) [ty] Rule Selection: ignore/warn/select all rules (unless subsequently overriden) (#22832) [ty] Fix TypedDict construction from existing TypedDict values (#22904) [ty] fix bug in string annotations and clean up diagnostics (#22913) [ty] Improve support for goto-type, goto-declaration, hover, and highlighting of string annotations (#22878) [ty] Rename old typing imports to new on `unresolved-reference`. (#22827) ...
Ah, I forgot about #21984. |
|
That would be great, thanks! |
Summary
The conformance suite mandates that type checkers should ban such constructs.
Test Plan
mdtests updated