From 9f26ca13446e171f425acb09de3f83a42e0fc798 Mon Sep 17 00:00:00 2001 From: Abel Soares Siqueira Date: Wed, 8 Apr 2020 22:47:24 -0300 Subject: [PATCH] Deprecation warning on keywords mem of LBFGS operators --- Project.toml | 2 +- src/LinearOperators.jl | 2 ++ src/deprecated.jl | 8 ++++++++ test/runtests.jl | 1 + test/test_deprecated.jl | 15 +++++++++++++++ 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 src/deprecated.jl create mode 100644 test/test_deprecated.jl diff --git a/Project.toml b/Project.toml index bce3c7fa..5f189699 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "LinearOperators" uuid = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125" -version = "1.0.1" +version = "1.1.0" [deps] FastClosures = "9aa1b823-49e4-5ca5-8b0f-3971ec8bab6a" diff --git a/src/LinearOperators.jl b/src/LinearOperators.jl index eaad798f..777abeea 100644 --- a/src/LinearOperators.jl +++ b/src/LinearOperators.jl @@ -24,4 +24,6 @@ include("TimedOperators.jl") # Utilities include("utilities.jl") +include("deprecated.jl") + end # module diff --git a/src/deprecated.jl b/src/deprecated.jl new file mode 100644 index 00000000..990164e7 --- /dev/null +++ b/src/deprecated.jl @@ -0,0 +1,8 @@ +# Deprecated use of positional argument mem +@deprecate LBFGSOperator(T :: DataType, n :: Int, mem :: Int; kwargs...) LBFGSOperator(T, n; mem=mem, kwargs...) false +@deprecate LBFGSOperator(n :: Int, mem :: Int; kwargs...) LBFGSOperator(n; mem=mem, kwargs...) false +@deprecate InverseLBFGSOperator(T :: DataType, n :: Int, mem :: Int; kwargs...) InverseLBFGSOperator(T, n; mem=mem, kwargs...) false +@deprecate InverseLBFGSOperator(n :: Int, mem :: Int; kwargs...) InverseLBFGSOperator(n; mem=mem, kwargs...) false +@deprecate LSR1Operator(T :: DataType, n :: Int, mem :: Int; kwargs...) LSR1Operator(T, n; mem=mem, kwargs...) false +@deprecate LSR1Operator(n :: Int, mem :: Int; kwargs...) LSR1Operator(n; mem=mem, kwargs...) false + diff --git a/test/runtests.jl b/test/runtests.jl index 24e7aaa8..5e8b784a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,3 +9,4 @@ include("test_lbfgs.jl") include("test_lsr1.jl") include("test_kron.jl") include("test_callable.jl") +include("test_deprecated.jl") diff --git a/test/test_deprecated.jl b/test/test_deprecated.jl new file mode 100644 index 00000000..82227134 --- /dev/null +++ b/test/test_deprecated.jl @@ -0,0 +1,15 @@ +function test_deprecated() + @testset ExtendedTestSet "Deprecated methods" begin + n = 10 + mem = 3 + T = Float16 + @test_deprecated LBFGSOperator(n, mem, scaling=false) + @test_deprecated InverseLBFGSOperator(n, mem, scaling=false) + @test_deprecated LBFGSOperator(T, n, mem, scaling=false) + @test_deprecated InverseLBFGSOperator(T, n, mem, scaling=false) + @test_deprecated LSR1Operator(n, mem, scaling=false) + @test_deprecated LSR1Operator(T, n, mem, scaling=false) + end +end + +test_deprecated()