Skip to content

Commit df9ba04

Browse files
committed
update macro
1 parent 2a32681 commit df9ba04

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/macros.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ function _measure(expr)
4747
par :: NamedTuple{N,T}
4848
end
4949

50-
(::Type{$μ{N}})(nt::NamedTuple{N,T}) where {N,T} = $μ{N,T}(nt)
50+
KeywordCalls._kwstruct(:($μ($(p...))))
5151

5252
(::Type{$μ})() where {N,T} = $μ(NamedTuple())
5353
end
5454

5555
if !isempty(p)
5656
# e.g. Normal(μ,σ) = Normal(;μ=μ, σ=σ)
57-
# Requires Julia 1.5
58-
push!(q.args, :($μ($(p...)) = $μ(;$(p...))))
57+
pnames = QuoteNode.(p)
58+
push!(q.args, :($μ($(p...)) = $μ(NamedTuple($(p...)))))
5959
end
6060

6161
return q

0 commit comments

Comments
 (0)