Skip to content

Commit

Permalink
fix JuliaLang#45162, function arg not specialized if only called with…
Browse files Browse the repository at this point in the history
… keywords (JuliaLang#45198)
  • Loading branch information
JeffBezanson committed May 9, 2022
1 parent ff45fdc commit c62ea26
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3342,6 +3342,11 @@
(let ((vi (get tab (cadr e) #f)))
(if vi
(vinfo:set-called! vi #t))
;; calls to functions with keyword args go through `kwfunc` first
(if (and (length= e 3) (equal? (cadr e) '(core kwfunc)))
(let ((vi2 (get tab (caddr e) #f)))
(if vi2
(vinfo:set-called! vi2 #t))))
(for-each (lambda (x) (analyze-vars x env captvars sp tab))
(cdr e))))
((decl)
Expand Down
4 changes: 4 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3365,3 +3365,7 @@ struct InnerCtorRT{T}
end
@test_throws MethodError InnerCtorRT()
@test InnerCtorRT{Int}()() isa InnerCtorRT{Int}

# issue #45162
f45162(f) = f(x=1)
@test first(methods(f45162)).called != 0

0 comments on commit c62ea26

Please sign in to comment.