Recursive code_warntype?

Is there any way to check type instabilities on all functions called by the main function recursively only displaying as far as the last instability (i.e. only package functions not Julia Base functions) or up to a certain depth in the function call tree? If not, is it possible? If it’s possible, I would like to vote up for it to be done as soon as possible right after v1.0. This would make my debugging experience so much more time efficient.

If you step through your code with ASTInterpreter2, you can type code_typed before any call to get the type inferred view of that function. It’s not quite what you asked for, but it can be used for that purpose.

2 Likes

Great, I haven’t really been using ASTInterpreter2, so I will check it out, thanks!

Using TraceCalls.jl

using TraceCalls
tr = @trace YourModule code_to_trace()
redgreen(map(is_inferred, tr))
# Also consider: 
filter_lineage(!is_inferred, tr, keep_descendents=false)
3 Likes

Looking promising, thanks for that, will try it out too.