Skip to content

Commit 5f7bfc0

Browse files
topolaritygbaraldi
andauthored
specialize VersionNumber constructors less aggressively (#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>
1 parent 1d7c771 commit 5f7bfc0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

base/version.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ struct VersionNumber
5151
build::VerTuple
5252

5353
function VersionNumber(major::VInt, minor::VInt, patch::VInt,
54-
pre::VerTuple,
55-
bld::VerTuple)
54+
@nospecialize(pre::VerTuple), @nospecialize(bld::VerTuple))
5655
major >= 0 || throw(ArgumentError("invalid negative major version: $major"))
5756
minor >= 0 || throw(ArgumentError("invalid negative minor version: $minor"))
5857
patch >= 0 || throw(ArgumentError("invalid negative patch version: $patch"))

0 commit comments

Comments
 (0)