Skip to content

Commit

Permalink
reject unsupported kwargs early (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
MasonProtter authored Feb 6, 2024
1 parent a23231e commit 4ffd305
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/implementation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ function tmapreduce(f, op, Arrs...;
schedule::Symbol=:dynamic,
outputtype::Type=Any,
mapreduce_kwargs...)

min_kwarg_len = haskey(mapreduce_kwargs, :init) ? 1 : 0
if length(mapreduce_kwargs) > min_kwarg_len
tmapreduce_kwargs_err(;mapreduce_kwargs...)
end
if schedule === :dynamic
_tmapreduce(f, op, Arrs, outputtype, nchunks, split, :default, mapreduce_kwargs)
elseif schedule === :interactive
Expand All @@ -29,6 +34,10 @@ function tmapreduce(f, op, Arrs...;
end
@noinline schedule_err(s) = error(ArgumentError("Invalid schedule option: $s, expected :dynamic, :interactive, :greedy, or :static."))

@noinline function tmapreduce_kwargs_err(;init=nothing, kwargs...)
error("got unsupported keyword arguments: $((;kwargs...,)) ")
end

treducemap(op, f, A...; kwargs...) = tmapreduce(f, op, A...; kwargs...)

function _tmapreduce(f, op, Arrs, ::Type{OutputType}, nchunks, split, threadpool, mapreduce_kwargs)::OutputType where {OutputType}
Expand Down

0 comments on commit 4ffd305

Please sign in to comment.