Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve inferrability of prune_graph! #3202

Merged
merged 2 commits into from
Sep 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Resolve/graphtype.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,12 @@ function prune_graph!(graph::Graph)
return pvers0[vmsk0[1:(end-1)]]
end
new_pvers = [compute_pvers(new_p0) for new_p0 = 1:new_np]
new_vdict = [Dict(vn => v0 for (v0,vn) in enumerate(new_pvers[new_p0])) for new_p0 = 1:new_np]

# explicitly writing out the following loop since the generator equivalent caused type inference failure
new_vdict = Vector{Dict{VersionNumber, Int}}(undef, length(new_pvers))
for new_p0 in eachindex(new_vdict)
new_vdict[new_p0] = Dict(vn => v0 for (v0,vn) in enumerate(new_pvers[new_p0]))
end
Comment on lines +1444 to +1447
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't

new_vdict = Dict{VersionNumber, Int}[Dict(vn => v0 for (v0,vn) in enumerate(new_pvers[new_p0])) for new_p0 = 1:new_np]

also work?


# The new constraints are all going to be `true`, except possibly
# for the "uninstalled" state, which we copy over from the old
Expand Down