I am trying to debug some code which is giving a cryptic error.
(This is the same MWE from this question. I have made some small changes to the symbolics package, i.e. trying to print out the relevant variables. This is my normal debug procedure, print out some intermediate data and inspect it. )
When I try to print some of the relevant variables, I get an error, which I’ve pasted below. I guess I have a few questions
- is nameof supposed to be defined for bools? shouldn’t it just be “Bool” or maybe “True” or “False”?
- Is the point of display() that it’s meant to show nearly anything presentable? It’s worked for me on almost everything else, like matrices, closures, many other things
- How do I proceed? I’m not sure how to start debugging variables I can’t inspect.
ERROR: LoadError: MethodError: no method matching nameof(::Bool)
The function `nameof` exists, but no method is defined for this combination of argument types.
Closest candidates are:
nameof(::Core.IntrinsicFunction)
@ Base reflection.jl:2273
nameof(::Num)
@ Symbolics ~/.julia/dev/Symbolics/src/num.jl:88
nameof(::Differential)
@ Symbolics ~/.julia/dev/Symbolics/src/diff.jl:58
...
Stacktrace:
[1] show_call(io::IOContext{Base.TTY}, f::Bool, args::Vector{Any})
@ SymbolicUtils ~/.julia/packages/SymbolicUtils/iH1dT/src/types.jl:818
[2] show_term(io::IOContext{Base.TTY}, t::SymbolicUtils.BasicSymbolic{Real})
@ SymbolicUtils ~/.julia/packages/SymbolicUtils/iH1dT/src/types.jl:863
[3] show
@ ~/.julia/packages/SymbolicUtils/iH1dT/src/types.jl:876 [inlined]
[4] show(io::IOContext{Base.TTY}, ::MIME{Symbol("text/plain")}, x::SymbolicUtils.BasicSymbolic{Real})
@ Base.Multimedia ./multimedia.jl:47
[5] (::REPL.var"#68#69"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:346
[6] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:644
[7] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
@ REPL ~/.julia/juliaup/julia-1.11.0-rc2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:332
[8] display
@ ~/.julia/juliaup/julia-1.11.0-rc2+0.x64.linux.gnu/share/julia/stdlib/v1.11/REPL/src/REPL.jl:351 [inlined]
[9] display(x::Any)
@ Base.Multimedia ./multimedia.jl:340
[10] expand_derivatives(O::SymbolicUtils.BasicSymbolic{Real}, simplify::Bool; occurrences::Nothing)
@ Symbolics ~/.julia/dev/Symbolics/src/diff.jl:271
[11] expand_derivatives(n::Num, simplify::Bool; occurrences::Nothing)
@ Symbolics ~/.julia/dev/Symbolics/src/diff.jl:323
[12] expand_derivatives
@ ~/.julia/dev/Symbolics/src/diff.jl:322 [inlined]
[13] expand_derivatives(n::Num)
@ Symbolics ~/.julia/dev/Symbolics/src/diff.jl:322
[14] main()
@ Main ~/MWE-test/v2.jl:12
[15] top-level scope
@ ~/MWE-test/v2.jl:17
[16] include(fname::String)
@ Main ./sysimg.jl:38
[17] top-level scope
@ REPL[1]:1
in expression starting at /home/orebas/MWE-test/v2.jl:17