diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 489699536efe4..24f29061ac4f9 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -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 diff --git a/test/keywordargs.jl b/test/keywordargs.jl index aa58b0aa487fc..d3dc9a55a3738 100644 --- a/test/keywordargs.jl +++ b/test/keywordargs.jl @@ -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[[]]...)