-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviortypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
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)
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviortypes and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch