Skip to content

Commit

Permalink
Fix #91
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro3 committed Nov 23, 2019
1 parent 31d88d0 commit ed2a78f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,8 @@ function with_kw_nt(typedef, mod)
NT = gensym(:NamedTuple_kw)
nt = Expr(:tuple, nt...)
quote
$NT = (; $(kwargs...)) -> $nt
(::typeof($NT))($(args...)) = $nt
$NT(; $(kwargs...)) =$nt
$NT($(args...)) = $nt
$NT
end
end
Expand Down
10 changes: 10 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,13 @@ end

z2 = TestModule.test_function(TestModule.TestStruct(; y = 9.0))
@test z2.x == 1 && z2.y == 10.0

# issue 91
@testset "i91" begin
function foo()
a = @with_kw (x = 1, y = 2)
return a
end
@test foo()() == (x = 1, y = 2)
@test foo()(y=4) == (x = 1, y = 4)
end

0 comments on commit ed2a78f

Please sign in to comment.