Errors with TypedSyntax
On multiple Julia versions I get errors with Cthulhu just trying to call @descend
ERROR: UndefVarError: `child` not defined in `TypedSyntax`
Suggestion: this global was defined as `JuliaSyntax.child` but not assigned a value.
Stacktrace:
[1] collect_symbol_nodes(rootnode::JuliaSyntax.SyntaxNode)
@ TypedSyntax ~/.julia/packages/TypedSyntax/eS4sW/src/node.jl:417
[2] map_ssas_to_source(src::Core.CodeInfo, mi::Core.MethodInstance, rootnode::JuliaSyntax.SyntaxNode, Δline::Int64)
@ TypedSyntax ~/.julia/packages/TypedSyntax/eS4sW/src/node.jl:529
[3] map_ssas_to_source
@ ~/.julia/packages/TypedSyntax/eS4sW/src/node.jl:868 [inlined]
[4] tsn_and_mappings(mi::Core.MethodInstance, src::Core.CodeInfo, rt::Any, sourcetext::SubString{String}, lineno::Int32; warn::Bool, strip_macros::Bool, kwargs::@Kwargs{})
@ TypedSyntax ~/.julia/packages/TypedSyntax/eS4sW/src/node.jl:54
[5] tsn_and_mappings(mi::Core.MethodInstance, src::Core.CodeInfo, rt::Any; warn::Bool, strip_macros::Bool, kwargs::@Kwargs{})
@ TypedSyntax ~/.julia/packages/TypedSyntax/eS4sW/src/node.jl:39
[6] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/reflection.jl:358
[7] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/reflection.jl:357
[8] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/reflection.jl:27
[9] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:381
[10] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:289
[11] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:672
[12] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:672
[13] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:683
[14] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:680
[15] __descend_with_error_handling(args::Any; terminal::Any, kwargs...)
@ Cthulhu ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:133
[16] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:122
[17] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:114
[18] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:151
[19] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/CthulhuBase.jl:151
[20] descend(::Any, ::Vararg{Any}; kwargs...)
@ Cthulhu ~/.julia/packages/Cthulhu/dkzKO/src/Cthulhu.jl:111
[21] top-level scope
@ ~/.julia/packages/Cthulhu/dkzKO/src/Cthulhu.jl:110
[22] top-level scope
@ REPL[14]:1
I'm not sure how to diagnose this since it's an stdlib involved and I do see a child global available in JuliaSyntax
On which version did you try this? Development has stopped for 1.11 due to having so many language internal changes in 1.12, but we still backport fixes to major bugs to 1.11.
It would also help to know which was the function that you tried to descend into. On 1.12/1.13 we use Cthulhu regularly and it usually works.
It might be due to having a JuliaSyntax version that is no longer compatible with Cthulhu for 1.11, as reported on Zulip: #helpdesk (published) > Compiler having trouble with type inference @ 💬
Looks like if we want to keep good support for 1.11 out of the box we may want to upgrade TypedSyntax to the newest JuliaSyntax version. cc @aviatesk
Indeed, TypedSyntax.jl needs to be bumped to use JuliaSyntax v1, but the test case modifications haven't been completed yet. I tried to update it at JuliaDebug/Cthulhu.jl#637 but it's not finished yet, and currently I basically just disabled the entire TypedSyntax feature just in order to use Cthulhu with JS v1. With the upgrade to JS v1, the internal data structure has likely changed significantly, which seems to have broken parts of the current implementation that heavily depend on JuliaSyntax's internal implementation.
However, the current TypedSyntax.jl doesn't use JuliaLowering, resulting in a rather hacky implementation, and I haven't been able to allocate time to update the current implementation. However, since migrating to a JuliaLowering-based implementation might also take time..