@@ -1126,21 +1126,23 @@ function code_lowered(@nospecialize(f), @nospecialize(t=Tuple); generated::Bool=
11261126 throw (ArgumentError (" 'debuginfo' must be either :source or :none" ))
11271127 end
11281128 world = get_world_counter ()
1129- world == typemax (UInt) && error ( " code reflection cannot be used from generated functions " )
1130- return map ( method_instances (f, t, world)) do m
1129+ ret = CodeInfo[]
1130+ for m in method_instances (f, t, world)
11311131 if generated && hasgenerator (m)
11321132 if may_invoke_generator (m)
1133- return ccall (:jl_code_for_staged , Any, (Any, UInt), m, world):: CodeInfo
1133+ push! (ret, ccall (:jl_code_for_staged , Any, (Any, UInt), m, world):: CodeInfo )
11341134 else
1135- error (" Could not expand generator for `@generated` method " , m, " . " ,
1136- " This can happen if the provided argument types (" , t, " ) are " ,
1137- " not leaf types, but the `generated` argument is `true`." )
1135+ error (
1136+ " Could not expand generator for `@generated` method " , m, " . " ,
1137+ " This can happen if the provided argument types (" , lt, " ) are " ,
1138+ " not leaf types, but the `generated` argument is `true`." )
11381139 end
11391140 end
11401141 code = uncompressed_ir (m. def:: Method )
11411142 debuginfo === :none && remove_linenums! (code)
1142- return code
1143+ push! (ret, code)
11431144 end
1145+ return ret
11441146end
11451147
11461148hasgenerator (m:: Method ) = isdefined (m, :generator )
0 commit comments