Skip to content

Commit

Permalink
fix inference of PackageSpec constructor in presence of imprecise inp…
Browse files Browse the repository at this point in the history
…ut types
  • Loading branch information
KristofferC committed Aug 15, 2023
1 parent 46b7eef commit 363b985
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ function PackageSpec(; name::Union{Nothing,AbstractString} = nothing,
uuid = uuid === nothing ? nothing : UUID(uuid)
return PackageSpec(name, uuid, version, tree_hash, repo, path, pinned, url, rev, subdir)
end
PackageSpec(name::AbstractString) = PackageSpec(;name=name)
PackageSpec(name::AbstractString, uuid::UUID) = PackageSpec(;name=name, uuid=uuid)
PackageSpec(name::AbstractString, version::VersionTypes) = PackageSpec(;name=name, version=version)
PackageSpec(n::AbstractString, u::UUID, v::VersionTypes) = PackageSpec(;name=n, uuid=u, version=v)
PackageSpec(name::AbstractString) = PackageSpec(;name=name)::PackageSpec
PackageSpec(name::AbstractString, uuid::UUID) = PackageSpec(;name=name, uuid=uuid)::PackageSpec
PackageSpec(name::AbstractString, version::VersionTypes) = PackageSpec(;name=name, version=version)::PackageSpec
PackageSpec(n::AbstractString, u::UUID, v::VersionTypes) = PackageSpec(;name=n, uuid=u, version=v)::PackageSpec

function Base.:(==)(a::PackageSpec, b::PackageSpec)
return a.name == b.name && a.uuid == b.uuid && a.version == b.version &&
Expand Down
2 changes: 2 additions & 0 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,6 @@ end
end
end

@test eltype([PackageSpec(a) for a in []]) == PackageSpec

end # module

0 comments on commit 363b985

Please sign in to comment.