Skip to content

Commit cd75638

Browse files
committed
fix compile error after rebase
1 parent be3ae3c commit cd75638

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

crates/red_knot_python_semantic/src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl<'db> Type<'db> {
548548
}
549549

550550
fn is_bool(&self, db: &'db dyn Db) -> bool {
551-
self.into_instance()
551+
self.into_nominal_instance()
552552
.is_some_and(|instance| instance.class().is_known(db, KnownClass::Bool))
553553
}
554554

crates/red_knot_python_semantic/src/types/narrow.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,9 @@ impl<'db> NarrowingConstraintsBuilder<'db> {
472472
union.map(db, |ty| filter_to_cannot_be_equal(db, *ty, rhs_ty))
473473
}
474474
// Treat `bool` as `Literal[True, False]`.
475-
Type::Instance(instance) if instance.class().is_known(db, KnownClass::Bool) => {
475+
Type::NominalInstance(instance)
476+
if instance.class().is_known(db, KnownClass::Bool) =>
477+
{
476478
UnionType::from_elements(
477479
db,
478480
[Type::BooleanLiteral(true), Type::BooleanLiteral(false)]
@@ -501,7 +503,7 @@ impl<'db> NarrowingConstraintsBuilder<'db> {
501503

502504
fn evaluate_expr_ne(&mut self, lhs_ty: Type<'db>, rhs_ty: Type<'db>) -> Option<Type<'db>> {
503505
match (lhs_ty, rhs_ty) {
504-
(Type::Instance(instance), Type::IntLiteral(i))
506+
(Type::NominalInstance(instance), Type::IntLiteral(i))
505507
if instance.class().is_known(self.db, KnownClass::Bool) =>
506508
{
507509
if i == 0 {

0 commit comments

Comments
 (0)