Skip to content

invoke-style backedge where there shouldn't be one #53020

@timholy

Description

@timholy
julia> begin
       f(x::Int)  = 1
       f(x::Bool) = 2
       applyf(container::AbstractVector) = f(container[1])
       callapplyf(container) = applyf(container)
       end
callapplyf (generic function with 1 method)

julia> callapplyf(Any[1])
1

julia> mi = only(Base.specializations(only(methods(applyf))))
MethodInstance for applyf(::Vector{Any})

julia> mi.backedges
3-element Vector{Any}:
 MethodInstance for callapplyf(::Vector{Any})
 Tuple{typeof(applyf), AbstractVector}
 MethodInstance for callapplyf(::Vector{Any})

That last pair,

 Tuple{typeof(applyf), AbstractVector}
 MethodInstance for callapplyf(::Vector{Any})

is the kind of backedge you'd get if callapplyf were implemented as

callapplyf(container) = invoke(applyf, Tuple{AbstractVector}, container)

The fact that it's here seems to be a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorcompiler:inferenceType inferenceregression 1.10Regression in the 1.10 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions