@@ -21,33 +21,40 @@ use ruff_python_ast::{self as ast, name::Name};
2121#[ derive( Clone , Debug , PartialEq , Eq , Hash , salsa:: Update ) ]
2222pub ( crate ) struct Signatures < ' db > {
2323 /// The type that is (hopefully) callable.
24- pub ( crate ) ty : Type < ' db > ,
24+ pub ( crate ) callable_type : Type < ' db > ,
2525 /// For an object that's callable via a `__call__` method, the type of that method. For an
2626 /// object that is directly callable, the type of the object.
27- pub ( crate ) signature_ty : Type < ' db > ,
27+ pub ( crate ) signature_type : Type < ' db > ,
2828 elements : Vec < CallableSignature < ' db > > ,
2929}
3030
3131impl < ' db > Signatures < ' db > {
32- pub ( crate ) fn not_callable ( ty : Type < ' db > , signature_ty : Type < ' db > ) -> Self {
32+ pub ( crate ) fn not_callable ( callable_type : Type < ' db > , signature_type : Type < ' db > ) -> Self {
3333 Self {
34- ty,
35- signature_ty,
36- elements : vec ! [ CallableSignature :: not_callable( ty, signature_ty) ] ,
34+ callable_type,
35+ signature_type,
36+ elements : vec ! [ CallableSignature :: not_callable(
37+ callable_type,
38+ signature_type,
39+ ) ] ,
3740 }
3841 }
3942
4043 pub ( crate ) fn single ( signature : CallableSignature < ' db > ) -> Self {
4144 Self {
42- ty : signature. ty ,
43- signature_ty : signature. signature_ty ,
45+ callable_type : signature. callable_type ,
46+ signature_type : signature. signature_type ,
4447 elements : vec ! [ signature] ,
4548 }
4649 }
4750
4851 /// Creates a new `Signatures` from an iterator of [`Signature`]s. Panics if the iterator is
4952 /// empty.
50- pub ( crate ) fn from_union < I > ( ty : Type < ' db > , signature_ty : Type < ' db > , elements : I ) -> Self
53+ pub ( crate ) fn from_union < I > (
54+ callable_type : Type < ' db > ,
55+ signature_type : Type < ' db > ,
56+ elements : I ,
57+ ) -> Self
5158 where
5259 I : IntoIterator < Item = & ' db Signatures < ' db > > ,
5360 {
@@ -56,8 +63,8 @@ impl<'db> Signatures<'db> {
5663 . flat_map ( |s| s. elements . iter ( ) . cloned ( ) )
5764 . collect ( ) ;
5865 Self {
59- ty ,
60- signature_ty ,
66+ callable_type ,
67+ signature_type ,
6168 elements,
6269 }
6370 }
@@ -85,11 +92,11 @@ impl<'db> Signatures<'db> {
8592#[ derive( Clone , Debug , PartialEq , Eq , Hash , salsa:: Update ) ]
8693pub ( crate ) struct CallableSignature < ' db > {
8794 /// The type that is (hopefully) callable.
88- pub ( crate ) ty : Type < ' db > ,
95+ pub ( crate ) callable_type : Type < ' db > ,
8996
9097 /// For an object that's callable via a `__call__` method, the type of that method. For an
9198 /// object that is directly callable, the type of the object.
92- pub ( crate ) signature_ty : Type < ' db > ,
99+ pub ( crate ) signature_type : Type < ' db > ,
93100
94101 /// If this is a callable object (i.e. called via a `__call__` method), the boundness of
95102 /// that call method.
@@ -102,62 +109,66 @@ pub(crate) struct CallableSignature<'db> {
102109}
103110
104111impl < ' db > CallableSignature < ' db > {
105- pub ( crate ) fn not_callable ( ty : Type < ' db > , signature_ty : Type < ' db > ) -> Self {
112+ pub ( crate ) fn not_callable ( callable_type : Type < ' db > , signature_type : Type < ' db > ) -> Self {
106113 Self {
107- ty ,
108- signature_ty ,
114+ callable_type ,
115+ signature_type ,
109116 dunder_call_boundness : None ,
110117 bound_type : None ,
111118 overloads : vec ! [ ] ,
112119 }
113120 }
114121
115122 pub ( crate ) fn single (
116- ty : Type < ' db > ,
117- signature_ty : Type < ' db > ,
123+ callable_type : Type < ' db > ,
124+ signature_type : Type < ' db > ,
118125 signature : Signature < ' db > ,
119126 ) -> Self {
120127 Self {
121- ty ,
122- signature_ty ,
128+ callable_type ,
129+ signature_type ,
123130 dunder_call_boundness : None ,
124131 bound_type : None ,
125132 overloads : vec ! [ signature] ,
126133 }
127134 }
128135
129136 /// Creates a new `CallableSignature` from a non-empty iterator of [`Signature`]s.
130- pub ( crate ) fn from_overloads < I > ( ty : Type < ' db > , signature_ty : Type < ' db > , overloads : I ) -> Self
137+ pub ( crate ) fn from_overloads < I > (
138+ callable_type : Type < ' db > ,
139+ signature_type : Type < ' db > ,
140+ overloads : I ,
141+ ) -> Self
131142 where
132143 I : IntoIterator < Item = Signature < ' db > > ,
133144 {
134145 Self {
135- ty ,
136- signature_ty ,
146+ callable_type ,
147+ signature_type ,
137148 dunder_call_boundness : None ,
138149 bound_type : None ,
139150 overloads : overloads. into_iter ( ) . collect ( ) ,
140151 }
141152 }
142153
143154 /// Return a signature for a dynamic callable
144- pub ( crate ) fn dynamic ( ty : Type < ' db > ) -> Self {
155+ pub ( crate ) fn dynamic ( callable_type : Type < ' db > ) -> Self {
145156 let signature = Signature {
146157 parameters : Parameters :: gradual_form ( ) ,
147- return_ty : Some ( ty ) ,
158+ return_ty : Some ( callable_type ) ,
148159 } ;
149- Self :: single ( ty , ty , signature)
160+ Self :: single ( callable_type , callable_type , signature)
150161 }
151162
152163 /// Return a todo signature: (*args: Todo, **kwargs: Todo) -> Todo
153164 #[ allow( unused_variables) ] // 'reason' only unused in debug builds
154165 pub ( crate ) fn todo ( reason : & ' static str ) -> Self {
155- let ty = todo_type ! ( reason) ;
166+ let callable_type = todo_type ! ( reason) ;
156167 let signature = Signature {
157168 parameters : Parameters :: todo ( ) ,
158- return_ty : Some ( ty ) ,
169+ return_ty : Some ( callable_type ) ,
159170 } ;
160- Self :: single ( ty , ty , signature)
171+ Self :: single ( callable_type , callable_type , signature)
161172 }
162173
163174 /// Returns the [`Signature`] if this is a non-overloaded callable, [None] otherwise.
0 commit comments