diff --git a/base/compiler/typeinfer.jl b/base/compiler/typeinfer.jl index 77547a5b30877..85bdd881042dc 100644 --- a/base/compiler/typeinfer.jl +++ b/base/compiler/typeinfer.jl @@ -1118,7 +1118,7 @@ const SOURCE_MODE_FORCE_SOURCE = 0x2 function ci_has_source(code::CodeInstance) inf = @atomic :monotonic code.inferred - return isa(inf, CodeInfo) || isa(inf, String) + return code.owner === nothing ? (isa(inf, CodeInfo) || isa(inf, String)) : inf !== nothing end """