diff --git a/src/ambiguities.jl b/src/ambiguities.jl index 7c286c26..9e8c389b 100644 --- a/src/ambiguities.jl +++ b/src/ambiguities.jl @@ -29,28 +29,6 @@ test_ambiguities(packages; kwargs...) = _test_ambiguities(aspkgids(packages); kw const ExcludeSpec = Pair{Base.PkgId,String} -aspkgids(pkg::Union{Module,PkgId}) = aspkgids([pkg]) -aspkgids(packages) = mapfoldl(aspkgid, push!, packages, init = PkgId[]) - -aspkgid(pkg::PkgId) = pkg -function aspkgid(m::Module) - if !ispackage(m) - error("Non-package (non-toplevel) module is not supported. Got: $m") - end - return PkgId(m) -end -function aspkgid(name::Symbol) - # Maybe `Base.depwarn()` - return Base.identify_package(String(name))::PkgId -end - -ispackage(m::Module) = - if m in (Base, Core) - true - else - parentmodule(m) == m - end - strnameof(x) = string(x) strnameof(x::Type) = string(nameof(x)) diff --git a/src/utils.jl b/src/utils.jl index 38940529..d869dca1 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -6,6 +6,28 @@ function askwargs(flag::Bool) return NamedTuple() end +aspkgids(pkg::Union{Module,PkgId}) = aspkgids([pkg]) +aspkgids(packages) = mapfoldl(aspkgid, push!, packages, init = PkgId[]) + +aspkgid(pkg::PkgId) = pkg +function aspkgid(m::Module) + if !ispackage(m) + error("Non-package (non-toplevel) module is not supported. Got: $m") + end + return PkgId(m) +end +function aspkgid(name::Symbol) + # Maybe `Base.depwarn()` + return Base.identify_package(String(name))::PkgId +end + +ispackage(m::Module) = + if m in (Base, Core) + true + else + parentmodule(m) == m + end + function project_toml_path(dir) candidates = joinpath.(dir, ["Project.toml", "JuliaProject.toml"]) i = findfirst(isfile, candidates)