Skip to content

Commit

Permalink
fix Meta.partially_inline! for ReturnNode
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonschaub committed Nov 21, 2020
1 parent c36cf8c commit 09eb415
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions base/meta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,12 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
x.edges .+= slot_offset
return x
end
if isa(x, Core.ReturnNode)
return Core.ReturnNode(
_partially_inline!(x.val, slot_replacements, type_signature, static_param_values,
slot_offset, statement_offset, boundscheck)
)
end
if isa(x, Expr)
head = x.head
if head === :static_parameter
Expand Down
5 changes: 5 additions & 0 deletions test/meta.jl
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,8 @@ macro m() 2 end
end

@test _lower(TestExpandInWorldModule, :(@m), TestExpandInWorldModule.wa) == 1

f(::T) where {T} = T
ci = code_lowered(f, Tuple{Int})[1]
@test Meta.partially_inline!(ci.code, [], Tuple{typeof(f),Int}, Any[Int], 0, 0, :propagate) ==
Any[Core.ReturnNode(QuoteNode(Int))]

0 comments on commit 09eb415

Please sign in to comment.