mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-16 16:40:19 +00:00
[ty] Eagerly evaluate more constraints based on the raw AST (#19068)
This commit is contained in:
parent
7d468ee58a
commit
c6fd11fe36
1 changed files with 6 additions and 0 deletions
|
@ -550,6 +550,12 @@ impl<'db, 'ast> SemanticIndexBuilder<'db, 'ast> {
|
|||
match node {
|
||||
ast::Expr::BooleanLiteral(ast::ExprBooleanLiteral { value, .. }) => Some(*value),
|
||||
ast::Expr::Name(ast::ExprName { id, .. }) if id == "TYPE_CHECKING" => Some(true),
|
||||
ast::Expr::NumberLiteral(ast::ExprNumberLiteral {
|
||||
value: ast::Number::Int(n),
|
||||
..
|
||||
}) => Some(*n != 0),
|
||||
ast::Expr::EllipsisLiteral(_) => Some(true),
|
||||
ast::Expr::NoneLiteral(_) => Some(false),
|
||||
ast::Expr::UnaryOp(ast::ExprUnaryOp {
|
||||
op: ast::UnaryOp::Not,
|
||||
operand,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue