@@ -41,7 +41,7 @@ use crate::types::{
4141 determine_upper_bound,
4242} ;
4343use crate :: {
44- Db , FxIndexMap , FxIndexSet , FxOrderSet , Program ,
44+ Db , FxOrderMap , FxOrderSet , Program ,
4545 module_resolver:: file_to_module,
4646 place:: {
4747 Definedness , LookupError , LookupResult , Place , PlaceAndQualifiers , known_module_symbol,
@@ -59,8 +59,8 @@ use crate::{
5959 definition_expression_type,
6060 } ,
6161} ;
62- use indexmap:: IndexSet ;
6362use itertools:: Itertools as _;
63+ use ordermap:: OrderSet ;
6464use ruff_db:: diagnostic:: Span ;
6565use ruff_db:: files:: File ;
6666use ruff_db:: parsed:: { ParsedModuleRef , parsed_module} ;
@@ -158,8 +158,8 @@ fn fields_cycle_initial<'db>(
158158 _self : ClassLiteral < ' db > ,
159159 _specialization : Option < Specialization < ' db > > ,
160160 _field_policy : CodeGeneratorKind < ' db > ,
161- ) -> FxIndexMap < Name , Field < ' db > > {
162- FxIndexMap :: default ( )
161+ ) -> FxOrderMap < Name , Field < ' db > > {
162+ FxOrderMap :: default ( )
163163}
164164
165165/// A category of classes with code generation capabilities (with synthesized methods).
@@ -875,8 +875,8 @@ impl<'db> ClassType<'db> {
875875 specialization
876876 . and_then ( |spec| spec. tuple ( db) )
877877 . map ( |tuple| {
878- let mut element_type_to_indices: FxIndexMap < Type < ' db > , Vec < i64 > > =
879- FxIndexMap :: default ( ) ;
878+ let mut element_type_to_indices: FxOrderMap < Type < ' db > , Vec < i64 > > =
879+ FxOrderMap :: default ( ) ;
880880
881881 match tuple {
882882 // E.g. for `tuple[int, str]`, we will generate the following overloads:
@@ -1578,10 +1578,10 @@ impl<'db> ClassLiteral<'db> {
15781578 pub ( crate ) fn typevars_referenced_in_definition (
15791579 self ,
15801580 db : & ' db dyn Db ,
1581- ) -> FxIndexSet < BoundTypeVarInstance < ' db > > {
1581+ ) -> FxOrderSet < BoundTypeVarInstance < ' db > > {
15821582 #[ derive( Default ) ]
15831583 struct CollectTypeVars < ' db > {
1584- typevars : RefCell < FxIndexSet < BoundTypeVarInstance < ' db > > > ,
1584+ typevars : RefCell < FxOrderSet < BoundTypeVarInstance < ' db > > > ,
15851585 recursion_guard : TypeCollector < ' db > ,
15861586 }
15871587
@@ -3004,7 +3004,7 @@ impl<'db> ClassLiteral<'db> {
30043004 db : & ' db dyn Db ,
30053005 specialization : Option < Specialization < ' db > > ,
30063006 field_policy : CodeGeneratorKind < ' db > ,
3007- ) -> FxIndexMap < Name , Field < ' db > > {
3007+ ) -> FxOrderMap < Name , Field < ' db > > {
30083008 if field_policy == CodeGeneratorKind :: NamedTuple {
30093009 // NamedTuples do not allow multiple inheritance, so it is sufficient to enumerate the
30103010 // fields of this class only.
@@ -3052,8 +3052,8 @@ impl<'db> ClassLiteral<'db> {
30523052 db : & ' db dyn Db ,
30533053 specialization : Option < Specialization < ' db > > ,
30543054 field_policy : CodeGeneratorKind ,
3055- ) -> FxIndexMap < Name , Field < ' db > > {
3056- let mut attributes = FxIndexMap :: default ( ) ;
3055+ ) -> FxOrderMap < Name , Field < ' db > > {
3056+ let mut attributes = FxOrderMap :: default ( ) ;
30573057
30583058 let class_body_scope = self . body_scope ( db) ;
30593059 let table = place_table ( db, class_body_scope) ;
@@ -3748,8 +3748,8 @@ impl<'db> ClassLiteral<'db> {
37483748 fn is_cyclically_defined_recursive < ' db > (
37493749 db : & ' db dyn Db ,
37503750 class : ClassLiteral < ' db > ,
3751- classes_on_stack : & mut IndexSet < ClassLiteral < ' db > > ,
3752- visited_classes : & mut IndexSet < ClassLiteral < ' db > > ,
3751+ classes_on_stack : & mut OrderSet < ClassLiteral < ' db > > ,
3752+ visited_classes : & mut OrderSet < ClassLiteral < ' db > > ,
37533753 ) -> bool {
37543754 let mut result = false ;
37553755 for explicit_base in class. explicit_bases ( db) {
@@ -3778,8 +3778,8 @@ impl<'db> ClassLiteral<'db> {
37783778
37793779 tracing:: trace!( "Class::inheritance_cycle: {}" , self . name( db) ) ;
37803780
3781- let visited_classes = & mut IndexSet :: new ( ) ;
3782- if !is_cyclically_defined_recursive ( db, self , & mut IndexSet :: new ( ) , visited_classes) {
3781+ let visited_classes = & mut OrderSet :: new ( ) ;
3782+ if !is_cyclically_defined_recursive ( db, self , & mut OrderSet :: new ( ) , visited_classes) {
37833783 None
37843784 } else if visited_classes. contains ( & self ) {
37853785 Some ( InheritanceCycle :: Participant )
0 commit comments