@@ -76,9 +76,9 @@ use crate::types::narrow::ClassInfoConstraintFunction;
7676use crate :: types:: signatures:: { CallableSignature , Signature } ;
7777use crate :: types:: visitor:: any_over_type;
7878use crate :: types:: {
79- BoundMethodType , CallableType , ClassLiteral , ClassType , DeprecatedInstance , DynamicType ,
80- KnownClass , Truthiness , Type , TypeMapping , TypeRelation , TypeTransformer , TypeVarInstance ,
81- UnionBuilder , all_members, walk_type_mapping,
79+ BoundMethodType , CallableType , ClassBase , ClassLiteral , ClassType , DeprecatedInstance ,
80+ DynamicType , KnownClass , Truthiness , Type , TypeMapping , TypeRelation , TypeTransformer ,
81+ TypeVarInstance , UnionBuilder , all_members, walk_type_mapping,
8282} ;
8383use crate :: { Db , FxOrderSet , ModuleName , resolve_module} ;
8484
@@ -901,7 +901,12 @@ fn is_instance_truthiness<'db>(
901901 if let Type :: NominalInstance ( instance) = ty {
902902 if instance
903903 . class
904- . is_subclass_of ( db, ClassType :: NonGeneric ( class) )
904+ . iter_mro ( db)
905+ . filter_map ( ClassBase :: into_class)
906+ . any ( |c| match c {
907+ ClassType :: Generic ( c) => c. origin ( db) == class,
908+ ClassType :: NonGeneric ( c) => c == class,
909+ } )
905910 {
906911 return true ;
907912 }
0 commit comments