@@ -8,6 +8,7 @@ use super::{
8
8
} ;
9
9
use crate :: {
10
10
asg:: { self , Callee , TypeKind , TypedExpr } ,
11
+ ast:: TypeArg ,
11
12
name:: { Name , ResolvedName } ,
12
13
resolve:: conform:: Perform ,
13
14
source_files:: Source ,
@@ -42,14 +43,15 @@ impl FuncHaystack {
42
43
& self ,
43
44
ctx : & ResolveExprCtx ,
44
45
name : & Name ,
46
+ generics : & [ TypeArg ] ,
45
47
arguments : & [ TypedExpr ] ,
46
48
source : Source ,
47
49
) -> Result < Callee , FindFunctionError > {
48
50
let resolved_name = ResolvedName :: new ( self . fs_node_id , name) ;
49
51
50
- self . find_local ( ctx, & resolved_name, arguments, source)
51
- . or_else ( || self . find_remote ( ctx, & name, arguments, source) )
52
- . or_else ( || self . find_imported ( ctx, & name, arguments, source) )
52
+ self . find_local ( ctx, & resolved_name, generics , arguments, source)
53
+ . or_else ( || self . find_remote ( ctx, & name, generics , arguments, source) )
54
+ . or_else ( || self . find_imported ( ctx, & name, generics , arguments, source) )
53
55
. unwrap_or ( Err ( FindFunctionError :: NotDefined ) )
54
56
}
55
57
@@ -95,6 +97,7 @@ impl FuncHaystack {
95
97
pub fn fits (
96
98
ctx : & ResolveExprCtx ,
97
99
func_ref : asg:: FuncRef ,
100
+ generics : & [ TypeArg ] ,
98
101
args : & [ TypedExpr ] ,
99
102
existing_catalog : Option < PolyCatalog > ,
100
103
source : Source ,
@@ -104,6 +107,10 @@ impl FuncHaystack {
104
107
105
108
let mut catalog = existing_catalog. unwrap_or_default ( ) ;
106
109
110
+ if generics. len ( ) != 0 {
111
+ todo ! ( "FuncHaystack::fits does not support specified generics yet" ) ;
112
+ }
113
+
107
114
if !params. is_cstyle_vararg && args. len ( ) != params. required . len ( ) {
108
115
return None ;
109
116
}
@@ -167,6 +174,7 @@ impl FuncHaystack {
167
174
& self ,
168
175
ctx : & ResolveExprCtx ,
169
176
resolved_name : & ResolvedName ,
177
+ generics : & [ TypeArg ] ,
170
178
arguments : & [ TypedExpr ] ,
171
179
source : Source ,
172
180
) -> Option < Result < Callee , FindFunctionError > > {
@@ -175,7 +183,7 @@ impl FuncHaystack {
175
183
. get ( & resolved_name)
176
184
. into_iter ( )
177
185
. flatten ( )
178
- . flat_map ( |f| Self :: fits ( ctx, * f, arguments, None , source) ) ;
186
+ . flat_map ( |f| Self :: fits ( ctx, * f, generics , arguments, None , source) ) ;
179
187
180
188
local_matches. next ( ) . map ( |found| {
181
189
if local_matches. next ( ) . is_some ( ) {
@@ -190,6 +198,7 @@ impl FuncHaystack {
190
198
& self ,
191
199
ctx : & ResolveExprCtx ,
192
200
name : & Name ,
201
+ generics : & [ TypeArg ] ,
193
202
arguments : & [ TypedExpr ] ,
194
203
source : Source ,
195
204
) -> Option < Result < Callee , FindFunctionError > > {
@@ -211,7 +220,7 @@ impl FuncHaystack {
211
220
. into_iter ( )
212
221
} )
213
222
. flatten ( )
214
- . flat_map ( |f| Self :: fits ( ctx, * f, arguments, None , source) ) ;
223
+ . flat_map ( |f| Self :: fits ( ctx, * f, generics , arguments, None , source) ) ;
215
224
216
225
remote_matches. next ( ) . map ( |found| {
217
226
if remote_matches. next ( ) . is_some ( ) {
@@ -226,6 +235,7 @@ impl FuncHaystack {
226
235
& self ,
227
236
ctx : & ResolveExprCtx ,
228
237
name : & Name ,
238
+ generics : & [ TypeArg ] ,
229
239
arguments : & [ TypedExpr ] ,
230
240
source : Source ,
231
241
) -> Option < Result < Callee , FindFunctionError > > {
@@ -281,7 +291,7 @@ impl FuncHaystack {
281
291
. into_iter ( )
282
292
. flatten ( )
283
293
} )
284
- . flat_map ( |f| Self :: fits ( ctx, * f, arguments, None , source) ) ;
294
+ . flat_map ( |f| Self :: fits ( ctx, * f, generics , arguments, None , source) ) ;
285
295
286
296
matches. next ( ) . map ( |found| {
287
297
if matches. next ( ) . is_some ( ) {
0 commit comments