Skip to content

TypeError upon descending into a dynamic call #651

@topolarity

Description

@topolarity

Taken from JuliaLang/julia#58915 (comment) on current master (01b1348df1):

julia> nt = (next = zero(UInt32), prev = zero(UInt32))
(next = 0x00000000, prev = 0x00000000)

julia> f(nt) = @inline Base.setindex(nt, 2, :next)
f (generic function with 1 method)

julia> @descend optimize=false f(nt)

f(nt) @ Main REPL[3]:1
Variables
  #self#::Core.Const(Main.f)
  nt::@NamedTuple{next::UInt32, prev::UInt32}
  val::NamedTuple

Body::NamedTuple
    @ REPL[3]:1 within `unknown scope`
1nothing%2 = Main.Base::Core.Const(Base)
│   %3 =   dynamic Base.getproperty(%2, :setindex)::Core.Const(Base.setindex)
│        (val = (%3)(nt, 2, :next))
│        nothing%6 = val::NamedTuple
└──      return %6
Select a call to descend into or  to ascend. [q]uit. [b]ookmark.
Toggles: [w]arn, [h]ide type-stable statements, [t]ype annotations, [s]yntax highlight for Source/LLVM/Native, [j]ump to source always, [o]ptimize, [d]ebuginfo, [r]emarks, [e]ffects, e[x]ception types, [i]nlining costs.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
Advanced: dump [P]arams cache.
   %3 = < constprop > getproperty(::Core.Const(Base),::Core.Const(:setindex))::Core.Const(Base.setindex)
 • %4 =  = < semi-concrete eval > setindex(::@NamedTuple{next::UInt32, prev::UInt32},::Core.Const(2),::Core.Const(:next))::NamedTuple
   

When descending into %4:

ERROR: TypeError: in typeassert, expected Core.CodeInstance, got a value of type Core.MethodInstance

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