Skip to content

Commit

Permalink
Fix wrong deprecation message. Fixes #88
Browse files Browse the repository at this point in the history
  • Loading branch information
mauro3 committed Nov 19, 2018
1 parent dd301de commit 4098710
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ function with_kw(typedef, mod::Module, withshow=true)
esc($Parameters.$(_pack)(ex, $unpack_vars))
end
macro $pack_name_depr(ex)
Base.depwarn("The macro `@$($(Meta.quot(pack_name)))` is deprecated, use `@$($(Meta.quot(pack_name_depr)))`", $(QuoteNode(pack_name_depr)) )
Base.depwarn("The macro `@$($(Meta.quot(pack_name_depr)))` is deprecated, use `@$($(Meta.quot(pack_name)))`", $(QuoteNode(pack_name_depr)) )
esc($Parameters.$(_pack)(ex, $unpack_vars))
end
$tn
Expand Down
12 changes: 4 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Parameters, Test, Markdown
using Parameters, Test, Markdown, REPL

# misc
a8679 = @eval (a=1, b=2)
Expand Down Expand Up @@ -34,7 +34,6 @@ end
@test "Test documentation\n" == Markdown.plain(@doc MT1)
# https://github.com/JuliaLang/julia/issues/27092 means this does not work:
# @test "A field Default: sdaf\n" == Markdown.plain(@doc MT1.c)
using REPL
@test "Field r Default: 4\n" == Markdown.plain(REPL.fielddoc(MT1, :r))
@test "A field Default: sdaf\n" == Markdown.plain(REPL.fielddoc(MT1, :c))

Expand Down Expand Up @@ -138,8 +137,8 @@ abstract type AMT{R<:Real} end
r::R=5
a::I
end
@test_throws MethodError MT5(r=4, a=5.) # need to specify type parameters
MT5{Float32, Int}(r=4, a=5.)
@test_throws MethodError MT5(r=4, a=5.) # a has wrong type
MT5{Float32, Int}(r=4, a=5.) # a gets converted
MT5{Float32, Int}(a=5.)
MT5{Float32, Int}(5.4, 4) # inner positional
mt5=MT5(5.4, 4) # outer positional
Expand Down Expand Up @@ -367,10 +366,7 @@ end
@test_throws MethodError I10(a=10) # typeof(a)!=typeof(c)
a_ = I10(a="asd")
b_ = I10{String}("asd",10,"aaa")
for fn in fieldnames(typeof(a_))
# complicated testing because of mutable T
@test getfield(a_, fn)==getfield(b_, fn)
end
@test a_==b_

@with_kw struct I10a{T}
a::T
Expand Down

0 comments on commit 4098710

Please sign in to comment.