It at least helped me know it was Handcalcs.jl so I could look at the source code. It also cleared up my confusion over the macro calls: 1) using CodeTracking, Revise
already ran in the Handcalcs
module by the time you try precompiling at the end so the macro calls do exist, 2) @handcalcs
itself calls @code_expr
for the problematic found_func::Nothing
argument of the handfunc
call; the visibly unrelated f = @code_expr ...
is actually unrelated to the error. You really shouldn’t rely on import statements like using TestHandcalcFunctions
only being in @setup_workload
, though you might get away with it because code_expr
only handles calc_Ix
at execution.
This CodeTracking.definition(::Type{Expr},...)
method seems to be the source of the nothing
, if I’m following the @code_expr
macro right. The failure would likely be Base.invokelatest(f, method)
, which is intended to call Revise.get_def(method)
on the calc_Ix(b, h)
method to populate a CodeTracking.method_info
cache. f
would be nothing
if Revise.__init__
didn’t run, which would make invokelatest
error, so it’s likely get_def
did exist and failed. Not sure where the failure occurs though, it doesn’t happen in the REPL so I can’t (or rather don’t know how to) step through it.
julia> using PrecompileTools, Revise, CodeTracking, Handcalcs, TestHandcalcFunctions
julia> PrecompileTools.verbose[]=true #=outside precompilation=#; @setup_workload begin
# Putting some things in `@setup_workload` instead of `@compile_workload` can reduce the size of the
# precompile file and potentially make loading faster.
using Revise
using CodeTracking
using TestHandcalcFunctions
@compile_workload begin
f = @code_expr calc_Ix(5, 15)
println(f)
@handcalcs begin
I_x = calc_Ix(5,15)
end
end
end
function calc_Ix(b, h)
#= C:\Users\Benny\.julia\packages\TestHandcalcFunctions\uROfE\src\TestHandcalcFunctions.jl:6 =#
#= C:\Users\Benny\.julia\packages\TestHandcalcFunctions\uROfE\src\TestHandcalcFunctions.jl:7 =#
Ix = (b * h ^ 3) / 12
#= C:\Users\Benny\.julia\packages\TestHandcalcFunctions\uROfE\src\TestHandcalcFunctions.jl:8 =#
return Ix
end
MethodInstance for code_expr(::Function, ::Type)
MethodInstance for Revise.get_def(::Method)
MethodInstance for BoundsError(::Any, ::Int64)
MethodInstance for BoundsError(::Any, ::Int64)
MethodInstance for append!(::Vector{JuliaInterpreter.BreakpointRef}, ::Union{Tuple, AbstractVector{<:JuliaInterpreter.BreakpointRef}})
MethodInstance for append!(::Vector{JuliaInterpreter.BreakpointRef}, ::Any)
MethodInstance for match(::Regex, ::Base.AnnotatedString)
MethodInstance for match(::Regex, ::AbstractString)
MethodInstance for getproperty(::Core.SSAValue, ::Symbol)
MethodInstance for getproperty(::Core.SlotNumber, ::Symbol)
MethodInstance for getproperty(::JuliaInterpreter.SSAValue, ::Symbol)
MethodInstance for getproperty(::JuliaInterpreter.SlotNumber, ::Symbol)
MethodInstance for (::Colon)(::Int64, ::Int64)
MethodInstance for (::Colon)(::Int64, ::Int64)
MethodInstance for getproperty(::GlobalRef, ::Symbol)
MethodInstance for (NamedTuple{(:mode,)})(::Tuple{Symbol})
MethodInstance for setindex!(::Dict{Base.PkgId, CodeTracking.PkgFiles}, ::Any, ::Base.PkgId)
MethodInstance for isequal(::QuoteNode, ::QuoteNode)
MethodInstance for hash(::QuoteNode, ::UInt64)
MethodInstance for Base.typename(::DataType)
MethodInstance for Revise.var"#_methods_by_execution!#24"(::Symbol, ::Bool, ::typeof(Revise._methods_by_execution!), ::JuliaInterpreter.NonRecursiveInterpreter, ::Revise.CodeTrackingMethodInfo, ::JuliaInterpreter.Frame, ::Vector{Bool})
MethodInstance for get!(::Type{Vector{Tuple{LineNumberNode, Expr}}}, ::IdDict{Type, Union{Missing, Vector{Tuple{LineNumberNode, Expr}}}}, ::Any)
MethodInstance for LoweredCodeUtils.set_to_running_name!(::JuliaInterpreter.NonRecursiveInterpreter, ::Dict{GlobalRef, GlobalRef}, ::JuliaInterpreter.Frame, ::Dict{GlobalRef, LoweredCodeUtils.MethodInfo}, ::LoweredCodeUtils.SelfCall, ::Dict{GlobalRef, Union{Nothing, Bool, GlobalRef}}, ::GlobalRef, ::Any)
MethodInstance for println(::Expr)
MethodInstance for print(::IO, ::Expr)
MethodInstance for Base.show_unquoted(::IOContext, ::Expr, ::Int64, ::Int64)
MethodInstance for print(::IOContext, ::String, ::Any, ::String)
MethodInstance for Base.show_enclosed_list(::IOContext, ::Char, ::Vector{Any}, ::String, ::Char, ::Int64, ::Int64, ::Int64, ::Bool)
MethodInstance for Base.show_list(::IOContext, ::Vector{Any}, ::String, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool)
MethodInstance for Base.show_unquoted_expr_fallback(::IOContext, ::Expr, ::Int64, ::Int64)
MethodInstance for show(::IOContext, ::Symbol)
MethodInstance for Base.show_enclosed_list(::IOContext, ::Char, ::Vector{Any}, ::Symbol, ::Char, ::Int64, ::Int64, ::Int64, ::Bool)
MethodInstance for Base.show_list(::IOContext, ::Vector{Any}, ::Symbol, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool)
MethodInstance for Base.show_list(::IOContext, ::Vector{Any}, ::String, ::Int64, ::Int64, ::Int64, ::Bool)
MethodInstance for Base.show_list(::IOContext, ::Vector{Any}, ::Symbol, ::Int64, ::Int64, ::Int64, ::Bool)
MethodInstance for Base.show_list(::IOContext, ::Vector{Any}, ::String, ::Int64, ::Int64, ::Int64)
MethodInstance for BoundsError(::Any, ::Int64)
MethodInstance for Base.show_enclosed_list(::IOContext, ::Char, ::Vector{Expr}, ::String, ::Char, ::Int64, ::Int64)
MethodInstance for Base.show_list(::IOContext, ::Vector{Expr}, ::String, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool)
MethodInstance for Base.show_enclosed_list(::IOContext, ::Char, ::Vector{Symbol}, ::String, ::Char, ::Int64, ::Int64)
MethodInstance for Base.show_list(::IOContext, ::Vector{Symbol}, ::String, ::Int64, ::Int64, ::Int64, ::Bool, ::Bool)
MethodInstance for Base.show_unquoted(::IOContext, ::Symbol, ::Int64, ::Int64, ::Int64)
MethodInstance for Base.show_call(::IOContext, ::Symbol, ::Any, ::Vector{Any}, ::Int64, ::Int64, ::Bool)
MethodInstance for BoundsError(::Any, ::Int64)
MethodInstance for Base.show_enclosed_list(::IOContext, ::Char, ::Vector{Any}, ::String, ::Char, ::Int64, ::Int64, ::Int64)
MethodInstance for Base.show_enclosed_list(::IOContext, ::Char, ::Vector{Any}, ::String, ::Char, ::Int64, ::Int64)
MethodInstance for Base.show_call(::IOContext, ::Symbol, ::Symbol, ::Vector{Any}, ::Int64, ::Int64, ::Bool)
MethodInstance for Base.show_enclosed_list(::IOContext, ::String, ::Vector{Any}, ::String, ::String, ::Int64, ::Int64, ::Int64)
MethodInstance for Base.show_generator(::IOContext, ::Expr, ::Int64, ::Int64)
MethodInstance for Base.show_list(::IOContext, ::Any, ::String, ::Int64, ::Int64, ::Int64)
MethodInstance for Base.show_block(::IOContext, ::Symbol, ::Expr, ::Any, ::Int64, ::Int64)
MethodInstance for print(::IOContext, ::Symbol, ::Char)
MethodInstance for Base.show_unquoted(::IOContext, ::Any)
MethodInstance for Base.show_block(::IOContext, ::Symbol, ::Vector, ::Any, ::Int64, ::Int64)
MethodInstance for Base.show_list(::IOContext, ::Vector, ::String, ::Int64, ::Int64, ::Int64)
MethodInstance for Base.show_block(::IOContext, ::Symbol, ::Any, ::Any, ::Int64, ::Int64)
MethodInstance for Base.show_block(::IOContext, ::Symbol, ::Vector, ::Expr, ::Int64, ::Int64)
MethodInstance for Base.show_block(::IOContext, ::Symbol, ::Any, ::Expr, ::Int64, ::Int64)
MethodInstance for Base.show_block(::IOContext, ::String, ::Any, ::Int64, ::Int64)
MethodInstance for Base.show_list(::IOContext, ::Vector{Any}, ::Char, ::Int64, ::Int64, ::Int64)
MethodInstance for Base.show_list(::IOContext, ::Vector{Any}, ::String, ::Int64)
MethodInstance for BoundsError(::Any, ::Int64)
MethodInstance for Base.escape_raw_string(::IOContext, ::AbstractString)
MethodInstance for print(::IOContext, ::Any, ::Char)
MethodInstance for Core.kwcall(::@NamedTuple{allow_macroname::Bool}, ::typeof(Base.show_globalref), ::IOContext, ::GlobalRef)
MethodInstance for Base.show_unquoted(::IOContext, ::GlobalRef)
MethodInstance for Base.show_unquoted(::IOContext, ::Symbol)
MethodInstance for Base.show_linenumber(::IOContext, ::Any, ::Nothing)
MethodInstance for Base.show_linenumber(::IOContext, ::Any, ::Any)
MethodInstance for Base.show_block(::IOContext, ::String, ::Vector, ::Expr, ::Int64, ::Int64)
MethodInstance for Base.show_block(::IOContext, ::String, ::Any, ::Expr, ::Int64, ::Int64)
MethodInstance for Base.show_block(::IOContext, ::String, ::Expr, ::Int64, ::Int64)
MethodInstance for print(::IOContext, ::Int64)
MethodInstance for show(::IOContext, ::Int64)
MethodInstance for escape_string(::IOContext, ::String, ::String)
MethodInstance for print(::IOContext, ::Char, ::Char)
MethodInstance for Base.show_import_path(::IOContext, ::Any, ::Int64)
MethodInstance for println(::Base.TTY, ::Expr)
MethodInstance for Base.show_block(::IOContext{Base.TTY}, ::Symbol, ::Expr, ::Expr, ::Int64, ::Int64)
MethodInstance for Base.show_unquoted(::IOContext{Base.TTY}, ::LineNumberNode, ::Int64, ::Int64, ::Int64)
MethodInstance for Base.show_unquoted(::IOContext{Base.TTY}, ::Int64, ::Int64, ::Int64, ::Int64)
MethodInstance for Handcalcs.is_show_funcs_on(::Tuple{Expr})
MethodInstance for Handcalcs.handfunc(::Module, ::Expr, ::Expr, ::Tuple{Expr})
MethodInstance for Base._any_tuple(::Function, ::Bool)
MethodInstance for print(::IOContext{IOBuffer}, ::Base.AnnotatedChar)
MethodInstance for write(::IOContext{IOBuffer}, ::Base.AnnotatedChar)
MethodInstance for print(::IOContext{IOBuffer}, ::Union{Base.AnnotatedString, SubString{<:Base.AnnotatedString}})
MethodInstance for StyledStrings._ansi_writer(::IOContext{IOBuffer}, ::Base.AnnotatedString, ::typeof(print))
MethodInstance for getproperty(::Base.AnnotatedString, ::Symbol)
MethodInstance for print(::IOContext{IOBuffer}, ::SubString{<:Base.AnnotatedString})
MethodInstance for StyledStrings._ansi_writer(::IOContext{IOBuffer}, ::SubString{<:Base.AnnotatedString}, ::typeof(print))
MethodInstance for getproperty(::SubString{<:Base.AnnotatedString}, ::Symbol)
MethodInstance for getproperty(::Base.AnnotatedString, ::Symbol)
MethodInstance for getproperty(::SubString{<:Base.AnnotatedString}, ::Symbol)
MethodInstance for getproperty(::SubString{<:Base.AnnotatedString}, ::Symbol)
MethodInstance for print(::IOBuffer, ::Union{Base.AnnotatedString, SubString{<:Base.AnnotatedString}})
MethodInstance for StyledStrings._ansi_writer(::IOBuffer, ::Base.AnnotatedString, ::typeof(print))
MethodInstance for getproperty(::Base.AnnotatedString, ::Symbol)
MethodInstance for Base.Broadcast.materialize(::Base.Broadcast.Broadcasted{Style, Nothing, typeof(Base.wrap_string)} where Style<:Union{Nothing, Base.Broadcast.BroadcastStyle})
MethodInstance for AbstractTrees.TreeCursor(::Any)
MethodInstance for descendleft(::Any)
MethodInstance for unsafe_copyto!(::GenericMemoryRef{:not_atomic, AbstractTrees.StableNode{_A}, Core.AddrSpace{Core}(0x00)}, ::GenericMemoryRef{:not_atomic, AbstractTrees.StableNode{_A}, Core.AddrSpace{Core}(0x00)}, ::Int64) where _A
MethodInstance for unsafe_copyto!(::GenericMemoryRef, ::GenericMemoryRef{:not_atomic, AbstractTrees.StableNode{_A}, Core.AddrSpace{Core}(0x00)} where _A, ::Int64)
MethodInstance for unsafe_copyto!(::GenericMemory{:not_atomic, AbstractTrees.StableNode{_A}, Core.AddrSpace{Core}(0x00)}, ::Int64, ::GenericMemory{:not_atomic, AbstractTrees.StableNode{_A}, Core.AddrSpace{Core}(0x00)}, ::Int64, ::Int64) where _A
MethodInstance for unsafe_copyto!(::Memory, ::Int64, ::GenericMemory{:not_atomic, AbstractTrees.StableNode{_A}, Core.AddrSpace{Core}(0x00)} where _A, ::Int64, ::Int64)
MethodInstance for setindex!(::Memory, ::AbstractTrees.StableNode, ::Int64)
MethodInstance for (::Handcalcs.var"#21#22"{String})(::Any)
MethodInstance for setindex!(::Dict{Any, Any}, ::Any, ::Any)
MethodInstance for count(::Function, ::Tuple{Bool, Bool})
MethodInstance for Base.mapfoldl_impl(::Base.var"#363#364"{<:Function}, ::typeof(Base.add_sum), ::Int64, ::Tuple{Bool, Bool})
MethodInstance for Base.foldl_impl(::Any, ::Int64, ::Tuple{Bool, Bool})
MethodInstance for Base._foldl_impl(::Any, ::Int64, ::Tuple{Bool, Bool})
MethodInstance for Base.afoldl(::Any, ::Int64, ::Bool, ::Bool)
MethodInstance for Base.var"#mapfoldl#337"(::Int64, ::typeof(mapfoldl), ::Function, ::Function, ::Tuple{Bool, Bool})
MethodInstance for Base.mapfoldl_impl(::Function, ::Function, ::Int64, ::Tuple{Bool, Bool})
MethodInstance for Base.typed_hcat(::Type{Any}, ::Any, ::Nothing)
MethodInstance for Base._cat_t(::Val{2}, ::Type{Any}, ::Any, ::Nothing)
MethodInstance for Base.__cat(::Any, ::Tuple{Any, Any}, ::Tuple{Bool, Bool}, ::Any, ::Nothing)
MethodInstance for Base.__cat_offset!(::Any, ::Tuple{Any, Any}, ::Tuple{Bool, Bool}, ::Tuple{Int64, Int64}, ::Any, ::Nothing)
MethodInstance for (::Base.var"#181#183"{<:Tuple{Any, Any}, Tuple{Bool, Bool}, Tuple{Int64, Int64}})(::Int64)
MethodInstance for (::Base.var"#254#255"{Base.var"#181#183"{var"#s182", Tuple{Bool, Bool}, Tuple{Int64, Int64}, _A}} where {var"#s182"<:Tuple{Any, Any}, _A})(::Int64)
MethodInstance for Base._copy_or_fill!(::Any, ::Tuple{Any, Any}, ::LinearAlgebra.AbstractQ)
MethodInstance for (::Base.var"#182#184"{Tuple{Bool, Bool}, Tuple{Int64, Int64}})(::Int64)
MethodInstance for (::Base.var"#254#255"{Base.var"#182#184"{Tuple{Bool, Bool}, Tuple{Int64, Int64}, _A}} where _A)(::Int64)
MethodInstance for Base.__cat_offset!(::Any, ::Tuple{Any, Any}, ::Tuple{Bool, Bool}, ::Tuple{Any, Any}, ::Nothing)
MethodInstance for (::Base.var"#181#183"{<:Tuple{Any, Any}, Tuple{Bool, Bool}, <:Tuple{Any, Any}, Nothing})(::Int64)
MethodInstance for Base.Broadcast.broadcasted(::typeof(+), ::Any, ::Base.OneTo{Int64})
MethodInstance for (::Base.var"#254#255"{Base.var"#181#183"{var"#s182", Tuple{Bool, Bool}, var"#s1821", Nothing}} where {var"#s182"<:Tuple{Any, Any}, var"#s1821"<:Tuple{Any, Any}})(::Int64)
MethodInstance for Base._copy_or_fill!(::Any, ::Tuple{Any, Any}, ::Nothing)
MethodInstance for view(::LinearAlgebra.AbstractQ, ::Any, ::Any)
MethodInstance for copy(::LinearAlgebra.AbstractQ)
MethodInstance for Base.copymutable(::LinearAlgebra.AbstractQ)
MethodInstance for fill!(::Union{Matrix{Int8}, Matrix{UInt8}}, ::Integer)
MethodInstance for fill!(::Matrix, ::Any)
MethodInstance for (::Base.var"#182#184"{Tuple{Bool, Bool}, <:Tuple{Any, Any}, Nothing})(::Int64)
MethodInstance for (::Base.var"#254#255"{Base.var"#182#184"{Tuple{Bool, Bool}, var"#s182", Nothing}} where var"#s182"<:Tuple{Any, Any})(::Int64)
MethodInstance for getindex(::Dict{Any, Any}, ::Any)
MethodInstance for (::MacroTools.var"#27#28"{Handcalcs.var"#21#22"{String}})(::Symbol)
MethodInstance for MacroTools.match_inner(::Expr, ::Symbol, ::Dict{Any, Any})
MethodInstance for Base.collect_to_with_first!(::Vector{Symbol}, ::Symbol, ::Base.Generator{Vector{Any}, MacroTools.var"#27#28"{Handcalcs.var"#21#22"{String}}}, ::Int64)
MethodInstance for (::MacroTools.var"#27#28"{Handcalcs.var"#21#22"{String}})(::Expr)
MethodInstance for AbstractTrees.Leaves(::Symbol)
MethodInstance for collect(::AbstractTrees.Leaves{Symbol})
MethodInstance for nextsibling(::AbstractTrees.ImplicitCursor{Symbol, Nothing, Any})
MethodInstance for (::MacroTools.var"#27#28"{Handcalcs.var"#21#22"{String}})(::Int64)
MethodInstance for MacroTools.match_inner(::Expr, ::Int64, ::Dict{Any, Any})
MethodInstance for Base.setindex_widen_up_to(::Vector{Symbol}, ::Int64, ::Int64)
MethodInstance for Base.collect_to!(::Vector{Any}, ::Base.Generator{Vector{Any}, MacroTools.var"#27#28"{Handcalcs.var"#21#22"{String}}}, ::Int64, ::Int64)
MethodInstance for Base.setindex_widen_up_to(::Vector{Symbol}, ::Expr, ::Int64)
MethodInstance for Handcalcs._extract_arg(::Symbol)
MethodInstance for Handcalcs._extract_arg(::Int64)
MethodInstance for getindex(::Matrix{Any}, ::Int64)
MethodInstance for Base.indexed_iterate(::Matrix{Any}, ::Int64)
MethodInstance for Handcalcs.clean_kwargs(::Tuple{Expr})
MethodInstance for Handcalcs._handcalcs_recursive(::Vector{Any})
MethodInstance for get(::Dict{Symbol, Any}, ::Symbol, ::Symbol)
MethodInstance for collect_exprs(::LaTeXStrings.LaTeXString)
MethodInstance for calc_Ix(::Int64, ::Int64)
MethodInstance for multiline_latex(::Vector{Any})
MethodInstance for Base._iterator_upper_bound(::AbstractTrees.Leaves{Tuple{Vector{Any}}})
MethodInstance for BoundsError(::Any, ::Int64)
MethodInstance for descendleft(::AbstractTrees.ImplicitCursor{Vector{Any}, Tuple{Vector{Any}}, Any})
MethodInstance for AbstractTrees.ImplicitCursor(::AbstractTrees.ImplicitCursor{Vector{Any}, Tuple{Vector{Any}}, Any}, ::LaTeXStrings.LaTeXString, ::Nothing)
MethodInstance for descendleft(::AbstractTrees.ImplicitCursor{LaTeXStrings.LaTeXString, Vector{Any}, Union{Nothing, Tuple{Any, Int64}}})
MethodInstance for AbstractTrees.LeavesState(::AbstractTrees.ImplicitCursor{LaTeXStrings.LaTeXString, Vector{Any}, Union{Nothing, Tuple{Any, Int64}}})
MethodInstance for iterate(::AbstractTrees.Leaves{Tuple{Vector{Any}}}, ::AbstractTrees.LeavesState{AbstractTrees.ImplicitCursor{LaTeXStrings.LaTeXString, Vector{Any}, Union{Nothing, Tuple{Any, Int64}}}})
MethodInstance for isnothing(::AbstractTrees.ImplicitCursor{LaTeXStrings.LaTeXString, Vector{Any}, Union{Nothing, Tuple{Any, Int64}}})
MethodInstance for isroot(::AbstractTrees.ImplicitCursor{LaTeXStrings.LaTeXString, Vector{Any}, Union{Nothing, Tuple{Any, Int64}}})
MethodInstance for nextsibling(::AbstractTrees.ImplicitCursor{LaTeXStrings.LaTeXString, Vector{Any}, Union{Nothing, Tuple{Any, Int64}}})
MethodInstance for nextsibling(::AbstractTrees.ImplicitCursor{Vector{Any}, Tuple{Vector{Any}}, Any})
MethodInstance for Base.grow_to!(::Vector{LaTeXStrings.LaTeXString}, ::AbstractTrees.Leaves{Tuple{Vector{Any}}}, ::Nothing)