Skip to content

Commit

Permalink
Define VersionNumber(::VersionNumber) (#816)
Browse files Browse the repository at this point in the history
  • Loading branch information
omus authored Jan 12, 2024
1 parent 8e59d92 commit a62d959
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 comments on commit a62d959

@omus
Copy link
Member Author

@omus omus commented on a62d959 Jan 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/98781

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v4.12.0 -m "<description of version>" a62d95906f3c16c9fa0fe8369a6613dcfd2a4659
git push origin v4.12.0

Please sign in to comment.