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

UndefVarError: T not defined when using @descend #527

Closed
topolarity opened this issue Jan 6, 2024 · 2 comments
Closed

UndefVarError: T not defined when using @descend #527

topolarity opened this issue Jan 6, 2024 · 2 comments

Comments

@topolarity
Copy link
Collaborator

julia> using Cthulhu

julia> foo(y) = [f(x) for x in y]
foo (generic function with 1 method)

julia> @descend foo([1,2,3,4])
foo(y) @ Main REPL[2]:1
1 foo(y::Vector{Int64})::Vector = [f(x) for x in y::Base.Generator{Vector{Int64}, var"#1#2"}]
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.
Show: [S]ource code, [A]ST, [T]yped code, [L]LVM IR, [N]ative code
Actions: [E]dit source code, [R]evise and redisplay
   f(x) for x in y
 • [f(x) for x in y::Base.Generator{Vector{Int64}, var"#1#2"}]
   
collect(itr::Base.Generator) @ Base array.jl:827
ERROR: UndefVarError: `T` not defined
Stacktrace:
  [1] extract_inner_type(::Type{Type{AbstractArray{var"#s127", 1}}})
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/show.jl:98
  [2] type_annotation_mode(node::JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}, T::Any; type_annotations::Bool, hide_type_stable::Bool)
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/show.jl:104
  [3] type_annotation_mode
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/show.jl:99 [inlined]
  [4] show_src_expr(io::IOContext{…}, node::JuliaSyntax.TreeNode{…}, position::Int64, pre::String, pre2::String; type_annotations::Bool, iswarn::Bool, hide_type_stable::Bool, nd::Int64)
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/show.jl:79
  [5] show_src_expr(io::IOContext{…}, node::JuliaSyntax.TreeNode{…}, position::Int64, pre::String, pre2::String; type_annotations::Bool, iswarn::Bool, hide_type_stable::Bool, nd::Int64) (repeats 4 times)
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/show.jl:80
  [6] show_src_expr
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/show.jl:66 [inlined]
  [7] printstyled(io::IOContext{IOBuffer}, rootnode::JuliaSyntax.TreeNode{TypedSyntax.TypedSyntaxData}; type_annotations::Bool, iswarn::Bool, hide_type_stable::Bool, with_linenumber::Bool, idxend::Int64)
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/show.jl:50
  [8] printstyled
    @ TypedSyntax ~/.julia/packages/TypedSyntax/LVzdW/src/show.jl:32 [inlined]
  [9] cthulhu_typed(io::IOContext{…}, debuginfo::Symbol, src::Core.CodeInfo, rt::Any, effects::Core.Compiler.Effects, mi::Core.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, jump_always::Bool, interp::Cthulhu.CthulhuInterpreter)
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/codeview.jl:168
 [10] cthulhu_typed
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/codeview.jl:123 [inlined]
 [11] #cthulhu_typed#54
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/codeview.jl:121 [inlined]
 [12] (::Cthulhu.var"#92#99"{})(lambda_io::IOContext{…})
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:489
 [13] stringify(f::Any, context::IOContext{Base.TTY})
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/ui.jl:90
 [14]
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:488
 [15]
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:607
 [16] _descend
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:379 [inlined]
 [17] _descend
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:749 [inlined]
 [18] #_descend#109
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:765 [inlined]
 [19] __descend_with_error_handling(args::Any; terminal::Any, kwargs...)
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:213
 [20] _descend_with_error_handling(f::Any, argtypes::Any; kwargs::@Kwargs{iswarn::Bool})
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:202
 [21] descend_code_typed(::Any, ::Vararg{Any}; kwargs::@Kwargs{})
    @ Cthulhu ~/.julia/packages/Cthulhu/O1Xhq/src/Cthulhu.jl:160
 [22] top-level scope
    @ REPL[3]:1
Some type information was truncated. Use `show(err)` to see complete types.

Seems to occur on 1.9 and 1.10 (and probably also nightly)

@topolarity topolarity changed the title UndefVarError: T not defined when using @descend UndefVarError: \T\ not defined when using @descend Jan 6, 2024
@topolarity topolarity changed the title UndefVarError: \T\ not defined when using @descend UndefVarError: T not defined when using @descend Jan 6, 2024
@topolarity topolarity changed the title UndefVarError: T not defined when using @descend `UndefVarError: T not defined when using @descend` Jan 6, 2024
@topolarity topolarity changed the title `UndefVarError: T not defined when using @descend` UndefVarError: T not defined when using @descend Jan 6, 2024
@Zentrik
Copy link
Collaborator

Zentrik commented Jan 7, 2024

Can you try updating, this seems to work for me. I believe this issue should have been fixed in Cthulhu 2.9.4.

EDIT: Never mind, I accidentally was using the master branch of TypedSyntax. TypedSyntax needs a new release to fix this.

@Zentrik
Copy link
Collaborator

Zentrik commented Jan 8, 2024

Should be fixed on newest version of TypedSyntax, v1.2.4.

@Zentrik Zentrik closed this as completed Jan 8, 2024
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