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

Fix invalidations from loading OrderedCollections #1897

Merged
merged 2 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions ext/TOML/src/print.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ function _print(io::IO, a::AbstractDict,
printkey(io, ks)
Base.print(io,"]\n")
end
_print(io, value, ks,
indent = indent + header, first_block = header, sorted = sorted, by = by)
# Use runtime dispatch here since the type of value seems not to be enforced other than as AbstractDict
Base.invokelatest(_print, io, value, ks; indent = indent + header, first_block = header, sorted = sorted, by = by)
pop!(ks)
elseif is_array_of_tables(value)
# print array of tables
Expand All @@ -101,7 +101,7 @@ function _print(io::IO, a::AbstractDict,
printkey(io, ks)
Base.print(io,"]]\n")
!isa(v, AbstractDict) && error("array should contain only tables")
_print(io, v, ks, indent = indent + 1, sorted = sorted, by = by)
Base.invokelatest(_print, io, v, ks; indent = indent + 1, sorted = sorted, by = by)
end
pop!(ks)
end
Expand Down
10 changes: 5 additions & 5 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1645,14 +1645,14 @@ function diff_array(old_ctx::Union{Context,Nothing}, new_ctx::Context; manifest=
end
# load deps
new = manifest ? load_manifest_deps(new_ctx) : load_direct_deps(new_ctx)
T, S = Union{UUID,Nothing}, Union{PackageSpec,Nothing}
if old_ctx === nothing
return [(pkg.uuid, nothing, pkg) for pkg in new]
return Tuple{T,S,S}[(pkg.uuid, nothing, pkg)::Tuple{T,S,S} for pkg in new]
end
old = manifest ? load_manifest_deps(old_ctx) : load_direct_deps(old_ctx)
# merge old and new into single array
T, S = Union{UUID,Nothing}, Union{PackageSpec,Nothing}
all_uuids = union(T[pkg.uuid for pkg in old], T[pkg.uuid for pkg in new])
return Tuple{T,S,S}[(uuid, index_pkgs(old, uuid), index_pkgs(new, uuid)) for uuid in all_uuids]
return Tuple{T,S,S}[(uuid, index_pkgs(old, uuid), index_pkgs(new, uuid))::Tuple{T,S,S} for uuid in all_uuids]
end

function is_package_downloaded(ctx, pkg::PackageSpec)
Expand All @@ -1676,12 +1676,12 @@ function print_status(ctx::Context, old_ctx::Union{Nothing,Context}, header::Sym
(manifest ? "manifest" : "project") * ")", true)
return nothing
end
xs = !diff ? xs : [(id, old, new) for (id, old, new) in xs if old != new]
xs = !diff ? xs : eltype(xs)[(id, old, new) for (id, old, new) in xs if old != new]
if isempty(xs)
printpkgstyle(ctx, Symbol("No Changes"), "to $(pathrepr(manifest ? ctx.env.manifest_file : ctx.env.project_file))", true)
return nothing
end
xs = !filter ? xs : [(id, old, new) for (id, old, new) in xs if (id in uuids || something(new, old).name in names)]
xs = !filter ? xs : eltype(xs)[(id, old, new) for (id, old, new) in xs if (id in uuids || something(new, old).name in names)]
if isempty(xs)
printpkgstyle(ctx, Symbol("No Matches"),
"in $(diff ? "diff for " : "")$(pathrepr(manifest ? ctx.env.manifest_file : ctx.env.project_file))", true)
Expand Down