JuliaDebug / Cthulhu.jl

The slow descent into madness
MIT License
644 stars 41 forks source link

`TypeError: in typeassert, expected Symbol, got a value of type Nothing` #504

Open jishnub opened 1 year ago

jishnub commented 1 year ago
julia> using Polynomials

julia> @descend_code_warntype ChebyshevT(Polynomial([0,1]))
ERROR: TypeError: in typeassert, expected Symbol, got a value of type Nothing
Stacktrace:
  [1] map_signature!(sig::JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}, slotnames::Vector{Symbol}, slottypes::Vector{Any})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:166
  [2] map_signature!
    @ ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:112 [inlined]
  [3] JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}(rootnode::JuliaSyntax.SyntaxNode, src::Core.CodeInfo, mappings::Vector{Vector{Union{JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}, JuliaSyntax.SyntaxNode}}}, symtyps::IdDict{JuliaSyntax.SyntaxNode, Any})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:80
  [4] tsn_and_mappings(m::Method, src::Core.CodeInfo, rt::Any, sourcetext::SubString{String}, lineno::Int64; warn::Bool, strip_macros::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:54
  [5] tsn_and_mappings(m::Method, src::Core.CodeInfo, rt::Any; warn::Bool, strip_macros::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:39
  [6] tsn_and_mappings
    @ ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:33 [inlined]
  [7] #get_typed_sourcetext#32
    @ ~/.julia/packages/Cthulhu/9kV71/src/reflection.jl:354 [inlined]
  [8] get_typed_sourcetext
    @ ~/.julia/packages/Cthulhu/9kV71/src/reflection.jl:352 [inlined]
  [9] find_callsites(interp::Cthulhu.CthulhuInterpreter, CI::Core.CodeInfo, stmt_infos::Vector{Core.Compiler.CallInfo}, mi::Core.MethodInstance, slottypes::Vector{Any}, optimize::Bool, annotate_source::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/9kV71/src/reflection.jl:36
 [10] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, curs::Cthulhu.CthulhuCursor; override::Nothing, debuginfo::Symbol, optimize::Bool, interruptexc::Bool, iswarn::Bool, hide_type_stable::Bool, verbose::Nothing, remarks::Bool, with_effects::Bool, inline_cost::Bool, type_annotations::Bool, annotate_source::Bool, inlay_types_vscode::Bool, diagnostics_vscode::Bool, jump_always::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:468
 [11] _descend
    @ ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:382 [inlined]
 [12] #_descend#110
    @ ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:756 [inlined]
 [13] _descend
    @ ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:756 [inlined]
 [14] _descend(term::REPL.Terminals.TTYTerminal, args::Any; interp::Core.Compiler.NativeInterpreter, kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:iswarn,), Tuple{Bool}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:772
 [15] __descend_with_error_handling(args::Any; terminal::Any, kwargs::Base.Pairs{Symbol, V, Tuple{Vararg{Symbol, N}}, NamedTuple{names, T}} where {V, N, names, T<:Tuple{Vararg{Any, N}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:213
 [16] _descend_with_error_handling(f::Any, argtypes::Any; kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:iswarn,), Tuple{Bool}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:202
 [17] descend_code_warntype(::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Cthulhu ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:191
 [18] descend_code_warntype(::Any, ::Any)
    @ Cthulhu ~/.julia/packages/Cthulhu/9kV71/src/Cthulhu.jl:191
 [19] top-level scope
    @ REPL[2]:1

This is using Polynomials v4.0.4 on Julia v1.9.3, with Cthulhu v2.9.3 and TypedSyntax v1.2.3

jishnub commented 9 months ago

Simpler reproducer:

julia> @descend Matrix(rand(2,2))
ERROR: TypeError: in typeassert, expected Symbol, got a value of type Nothing
Stacktrace:
  [1] map_signature!(sig::JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}, slotnames::Vector{Symbol}, slottypes::Vector{Any})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:166
  [2] map_signature!
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:112 [inlined]
  [3] JuliaSyntax.TreeNode{…}(rootnode::JuliaSyntax.SyntaxNode, src::Core.CodeInfo, mappings::Vector{…}, symtyps::IdDict{…})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:80
  [4] tsn_and_mappings(m::Method, src::Core.CodeInfo, rt::Any, sourcetext::SubString{String}, lineno::Int32; warn::Bool, strip_macros::Bool, kwargs::@Kwargs{})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:54
  [5] tsn_and_mappings(m::Method, src::Core.CodeInfo, rt::Any; warn::Bool, strip_macros::Bool, kwargs::@Kwargs{})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:39
  [6] tsn_and_mappings
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/node.jl:33 [inlined]
  [7] #get_typed_sourcetext#28
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/reflection.jl:353 [inlined]
  [8] get_typed_sourcetext
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/reflection.jl:351 [inlined]
  [9] find_callsites(interp::Cthulhu.CthulhuInterpreter, CI::Core.CodeInfo, stmt_infos::Vector{…}, mi::Core.MethodInstance, slottypes::Vector{…}, optimize::Bool, annotate_source::Bool)
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/reflection.jl:36
 [10] 
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:465
 [11] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, mi::Core.MethodInstance; kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:749
 [12] _descend(term::REPL.Terminals.TTYTerminal, args::Any; interp::Core.Compiler.NativeInterpreter, kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:765
 [13] __descend_with_error_handling(args::Any; terminal::Any, kwargs...)
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:213
 [14] _descend_with_error_handling(f::Any, argtypes::Any; kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:202
 [15] descend_code_typed(::Any, ::Vararg{Any}; kwargs::@Kwargs{})
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:160
 [16] top-level scope
    @ REPL[1]:1
Some type information was truncated. Use `show(err)` to see complete types.

(@v1.9) pkg> st Cthulhu
Status `~/.julia/environments/v1.9/Project.toml`
  [f68482b8] Cthulhu v2.10.0

(@v1.9) pkg> st -m TypedSyntax
Status `~/.julia/environments/v1.9/Manifest.toml`
  [d265eb64] TypedSyntax v1.2.3