[ty] Ban type qualifiers in PEP-695 type aliases#24242
Conversation
12c8390 to
57791cb
Compare
Typing conformance resultsThe percentage of diagnostics emitted that were expected errors held steady at 86.59%. The percentage of expected errors that received a diagnostic held steady at 80.96%. The number of fully passing files held steady at 68/132. SummaryHow are test cases classified?Each test case represents one expected error annotation or a group of annotations sharing a tag. Counts are per test case, not per diagnostic — multiple diagnostics on the same line count as one. Required annotations (
True positives changed (1)1 diagnostic
|
57791cb to
5653e13
Compare
Memory usage reportMemory usage unchanged ✅ |
|
5653e13 to
b9b4d1e
Compare
| Some(KnownClass::InitVar) => { | ||
| if let Some(builder) = self.context.report_lint(&INVALID_TYPE_FORM, subscript) { | ||
| let diagnostic = builder.into_diagnostic( | ||
| "Type qualifier `dataclasses.InitVar` is not allowed in type \ | ||
| expressions (only in annotation expressions)", | ||
| ); | ||
| add_type_expression_reference_link(diagnostic); | ||
| } | ||
| self.infer_expression(slice, TypeContext::default()); | ||
| Type::unknown() | ||
| } |
There was a problem hiding this comment.
the special casing for InitVar in multiple places is a bit unfortunate -- I have an idea for resolving that, but will do it in a followup
* main: (40 commits) [ty] resolve union-likes in emitting union attribute errors (#24263) [ty] Improve support for `Callable` type context (#23888) [ty] Propagate type context through `await` expressions (#24256) [`pyflakes`] Flag annotated variable redeclarations as `F811` in preview mode (#24244) [ty] Preserve `Divergent` when materializing recursive aliases (#24245) Fix W391 fixes for consecutive empty notebook cells (#24236) [flake8-bugbear] Clarify RUF071 fix safety for non-path string comparisons (#24149) [ty] Ban type qualifiers in PEP-695 type aliases (#24242) [ty] Include keyword-prefixed symbols in completions for attributes (#24232) [ty] Add tests for TypedDict method overloads on unions (#24230) [ty] report unused bindings as unnecessary hint diagnostics (#23305) Remove unused `non_root` variable (#24238) Extend F507 to flag %-format strings with zero placeholders (#24215) [`flake8-simplify`] Suppress `SIM105` for `except*` before Python 3.12 (#23869) Ignore pre-initialization references in SIM113 (#24235) Parenthesize expression in RUF050 fix (#24234) Publish playgrounds using the `release-playground` environment (#24223) [ty] Fix instance-attribute lookup in methods of protocol classes (#24213) [ty] Used shared expression cache during generic call inference (#24219) [ty] make `Type::BoundMethod` include instances of same-named methods bound to a subclass (#24039) ...
We already ban these in PEP-613 aliases. Fixes astral-sh/ty#3150; closes #24224