Compare commits

...

1 Commits

Author SHA1 Message Date
David Peter
242d9b163d [red-knot] Eliminate None in equality-comparison narrowing 2025-04-22 21:47:27 +02:00

View File

@@ -446,6 +446,11 @@ impl<'db> NarrowingConstraintsBuilder<'db> {
}
}
ast::CmpOp::Eq if lhs_ty.is_literal_string() => Some(rhs_ty),
ast::CmpOp::Eq if !rhs_ty.is_none(self.db) => Some(
IntersectionBuilder::new(self.db)
.add_negative(Type::none(self.db))
.build(),
),
ast::CmpOp::In => self.evaluate_expr_in(lhs_ty, rhs_ty),
ast::CmpOp::NotIn => self
.evaluate_expr_in(lhs_ty, rhs_ty)