@@ -48,7 +48,9 @@ function (generator::CassetteOverlayGenerator)(world::UInt, source::SourceType,
4848 end
4949end
5050
51- function generate_overlay_src (world:: UInt , #= source=# :: SourceType , passtype, fargtypes,
51+ global invalid_code:: Vector{Any} = []
52+
53+ function generate_overlay_src (world:: UInt , source:: SourceType , passtype, fargtypes,
5254 selfname:: Symbol , fargsname:: Symbol )
5355 @nospecialize passtype fargtypes
5456 tt = Base. to_tuple_type (fargtypes)
@@ -57,7 +59,15 @@ function generate_overlay_src(world::UInt, #=source=#::SourceType, passtype, far
5759 mi = Core. Compiler. specialize_method (match)
5860 src = Core. Compiler. retrieve_code_info (mi, world)
5961 src === nothing && return nothing # code generation failed - the fallback implementation will re-raise it
60- cassette_transform! (src, mi, length (fargtypes), selfname, fargsname)
62+ errors = cassette_transform! (src, mi, length (fargtypes), selfname, fargsname)
63+ if ! isempty (errors)
64+ Core. println (" Found invalid code:" )
65+ for e in errors
66+ Core. println (" - " , e)
67+ end
68+ push! (invalid_code, (world, source, passtype, fargtypes, src, selfname, fargsname))
69+ # TODO `return nothing` when updating the minimum compat to 1.12
70+ end
6171 return src
6272end
6373
0 commit comments