Skip to content

Commit

Permalink
A few more inference improvements in binaryplatforms (JuliaLang#38342)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored Nov 8, 2020
1 parent 88535e7 commit 07fd900
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions base/binaryplatforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct Platform <: AbstractPlatform
"os" => os,
)
for (tag, value) in kwargs
tag = lowercase(string(tag))
tag = lowercase(string(tag::Symbol))
if tag ("arch", "os")
throw(ArgumentError("Cannot double-pass key $(tag)"))
end
Expand All @@ -68,17 +68,14 @@ struct Platform <: AbstractPlatform
# doesn't parse nicely into a VersionNumber to persist, but if `validate_strict` is
# set to `true`, it will cause an error later on.
if tag ("libgfortran_version", "libstdcxx_version", "os_version")
normver(x::VersionNumber) = string(x)
function normver(str::AbstractString)
v = tryparse(VersionNumber, str)
if v === nothing
# If this couldn't be parsed as a VersionNumber, return the original.
return str
if isa(value, VersionNumber)
value = string(value)
elseif isa(value, AbstractString)
v = tryparse(VersionNumber, value)
if isa(v, VersionNumber)
value = string(v)
end
# Otherwise, return the `string(VersionNumber(str))` version.
return normver(v)
end
value = normver(value)
end

# Use `add_tag!()` to add the tag to our collection of tags
Expand Down Expand Up @@ -430,7 +427,7 @@ function VNorNothing(d::Dict, key)
if v === nothing
return nothing
end
return VersionNumber(v)
return VersionNumber(v)::VersionNumber
end

"""
Expand Down

0 comments on commit 07fd900

Please sign in to comment.