Skip to content

Commit

Permalink
Merge pull request #18865 from JuliaLang/jb/fix18845
Browse files Browse the repository at this point in the history
fix #18845, call with 0 keyword args splatted after `;`
  • Loading branch information
JeffBezanson authored Oct 10, 2016
2 parents b8f98a0 + 04b4970 commit 214db15
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 @@ -1924,7 +1924,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 214db15

Please sign in to comment.