Skip to content

Commit

Permalink
specialize VersionNumber constructors less aggressively (JuliaLang#…
Browse files Browse the repository at this point in the history
…54386)

There's no need to specialize this code for every set of Tuple types
that it might see, especially when the primary callers don't know their
Tuple type any more precisely than this anyway.

Eliminates a dynamic dispatch from `tryparse(VersionNumber, "...")`

Co-authored-by: Gabriel Baraldi <baraldigabriel@gmail.com>
  • Loading branch information
2 people authored and xlxs4 committed May 9, 2024
1 parent 9b5f378 commit 37f5709
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions base/version.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ struct VersionNumber
build::VerTuple

function VersionNumber(major::VInt, minor::VInt, patch::VInt,
pre::VerTuple,
bld::VerTuple)
@nospecialize(pre::VerTuple), @nospecialize(bld::VerTuple))
major >= 0 || throw(ArgumentError("invalid negative major version: $major"))
minor >= 0 || throw(ArgumentError("invalid negative minor version: $minor"))
patch >= 0 || throw(ArgumentError("invalid negative patch version: $patch"))
Expand Down

0 comments on commit 37f5709

Please sign in to comment.