@@ -102,6 +102,7 @@ assert_bytes!(KeyAnnotation, 12);
102102assert_bytes ! ( KeyClassMetadata , 4 ) ;
103103assert_bytes ! ( KeyClassMro , 4 ) ;
104104assert_bytes ! ( KeyAbstractClassCheck , 4 ) ;
105+ assert_bytes ! ( KeyClassSubscriptSymmetry , 4 ) ;
105106assert_words ! ( KeyLegacyTypeParam , 1 ) ;
106107assert_words ! ( KeyYield , 1 ) ;
107108assert_words ! ( KeyYieldFrom , 1 ) ;
@@ -119,6 +120,7 @@ assert_words!(BindingClassBaseType, 3);
119120assert_words ! ( BindingClassMetadata , 11 ) ;
120121assert_bytes ! ( BindingClassMro , 4 ) ;
121122assert_bytes ! ( BindingAbstractClassCheck , 4 ) ;
123+ assert_bytes ! ( BindingClassSubscriptSymmetry , 4 ) ;
122124assert_words ! ( BindingClassField , 11 ) ;
123125assert_bytes ! ( BindingClassSynthesizedFields , 4 ) ;
124126assert_bytes ! ( BindingLegacyTypeParam , 16 ) ;
@@ -150,6 +152,7 @@ pub enum AnyIdx {
150152 KeyClassMetadata ( Idx < KeyClassMetadata > ) ,
151153 KeyClassMro ( Idx < KeyClassMro > ) ,
152154 KeyAbstractClassCheck ( Idx < KeyAbstractClassCheck > ) ,
155+ KeyClassSubscriptSymmetry ( Idx < KeyClassSubscriptSymmetry > ) ,
153156 KeyLegacyTypeParam ( Idx < KeyLegacyTypeParam > ) ,
154157 KeyYield ( Idx < KeyYield > ) ,
155158 KeyYieldFrom ( Idx < KeyYieldFrom > ) ,
@@ -225,6 +228,9 @@ macro_rules! dispatch_anyidx {
225228 AnyIdx :: KeyAbstractClassCheck ( idx) => {
226229 $self. $method:: <$crate:: binding:: binding:: KeyAbstractClassCheck >( * idx)
227230 }
231+ AnyIdx :: KeyClassSubscriptSymmetry ( idx) => {
232+ $self. $method:: <$crate:: binding:: binding:: KeyClassSubscriptSymmetry >( * idx)
233+ }
228234 AnyIdx :: KeyLegacyTypeParam ( idx) => {
229235 $self. $method:: <$crate:: binding:: binding:: KeyLegacyTypeParam >( * idx)
230236 }
@@ -295,6 +301,9 @@ macro_rules! dispatch_anyidx {
295301 AnyIdx :: KeyAbstractClassCheck ( idx) => {
296302 $self. $method:: <$crate:: binding:: binding:: KeyAbstractClassCheck >( * idx, $( $args) ,+)
297303 }
304+ AnyIdx :: KeyClassSubscriptSymmetry ( idx) => {
305+ $self. $method:: <$crate:: binding:: binding:: KeyClassSubscriptSymmetry >( * idx, $( $args) ,+)
306+ }
298307 AnyIdx :: KeyLegacyTypeParam ( idx) => {
299308 $self. $method:: <$crate:: binding:: binding:: KeyLegacyTypeParam >( * idx, $( $args) ,+)
300309 }
@@ -334,6 +343,7 @@ impl DisplayWith<Bindings> for AnyIdx {
334343 Self :: KeyClassMetadata ( idx) => write ! ( f, "{}" , ctx. display( * idx) ) ,
335344 Self :: KeyClassMro ( idx) => write ! ( f, "{}" , ctx. display( * idx) ) ,
336345 Self :: KeyAbstractClassCheck ( idx) => write ! ( f, "{}" , ctx. display( * idx) ) ,
346+ Self :: KeyClassSubscriptSymmetry ( idx) => write ! ( f, "{}" , ctx. display( * idx) ) ,
337347 Self :: KeyLegacyTypeParam ( idx) => write ! ( f, "{}" , ctx. display( * idx) ) ,
338348 Self :: KeyYield ( idx) => write ! ( f, "{}" , ctx. display( * idx) ) ,
339349 Self :: KeyYieldFrom ( idx) => write ! ( f, "{}" , ctx. display( * idx) ) ,
@@ -354,6 +364,7 @@ pub enum AnyExportedKey {
354364 KeyClassMetadata ( KeyClassMetadata ) ,
355365 KeyClassMro ( KeyClassMro ) ,
356366 KeyAbstractClassCheck ( KeyAbstractClassCheck ) ,
367+ KeyClassSubscriptSymmetry ( KeyClassSubscriptSymmetry ) ,
357368 KeyTypeAlias ( KeyTypeAlias ) ,
358369}
359370
@@ -741,6 +752,28 @@ impl Exported for KeyAbstractClassCheck {
741752 AnyExportedKey :: KeyAbstractClassCheck ( self . clone ( ) )
742753 }
743754}
755+ impl Keyed for KeyClassSubscriptSymmetry {
756+ const EXPORTED : bool = true ;
757+ type Value = BindingClassSubscriptSymmetry ;
758+ type Answer = bool ;
759+ fn to_anyidx ( idx : Idx < Self > ) -> AnyIdx {
760+ AnyIdx :: KeyClassSubscriptSymmetry ( idx)
761+ }
762+ fn range_with ( idx : Idx < Self > , bindings : & Bindings ) -> TextRange
763+ where
764+ BindingTable : TableKeyed < Self , Value = BindingEntry < Self > > ,
765+ {
766+ bindings. idx_to_key ( bindings. get ( idx) . class_idx ) . range ( )
767+ }
768+ fn try_to_anykey ( & self ) -> Option < AnyExportedKey > {
769+ Some ( AnyExportedKey :: KeyClassSubscriptSymmetry ( self . clone ( ) ) )
770+ }
771+ }
772+ impl Exported for KeyClassSubscriptSymmetry {
773+ fn to_anykey ( & self ) -> AnyExportedKey {
774+ AnyExportedKey :: KeyClassSubscriptSymmetry ( self . clone ( ) )
775+ }
776+ }
744777impl Keyed for KeyLegacyTypeParam {
745778 type Value = BindingLegacyTypeParam ;
746779 type Answer = LegacyTypeParameterLookup ;
@@ -1599,6 +1632,15 @@ impl DisplayWith<ModuleInfo> for KeyAbstractClassCheck {
15991632 }
16001633}
16011634
1635+ #[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
1636+ pub struct KeyClassSubscriptSymmetry ( pub ClassDefIndex ) ;
1637+
1638+ impl DisplayWith < ModuleInfo > for KeyClassSubscriptSymmetry {
1639+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > , _ctx : & ModuleInfo ) -> fmt:: Result {
1640+ write ! ( f, "KeyClassSubscriptSymmetry(class{})" , self . 0 )
1641+ }
1642+ }
1643+
16021644#[ derive( Clone , Debug , PartialEq , Eq , Hash ) ]
16031645pub struct KeyLegacyTypeParam ( pub ShortIdentifier ) ;
16041646
@@ -3118,6 +3160,21 @@ impl DisplayWith<Bindings> for BindingAbstractClassCheck {
31183160 }
31193161}
31203162
3163+ #[ derive( Clone , Debug ) ]
3164+ pub struct BindingClassSubscriptSymmetry {
3165+ pub class_idx : Idx < KeyClass > ,
3166+ }
3167+
3168+ impl DisplayWith < Bindings > for BindingClassSubscriptSymmetry {
3169+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > , ctx : & Bindings ) -> fmt:: Result {
3170+ write ! (
3171+ f,
3172+ "BindingClassSubscriptSymmetry({})" ,
3173+ ctx. display( self . class_idx)
3174+ )
3175+ }
3176+ }
3177+
31213178#[ derive( Clone , Debug ) ]
31223179/// A legacy type parameter (`T = typing.TypeVar("T")`).
31233180pub enum BindingLegacyTypeParam {
0 commit comments