Skip to content

Commit

Permalink
Document the fields of VersionNumber (#50179)
Browse files Browse the repository at this point in the history
`VersionNumber`'s fields are currently not documented, and therefore,
private by default.
However, if people want to use `VersionNumber` for anything other than
the documented comparison operations, users will have to access the
fields.
  • Loading branch information
jakobnissen authored Nov 2, 2023
1 parent 55e5ee3 commit dabb93a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions base/version.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ alphanumeric annotations.
`VersionNumber` objects can be compared with all of the standard comparison
operators (`==`, `<`, `<=`, etc.), with the result following semver rules.
`VersionNumber` has the the following public fields:
- `v.major::Integer`
- `v.minor::Integer`
- `v.patch::Integer`
- `v.prerelease::Tuple{Vararg{Union{Integer, AbstractString}}}`
- `v.build::Tuple{Vararg{Union{Integer, AbstractString}}}`
See also [`@v_str`](@ref) to efficiently construct `VersionNumber` objects
from semver-format literal strings, [`VERSION`](@ref) for the `VersionNumber`
of Julia itself, and [Version Number Literals](@ref man-version-number-literals)
Expand Down
9 changes: 9 additions & 0 deletions test/version.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ for major=0:3, minor=0:3, patch=0:3
end
end

# VersionNumber has the promised fields
let v = v"4.2.1-1.x+a.9"
@test v.major isa Integer
@test v.minor isa Integer
@test v.patch isa Integer
@test v.prerelease isa Tuple{Vararg{Union{Integer, AbstractString}}}
@test v.build isa Tuple{Vararg{Union{Integer, AbstractString}}}
end

# julia_version.h version test
@test VERSION.major == ccall(:jl_ver_major, Cint, ())
@test VERSION.minor == ccall(:jl_ver_minor, Cint, ())
Expand Down

5 comments on commit dabb93a

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily package evaluation, I will reply here when finished:

@nanosoldier runtests(isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

The package evaluation job you requested has completed - possible new issues were detected.
The full report is available.

@vtjnash
Copy link
Member

@vtjnash vtjnash commented on dabb93a Nov 3, 2023

Choose a reason for hiding this comment

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

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here.

@vtjnash
Copy link
Member

@vtjnash vtjnash commented on dabb93a Nov 4, 2023

Choose a reason for hiding this comment

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

Looks like lots of the usual noise, and this odd case

["misc", "iterators", "zip(1:1)"] | 0.34 (5%) ✅ | 1.00 (1%)

Please sign in to comment.