JuliaInterpreter.jl icon indicating copy to clipboard operation
JuliaInterpreter.jl copied to clipboard

Breaking on type constructors with parameters

Open KristofferC opened this issue 3 years ago • 0 comments

After https://github.com/JuliaDebug/JuliaInterpreter.jl/pull/524 it is possible to set breakpoint on type constructors but this fail when a type constructor is called with specific parameters:

julia> struct Constructor{T}
           x::T
       end

julia> breakpoint(Constructor)
Constructor

julia> @interpret Constructor{Int}(2) # no breakpoint
Constructor{Int64}(2)

julia> @interpret Constructor(2) # works
(Frame for Constructor(x::T) where T in Main at REPL[2]:2
b 1 2  1 ─ %1 = Core.apply_type($(QuoteNode(Constructor)), $(Expr(:static_parameter, 1)))
  2 2  │   %2 = (%1)(x)
  3 2  └──      return %2
x = 2
T = Int64
var = T
body = Constructor{T}, breakpoint(Constructor(x::T) where T in Main at REPL[2]:2, line 2))

Presumably, one wants to also break on Constructor{Int} when one adds a breakpoint to Constructor.

KristofferC avatar Mar 07 '22 09:03 KristofferC