Skip to content

Commit 7c8fbbc

Browse files
KristofferCKristofferC
and
KristofferC
committed
slightly improve inference in precompilation code (#56084)
Avoids the ``` 11: signature Tuple{typeof(convert), Type{String}, Any} triggered MethodInstance for Base.Precompilation.ExplicitEnv(::String) (84 children) ``` shown in #56080 (comment) Co-authored-by: KristofferC <kristoffer.carlsson@juliacomputing.com> (cherry picked from commit dc609a7)
1 parent 4fe24a2 commit 7c8fbbc

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

base/precompilation.jl

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function ExplicitEnv(envpath::String=Base.active_project())
4242

4343
# Collect all direct dependencies of the project
4444
for key in ["deps", "weakdeps", "extras"]
45-
for (name, _uuid) in get(Dict{String, Any}, project_d, key)::Dict{String, Any}
45+
for (name, _uuid::String) in get(Dict{String, Any}, project_d, key)::Dict{String, Any}
4646
v = key == "deps" ? project_deps :
4747
key == "weakdeps" ? project_weakdeps :
4848
key == "extras" ? project_extras :
@@ -105,9 +105,8 @@ function ExplicitEnv(envpath::String=Base.active_project())
105105
sizehint!(name_to_uuid, length(manifest_d))
106106
sizehint!(lookup_strategy, length(manifest_d))
107107

108-
for (name, pkg_infos) in get_deps(manifest_d)
109-
pkg_infos = pkg_infos::Vector{Any}
110-
for pkg_info in pkg_infos
108+
for (name, pkg_infos::Vector{Any}) in get_deps(manifest_d)
109+
for pkg_info::Dict{String, Any} in pkg_infos
111110
m_uuid = UUID(pkg_info["uuid"]::String)
112111

113112
# If we have multiple packages with the same name we will overwrite things here
@@ -139,8 +138,7 @@ function ExplicitEnv(envpath::String=Base.active_project())
139138

140139
# Extensions
141140
deps_pkg = get(Dict{String, Any}, pkg_info, "extensions")::Dict{String, Any}
142-
for (ext, triggers) in deps_pkg
143-
triggers = triggers::Union{String, Vector{String}}
141+
for (ext, triggers::Union{String, Vector{String}}) in deps_pkg
144142
if triggers isa String
145143
triggers = [triggers]
146144
end
@@ -174,7 +172,7 @@ function ExplicitEnv(envpath::String=Base.active_project())
174172
if proj_name !== nothing && proj_uuid !== nothing
175173
deps_expanded[proj_uuid] = filter!(!=(proj_uuid), collect(values(project_deps)))
176174
extensions_expanded[proj_uuid] = project_extensions
177-
path = get(project_d, "path", nothing)
175+
path = get(project_d, "path", nothing)::Union{String, Nothing}
178176
entry_point = path !== nothing ? path : dirname(envpath)
179177
lookup_strategy[proj_uuid] = entry_point
180178
end

0 commit comments

Comments
 (0)