diff --git a/base/error.jl b/base/error.jl index 7e2578719dbbc4..2bfee47b0a237c 100644 --- a/base/error.jl +++ b/base/error.jl @@ -27,7 +27,7 @@ backtrace() = ccall(:jl_backtrace_from_here, Array{Ptr{Void},1}, (Int32,), false catch_backtrace() = ccall(:jl_get_backtrace, Array{Ptr{Void},1}, ()) ## keyword arg lowering generates calls to this ## -kwerr(kw) = error("unrecognized keyword argument \"", kw, "\"") +kwerr(kw, args...) = throw(MethodError(typeof(args[1]).name.mt.kwsorter, (kw,args...))) ## system error handling ## diff --git a/src/julia-syntax.scm b/src/julia-syntax.scm index 0e74e5924d98f0..c6c689b841f0fb 100644 --- a/src/julia-syntax.scm +++ b/src/julia-syntax.scm @@ -493,7 +493,8 @@ ,else))) (if (null? restkw) ;; if no rest kw, give error for unrecognized - `(call (top kwerr) ,elt) + `(call (top kwerr) ,kw ,@(map arg-name pargl),@(if (null? vararg) '() + (list `(... ,(arg-name (car vararg)))))) ;; otherwise add to rest keywords `(ccall 'jl_cell_1d_push Void (tuple Any Any) ,rkw (tuple ,elt