https://github.com/paralab/Finch/blob/master/src/CodeGenerator.jl#L93
This is only necessary because the generated code is not compiled in the world of the original function. To overcome this world-age issue without the overhead of invokelatest, you can make use of https://github.com/SciML/RuntimeGeneratedFunctions.jl