Skip to content

Commit dc609a7

Browse files
KristofferCKristofferC
and
KristofferC
authored
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>
1 parent a233425 commit dc609a7

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
@@ -43,7 +43,7 @@ function ExplicitEnv(envpath::String=Base.active_project())
4343

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

110-
for (name, pkg_infos) in get_deps(manifest_d)
111-
pkg_infos = pkg_infos::Vector{Any}
112-
for pkg_info in pkg_infos
110+
for (name, pkg_infos::Vector{Any}) in get_deps(manifest_d)
111+
for pkg_info::Dict{String, Any} in pkg_infos
113112
m_uuid = UUID(pkg_info["uuid"]::String)
114113

115114
# If we have multiple packages with the same name we will overwrite things here
@@ -141,8 +140,7 @@ function ExplicitEnv(envpath::String=Base.active_project())
141140

142141
# Extensions
143142
deps_pkg = get(Dict{String, Any}, pkg_info, "extensions")::Dict{String, Any}
144-
for (ext, triggers) in deps_pkg
145-
triggers = triggers::Union{String, Vector{String}}
143+
for (ext, triggers::Union{String, Vector{String}}) in deps_pkg
146144
if triggers isa String
147145
triggers = [triggers]
148146
end
@@ -176,7 +174,7 @@ function ExplicitEnv(envpath::String=Base.active_project())
176174
if proj_name !== nothing && proj_uuid !== nothing
177175
deps_expanded[proj_uuid] = filter!(!=(proj_uuid), collect(values(project_deps)))
178176
extensions_expanded[proj_uuid] = project_extensions
179-
path = get(project_d, "path", nothing)
177+
path = get(project_d, "path", nothing)::Union{String, Nothing}
180178
entry_point = path !== nothing ? path : dirname(envpath)
181179
lookup_strategy[proj_uuid] = entry_point
182180
end

0 commit comments

Comments
 (0)