@@ -492,6 +492,7 @@ pub enum Type<'db> {
492492 /// Construct this variant using the `Type::instance` constructor function.
493493 NominalInstance ( NominalInstanceType < ' db > ) ,
494494 /// The set of Python objects that conform to the interface described by a given protocol.
495+ /// Construct this variant using the `Type::instance` constructor function.
495496 ProtocolInstance ( ProtocolInstanceType < ' db > ) ,
496497 /// A single Python object that requires special treatment in the type system
497498 KnownInstance ( KnownInstanceType < ' db > ) ,
@@ -1180,7 +1181,6 @@ impl<'db> Type<'db> {
11801181 left. is_subtype_of ( db, right)
11811182 }
11821183 // A protocol instance can never be a subtype of a nominal type, with the *sole* exception of `object`.
1183- // TODO: `Callable` types are also structural types.
11841184 ( Type :: ProtocolInstance ( _) , _) => false ,
11851185 ( _, Type :: ProtocolInstance ( protocol) ) => self . satisfies_protocol ( db, protocol) ,
11861186
@@ -1510,7 +1510,6 @@ impl<'db> Type<'db> {
15101510 // Other than the dynamic types such as `Any`/`Unknown`/`Todo` handled above,
15111511 // a protocol instance can never be assignable to a nominal type,
15121512 // with the *sole* exception of `object`.
1513- // TODO: `Callable` types are also structural types.
15141513 ( Type :: ProtocolInstance ( _) , _) => false ,
15151514 ( _, Type :: ProtocolInstance ( protocol) ) => self . satisfies_protocol ( db, protocol) ,
15161515
@@ -1537,8 +1536,8 @@ impl<'db> Type<'db> {
15371536 ( Type :: NominalInstance ( left) , Type :: NominalInstance ( right) ) => {
15381537 left. is_equivalent_to ( db, right)
15391538 }
1540- ( Type :: ProtocolInstance ( first ) , Type :: ProtocolInstance ( right) ) => {
1541- first . is_equivalent_to ( db, right)
1539+ ( Type :: ProtocolInstance ( left ) , Type :: ProtocolInstance ( right) ) => {
1540+ left . is_equivalent_to ( db, right)
15421541 }
15431542 ( Type :: ProtocolInstance ( protocol) , nominal @ Type :: NominalInstance ( n) )
15441543 | ( nominal @ Type :: NominalInstance ( n) , Type :: ProtocolInstance ( protocol) ) => {
@@ -1594,8 +1593,8 @@ impl<'db> Type<'db> {
15941593 first. is_gradual_equivalent_to ( db, second)
15951594 }
15961595
1597- ( Type :: ProtocolInstance ( first) , Type :: ProtocolInstance ( right ) ) => {
1598- first. is_gradual_equivalent_to ( db, right )
1596+ ( Type :: ProtocolInstance ( first) , Type :: ProtocolInstance ( second ) ) => {
1597+ first. is_gradual_equivalent_to ( db, second )
15991598 }
16001599 ( Type :: ProtocolInstance ( protocol) , nominal @ Type :: NominalInstance ( n) )
16011600 | ( nominal @ Type :: NominalInstance ( n) , Type :: ProtocolInstance ( protocol) ) => {
0 commit comments