@@ -191,7 +191,7 @@ function which(f::Callable, t::(Type...))
191
191
throw (ErrorException (" not a generic function, no methods available" ))
192
192
end
193
193
ms = methods (f, t)
194
- isempty (ms) && throw ( MethodError (f, t) )
194
+ isempty (ms) && error ( " no method found for the specified argument types " )
195
195
ms[1 ]
196
196
end
197
197
@@ -203,11 +203,11 @@ function gen_call_with_extracted_types(fcn, ex0)
203
203
# keyword args not used in dispatch, so just remove them
204
204
args = filter (a-> ! (Meta. isexpr (a, :kw ) || Meta. isexpr (a, :parameters )), ex0. args)
205
205
return Expr (:call , fcn, esc (args[1 ]),
206
- Expr (:call , :typesof , map (esc, args[2 : end ])... ))
206
+ Expr (:call , :typesof , map (esc, args[2 : end ])... ))
207
207
end
208
208
if isa (ex0, Expr) && ex0. head == :call
209
209
return Expr (:call , fcn, esc (ex0. args[1 ]),
210
- Expr (:call , :typesof , map (esc, ex0. args[2 : end ])... ))
210
+ Expr (:call , :typesof , map (esc, ex0. args[2 : end ])... ))
211
211
end
212
212
ex = expand (ex0)
213
213
exret = Expr (:call , :error , " expression is not a function call" )
@@ -221,15 +221,15 @@ function gen_call_with_extracted_types(fcn, ex0)
221
221
Expr (:call , :typesof , map (esc, ex. args[3 : end ])... ))
222
222
else
223
223
exret = Expr (:call , fcn, esc (ex. args[1 ]),
224
- Expr (:call , :typesof , map (esc, ex. args[2 : end ])... ))
224
+ Expr (:call , :typesof , map (esc, ex. args[2 : end ])... ))
225
225
end
226
226
elseif ex. head == :body
227
227
a1 = ex. args[1 ]
228
228
if isa (a1, Expr) && a1. head == :call
229
229
a11 = a1. args[1 ]
230
230
if a11 == :setindex!
231
231
exret = Expr (:call , fcn, a11,
232
- Expr (:call , :typesof , map (esc, a1. args[2 : end ])... ))
232
+ Expr (:call , :typesof , map (esc, a1. args[2 : end ])... ))
233
233
end
234
234
end
235
235
elseif ex. head == :thunk
243
243
for fname in [:which , :less , :edit , :code_typed , :code_lowered , :code_llvm , :code_native ]
244
244
@eval begin
245
245
macro ($ fname)(ex0)
246
- gen_call_with_extracted_types ($ fname, ex0)
246
+ gen_call_with_extracted_types ($ ( Expr ( :quote , fname)) , ex0)
247
247
end
248
248
end
249
249
end
0 commit comments