Dispatching on T
where Core.Compiler.iskindtype(T)
is broken #11840
Closed
Description
This testcase has a dispatch error in it:
# This just add debug info to Base.isbits(t::DataType)
function Base.isbits(t::DataType)
if !isa(t,DataType)
@show typeof(t)
error("Shouldn't dispatch to here!")
end
!t.mutable & t.pointerfree & isleaftype(t)
end
## # this fixes it:
## function Base.isbits(t::TypeConstructor)
## false
## end
g() = Integer # needs to return a Type
gg(::Int) = nothing
tmm = first(methods(gg))
sig = Tuple{tmm.sig.parameters[2:end]...}
# sig = (tmm.sig[2:end]...) # 0.3 version works
fret_typ = Base.return_types(g, sig)
println("$fret_typ") # without this line no error is thrown later
@show methods(getindex) # error thrown here
This throws the error:
ERROR: LoadError: Shouldn't dispatch to here!
The indexing into the tuple is essential to trigger the bug.
The equivalent in 0.3 works.
(edit: slight update)
Activity