Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash in showing source code #492

Closed
vtjnash opened this issue Aug 30, 2023 · 1 comment
Closed

crash in showing source code #492

vtjnash opened this issue Aug 30, 2023 · 1 comment

Comments

@vtjnash
Copy link
Contributor

vtjnash commented Aug 30, 2023

julia> using Cthulhu

julia> descend(Base._tuple_unique_fieldtypes, (Any,))
_tuple_unique_fieldtypes(t) @ Base tuple.jl:212
212 function _tuple_unique_fieldtypes(@nospecialize t::Any)::Core.SimpleVector
213     @_total_meta
214     types::Base.IdSet{Any} = IdSet::Type{Base.IdSet}()::Base.IdSet{Any}
215     t´::Any = unwrap_unionall(t::Any)::Any
216     # Given t = Tuple{Vararg{S}} where S<:Real, the various
217     # unwrapping/wrapping/va-handling here will return Real
218     if (t´::Any isa Union)::Bool
219         union!(types::Base.IdSet{Any}, _tuple_unique_fieldtypes(rewrap_unionall(t´::Any.a::Any, t::Any)::Any)::Core.SimpleVector)
220         union!(types::Base.IdSet{Any}, _tuple_unique_fieldtypes(rewrap_unionall(t´::Any.b::Any, t::Any)::Any)::Core.SimpleVector)
221     else
222         for ti::Any in (ERROR: BoundsError: attempt to access Core.SimpleVector at index [1]
Stacktrace:
  [1] getindex(v::Core.SimpleVector, i::Int64)
    @ Base ./essentials.jl:769
  [2] type_annotation_mode(node::JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}, T::Any; type_annotations::Bool, hide_type_stable::Bool)
    @ TypedSyntax ~/.julia/dev/Cthulhu/TypedSyntax/src/show.jl:104
  [3] type_annotation_mode
    @ TypedSyntax ~/.julia/dev/Cthulhu/TypedSyntax/src/show.jl:97 [inlined]
  [4] show_src_expr(io::IOContext{Base.TTY}, node::JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}, position::Int64, pre::String, pre2::String; type_annotations::Bool, iswarn::Bool, hide_type_stable::Bool, nd::Int64)
    @ TypedSyntax ~/.julia/dev/Cthulhu/TypedSyntax/src/show.jl:79
  [5] show_src_expr(io::IOContext{Base.TTY}, node::JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}, position::Int64, pre::String, pre2::String; type_annotations::Bool, iswarn::Bool, hide_type_stable::Bool, nd::Int64) (repeats 5 times)
    @ TypedSyntax ~/.julia/dev/Cthulhu/TypedSyntax/src/show.jl:80
  [6] show_src_expr
    @ TypedSyntax ~/.julia/dev/Cthulhu/TypedSyntax/src/show.jl:66 [inlined]
  [7] printstyled(io::IOContext{Base.TTY}, rootnode::JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}; type_annotations::Bool, iswarn::Bool, hide_type_stable::Bool, with_linenumber::Bool, idxend::Int64)
    @ TypedSyntax ~/.julia/dev/Cthulhu/TypedSyntax/src/show.jl:50
  [8] cthulhu_typed(io::IOContext{…}, debuginfo::Symbol, src::CodeInfo, rt::Any, effects::Core.Compiler.Effects, mi::MethodInstance; iswarn::Bool, hide_type_stable::Bool, optimize::Bool, pc2remarks::Nothing, pc2effects::Nothing, inline_cost::Bool, type_annotations::Bool, annotate_source::Bool, inlay_types_vscode::Bool, diagnostics_vscode::Bool, interp::Cthulhu.CthulhuInterpreter)
    @ Cthulhu ~/.julia/dev/Cthulhu/src/codeview.jl:168
  [9] cthulhu_typed(::IOContext{…}, ::Cthulhu.DInfo.DebugInfo, ::CodeInfo, ::Vararg{…}; kwargs::@Kwargs{…})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/codeview.jl:121
 [10] 
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:498
 [11] _descend(term::REPL.Terminals.TTYTerminal, interp::Cthulhu.CthulhuInterpreter, mi::MethodInstance; kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:739
 [12] _descend(term::REPL.Terminals.TTYTerminal, args::Any; interp::Core.Compiler.NativeInterpreter, kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:755
 [13] __descend_with_error_handling(args::Any; terminal::Any, kwargs...)
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:211
 [14] _descend_with_error_handling(f::Any, argtypes::Any; kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:200
 [15] descend_code_typed(::Any, ::Vararg{Any}; kwargs::@Kwargs{})
    @ Cthulhu ~/.julia/dev/Cthulhu/src/Cthulhu.jl:158
 [16] top-level scope
    @ REPL[14]:1
Some type information was truncated. Use `show(err)` to see complete types.
@Zentrik
Copy link
Collaborator

Zentrik commented Aug 30, 2023

#491 related, both of these are due to T.parameters[1] being used to get the inside of Type{...} (T = Type{...}).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants