Skip to content

Commit 07fd900

Browse files
authored
A few more inference improvements in binaryplatforms (#38342)
1 parent 88535e7 commit 07fd900

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

base/binaryplatforms.jl

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct Platform <: AbstractPlatform
5353
"os" => os,
5454
)
5555
for (tag, value) in kwargs
56-
tag = lowercase(string(tag))
56+
tag = lowercase(string(tag::Symbol))
5757
if tag ("arch", "os")
5858
throw(ArgumentError("Cannot double-pass key $(tag)"))
5959
end
@@ -68,17 +68,14 @@ struct Platform <: AbstractPlatform
6868
# doesn't parse nicely into a VersionNumber to persist, but if `validate_strict` is
6969
# set to `true`, it will cause an error later on.
7070
if tag ("libgfortran_version", "libstdcxx_version", "os_version")
71-
normver(x::VersionNumber) = string(x)
72-
function normver(str::AbstractString)
73-
v = tryparse(VersionNumber, str)
74-
if v === nothing
75-
# If this couldn't be parsed as a VersionNumber, return the original.
76-
return str
71+
if isa(value, VersionNumber)
72+
value = string(value)
73+
elseif isa(value, AbstractString)
74+
v = tryparse(VersionNumber, value)
75+
if isa(v, VersionNumber)
76+
value = string(v)
7777
end
78-
# Otherwise, return the `string(VersionNumber(str))` version.
79-
return normver(v)
8078
end
81-
value = normver(value)
8279
end
8380

8481
# Use `add_tag!()` to add the tag to our collection of tags
@@ -430,7 +427,7 @@ function VNorNothing(d::Dict, key)
430427
if v === nothing
431428
return nothing
432429
end
433-
return VersionNumber(v)
430+
return VersionNumber(v)::VersionNumber
434431
end
435432

436433
"""

0 commit comments

Comments
 (0)