Add support for simple generic type variables to UP040#6314
Conversation
1834445 to
382e0f1
Compare
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinuxWindows |
We don't remove unused variables in the module scope, since they could be imported from other modules (i.e., they are part of the module's public API). (We only remove unused variables within function scopes.) |
Ah that makes sense. We're pretty unlikely to ever remove these then. I don't think we should either, I've definitely imported them :D |
2fffafb to
bae9097
Compare
| fn visit_expr(&mut self, expr: &'a Expr) { | ||
| match expr { | ||
| Expr::Name(name) if name.ctx.is_load() => { | ||
| let Some(Stmt::Assign(StmtAssign { value, .. })) = |
There was a problem hiding this comment.
Does this need to match AnnAssign too? No, right?
There was a problem hiding this comment.
I don't think so. At least, Pyright complains about
from typing import TypeVar
T: TypeVar = TypeVar("T")Extends astral-sh#6289 to support moving type variable usage in type aliases to use PEP-695. Does not remove the possibly unused type variable declaration. Presumably this is handled by other rules, but is not working for me. Does not handle type variables with bounds or variance declarations yet. Part of astral-sh#4617
Extends #6289 to support moving type variable usage in type aliases to use PEP-695.
Does not remove the possibly unused type variable declaration.
Presumably this is handled by other rules, but is not working for me.We cannot remove module level declarations safely.Does not handle type variables with bounds or variance declarations yet.
Part of #4617