Skip to content

Commit c6fd11f

Browse files
authored
[ty] Eagerly evaluate more constraints based on the raw AST (#19068)
1 parent 7d468ee commit c6fd11f

File tree

1 file changed

+6
-0
lines changed
  • crates/ty_python_semantic/src/semantic_index

1 file changed

+6
-0
lines changed

crates/ty_python_semantic/src/semantic_index/builder.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,12 @@ impl<'db, 'ast> SemanticIndexBuilder<'db, 'ast> {
550550
match node {
551551
ast::Expr::BooleanLiteral(ast::ExprBooleanLiteral { value, .. }) => Some(*value),
552552
ast::Expr::Name(ast::ExprName { id, .. }) if id == "TYPE_CHECKING" => Some(true),
553+
ast::Expr::NumberLiteral(ast::ExprNumberLiteral {
554+
value: ast::Number::Int(n),
555+
..
556+
}) => Some(*n != 0),
557+
ast::Expr::EllipsisLiteral(_) => Some(true),
558+
ast::Expr::NoneLiteral(_) => Some(false),
553559
ast::Expr::UnaryOp(ast::ExprUnaryOp {
554560
op: ast::UnaryOp::Not,
555561
operand,

0 commit comments

Comments
 (0)