diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index cd11f46b1eb38..eb79dfc52f76c 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -555,7 +555,7 @@ name positional-sparams `((|::| ;; if there are optional positional args, we need to be able to reference the function name - ,(if (any kwarg? pargl) (gensy) UNUSED) + ,(if (any kwarg? `(,@pargl ,@vararg)) (gensy) UNUSED) (call (core kwftype) ,ftype)) ,kwdecl ,@pargl ,@vararg) `(block ;; propagate method metadata to keyword sorter diff --git a/test/keywordargs.jl b/test/keywordargs.jl index 0aed0544b7e2e..43013ab1d721e 100644 --- a/test/keywordargs.jl +++ b/test/keywordargs.jl @@ -394,3 +394,9 @@ let m = first(methods(Core.kwcall, (NamedTuple,typeof(kwf1),Vararg))) @test Core.kwcall(1) == "hi 1" @test which(Core.kwcall, (Int,)).name === :kwcall end + +# issue #50518 +function f50518(xs...=["a", "b", "c"]...; debug=false) + return xs[1] +end +@test f50518() == f50518(;debug=false) == "a"