Skip to content

maybe_step_through_wrapper! steps through function-like objects #299

Open
@pfitzseb

Description

@pfitzseb

See https://discourse.julialang.org/t/debugging-function-like-object-under-juno/26079.

Smaller repro is

struct FunLike
   value::Int
end

function (f::FunLike)(x)
   y = sin(3)
   f.value
end

f = FunLike(3)

f(3)

where

julia> @code_typed f(3)
CodeInfo(
1 ─ %1 = Base.getfield(f, :value)::Int64
└──      return %1
) => Int64

That means that the isexpr(last, :call) && any(isequal(SlotNumber(1)), last.args) check returns true.
I'm not sure how to best handle this -- special casing getfield/setfield!/getproperty/setproperty! doesn't seem completely stupid, but might not be enough. I suppose we could also check if the method we're in belongs to a Function (as opposed to some other type), but then we'd probably lose the ability to step through f(x=3). Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions