File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
crates/red_knot_python_semantic/src Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -548,7 +548,7 @@ impl<'db> Type<'db> {
548
548
}
549
549
550
550
fn is_bool ( & self , db : & ' db dyn Db ) -> bool {
551
- self . into_instance ( )
551
+ self . into_nominal_instance ( )
552
552
. is_some_and ( |instance| instance. class ( ) . is_known ( db, KnownClass :: Bool ) )
553
553
}
554
554
Original file line number Diff line number Diff line change @@ -472,7 +472,9 @@ impl<'db> NarrowingConstraintsBuilder<'db> {
472
472
union. map ( db, |ty| filter_to_cannot_be_equal ( db, * ty, rhs_ty) )
473
473
}
474
474
// 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
+ {
476
478
UnionType :: from_elements (
477
479
db,
478
480
[ Type :: BooleanLiteral ( true ) , Type :: BooleanLiteral ( false ) ]
@@ -501,7 +503,7 @@ impl<'db> NarrowingConstraintsBuilder<'db> {
501
503
502
504
fn evaluate_expr_ne ( & mut self , lhs_ty : Type < ' db > , rhs_ty : Type < ' db > ) -> Option < Type < ' db > > {
503
505
match ( lhs_ty, rhs_ty) {
504
- ( Type :: Instance ( instance) , Type :: IntLiteral ( i) )
506
+ ( Type :: NominalInstance ( instance) , Type :: IntLiteral ( i) )
505
507
if instance. class ( ) . is_known ( self . db , KnownClass :: Bool ) =>
506
508
{
507
509
if i == 0 {
You can’t perform that action at this time.
0 commit comments