Skip to content

Commit 8fc68fe

Browse files
committed
Pair API: allow any type of Pair
Do not restrict the first argument to be a `DataType`/`UnionAll`, as `make` is about to start accepting non-type objects as first argument.
1 parent b30afaa commit 8fc68fe

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/sampling.jl

+4-6
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,10 @@ pair_to_make((a, b)::Pair) =
574574

575575
pair_to_make(x) = x
576576

577-
@inline Sampler(RNG::Type{<:AbstractRNG}, p::Pair{<:Union{DataType,UnionAll}},
578-
r::Repetition) =
579-
Sampler(RNG, pair_to_make(p), r)
577+
@inline Sampler(RNG::Type{<:AbstractRNG}, p::Pair, r::Repetition) =
578+
Sampler(RNG, pair_to_make(p), r)
580579

581580
# nothing can be inferred when only the pair type is available
582-
@inline gentype(::Type{<:Pair{<:Union{DataType,UnionAll}}}) = Any
581+
@inline gentype(::Type{<:Pair}) = Any
583582

584-
@inline gentype(p::Pair{<:Union{DataType,UnionAll}}) =
585-
gentype(pair_to_make(p))
583+
@inline gentype(p::Pair) = gentype(pair_to_make(p))

0 commit comments

Comments
 (0)