Skip to content

Commit

Permalink
fix #18845, call with 0 keyword args splatted after ;
Browse files Browse the repository at this point in the history
(cherry picked from commit 04b4970)
ref #18865
  • Loading branch information
JeffBezanson authored and tkelman committed Feb 22, 2017
1 parent 8accd2a commit 81b201a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,11 @@
(expand-forms
(receive
(kws args) (separate kwarg? (cdddr e))
(lower-kw-call f (append kws (cdr (caddr e))) args))))
(let ((kws (append kws (cdr (caddr e)))))
(if (null? kws)
;; empty parameters block; issue #18845
`(call ,f ,@args)
(lower-kw-call f kws args))))))
((any kwarg? (cddr e))
;; (call f ... (kw a b) ...)
(expand-forms
Expand Down
6 changes: 6 additions & 0 deletions test/keywordargs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ extravagant_args(x,y=0,rest...;color="blue",kw...) =

# passing empty kw container to function with no kwargs
@test sin(1.0) == sin(1.0; Dict()...)
# issue #18845
@test (@eval sin(1.0; $([]...))) == sin(1.0)
f18845() = 2
@test f18845(;) == 2
@test f18845(; []...) == 2
@test (@eval f18845(; $([]...))) == 2

# passing junk kw container
@test_throws BoundsError extravagant_args(1; Any[[]]...)
Expand Down

0 comments on commit 81b201a

Please sign in to comment.