-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Description
While working on PR #44332 I found that there is a problem that struct X
is not in the roots of setindex!
Method. So, I've prepared MWE to demonstrate the issue. Not sure, if this is a bug or not. (The failing CI test comes originally from #43793.)
using Test
mutable struct Dict2{K,V} <: AbstractDict{K,V}
pairs::Vector{Pair{K,V}} # stored pairs (key::K => value::V)
function Dict2{K,V}() where V where K
n = 16
new(Vector{Pair{K,V}}(undef, n))
end
end
function setindex2!(h::Dict2{K,Any}, v, key::K) where K
@nospecialize v
h.pairs[1] = Pair{K,Any}(key, v)
end
struct X end
@noinline function f(d)
@noinline
setindex2!(d, nothing, X())
end
function callboth()
f(Dict2{X,Any}())
nothing
end
precompile(callboth, ())
m = which(setindex2!, (Dict2{X,Any}, Any, X))
@test X in m.roots
Outputs:
Test Failed at REPL[9]:1
Expression: X in m.roots
Evaluated: X in Any[:(:pairs), :setindex2!, Symbol("REPL[3]"), Pair{X, Any}, :($(QuoteNode(X()))), :($(QuoteNode(Pair{X, Any}(X(), nothing))))]
ERROR: There was an error during testinwe.jl:29
Metadata
Metadata
Assignees
Labels
No labels