Skip to content

Commit 7ad3ef3

Browse files
authored
Merge pull request #300 from julia-vscode/check-call-fix
fix check call for a binding::Function without methods
2 parents 2600e31 + 784de47 commit 7ad3ef3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/linting/checks.jl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,21 @@ function sig_match_any(func_ref::Binding, x, call_counts, tls::Scope, env::Exter
301301
match = sig_match_any(func_ref.val, x, call_counts, tls, env)
302302
match && return true
303303
end
304+
305+
has_at_least_one_method = func_ref.val isa EXPR && defines_function(func_ref.val)
306+
# handle case where func_ref is typed as Function and yet has no methods
307+
304308
for r in func_ref.refs
305309
method = get_method(r)
306310
method === nothing && continue
311+
has_at_least_one_method = true
307312
sig_match_any(method, x, call_counts, tls, env) && return true
308313
end
309-
310-
return false
314+
if has_at_least_one_method
315+
return false
316+
else
317+
return true
318+
end
311319
end
312320

313321
function sig_match_any(func::EXPR, x, call_counts, tls::Scope, env::ExternalEnv)

0 commit comments

Comments
 (0)