From 477fd0a1d9e30202ec4a34a8177bdbc469c5df67 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Thu, 11 Jan 2024 15:34:48 -0600 Subject: [PATCH] Define `VersionNumber(::VersionNumber)` --- Project.toml | 2 +- README.md | 3 +++ src/Compat.jl | 5 +++++ test/runtests.jl | 6 ++++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index fdb0ead33..96ae2400a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "Compat" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.11.0" +version = "4.12.0" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/README.md b/README.md index 17ce22b9d..126df2a8c 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,8 @@ changes in `julia`. * `pkgversion(m::Module)` returns the version of the package that loaded a given module ([#45607]) (since Compat 4.11) +* `VersionNumber(::VersionNumber)` defined as a no-op constructor ([#45052]) (since Compat 4.12) + ## Developer tips One of the most important rules for `Compat.jl` is to avoid breaking user code @@ -172,6 +174,7 @@ Note that you should specify the correct minimum version for `Compat` in the [#43334]: https://github.com/JuliaLang/julia/issues/43334 [#43354]: https://github.com/JuliaLang/julia/issues/43354 [#43852]: https://github.com/JuliaLang/julia/issues/43852 +[#45052]: https://github.com/JuliaLang/julia/issues/45052 [#45607]: https://github.com/JuliaLang/julia/issues/45607 [#46104]: https://github.com/JuliaLang/julia/issues/46104 [#48038]: https://github.com/JuliaLang/julia/issues/48038 diff --git a/src/Compat.jl b/src/Compat.jl index 751355a1f..c8bb90f24 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -770,6 +770,11 @@ if VERSION < v"1.7.0-DEV.1187" export redirect_stdio end +# https://github.com/JuliaLang/julia/pull/45052 +if VERSION < v"1.9.0-DEV.461" + Base.VersionNumber(v::VersionNumber) = v +end + include("deprecated.jl") end # module Compat diff --git a/test/runtests.jl b/test/runtests.jl index 2268b610c..2b6e95ceb 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -728,3 +728,9 @@ end @test_throws LoadError @eval @compat public @bar foo @test_throws LoadError @eval @compat publac @bar, foo end + +# https://github.com/JuliaLang/julia/pull/45052 +@testset "VersionNumber no-op constructor" begin + v = VersionNumber("1.2.3") + @test VersionNumber(v) === v +end