Skip to content

Commit a62d959

Browse files
authored
Define VersionNumber(::VersionNumber) (#816)
1 parent 8e59d92 commit a62d959

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Compat"
22
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
3-
version = "4.11.0"
3+
version = "4.12.0"
44

55
[deps]
66
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ changes in `julia`.
120120

121121
* `pkgversion(m::Module)` returns the version of the package that loaded a given module ([#45607]) (since Compat 4.11)
122122

123+
* `VersionNumber(::VersionNumber)` defined as a no-op constructor ([#45052]) (since Compat 4.12)
124+
123125
## Developer tips
124126

125127
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
172174
[#43334]: https://github.com/JuliaLang/julia/issues/43334
173175
[#43354]: https://github.com/JuliaLang/julia/issues/43354
174176
[#43852]: https://github.com/JuliaLang/julia/issues/43852
177+
[#45052]: https://github.com/JuliaLang/julia/issues/45052
175178
[#45607]: https://github.com/JuliaLang/julia/issues/45607
176179
[#46104]: https://github.com/JuliaLang/julia/issues/46104
177180
[#48038]: https://github.com/JuliaLang/julia/issues/48038

src/Compat.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,11 @@ if VERSION < v"1.7.0-DEV.1187"
770770
export redirect_stdio
771771
end
772772

773+
# https://github.com/JuliaLang/julia/pull/45052
774+
if VERSION < v"1.9.0-DEV.461"
775+
Base.VersionNumber(v::VersionNumber) = v
776+
end
777+
773778
include("deprecated.jl")
774779

775780
end # module Compat

test/runtests.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,3 +728,9 @@ end
728728
@test_throws LoadError @eval @compat public @bar foo
729729
@test_throws LoadError @eval @compat publac @bar, foo
730730
end
731+
732+
# https://github.com/JuliaLang/julia/pull/45052
733+
@testset "VersionNumber no-op constructor" begin
734+
v = VersionNumber("1.2.3")
735+
@test VersionNumber(v) === v
736+
end

0 commit comments

Comments
 (0)