Skip to content

Commit 09eb415

Browse files
committed
fix Meta.partially_inline! for ReturnNode
1 parent c36cf8c commit 09eb415

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

base/meta.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,12 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any},
344344
x.edges .+= slot_offset
345345
return x
346346
end
347+
if isa(x, Core.ReturnNode)
348+
return Core.ReturnNode(
349+
_partially_inline!(x.val, slot_replacements, type_signature, static_param_values,
350+
slot_offset, statement_offset, boundscheck)
351+
)
352+
end
347353
if isa(x, Expr)
348354
head = x.head
349355
if head === :static_parameter

test/meta.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,8 @@ macro m() 2 end
233233
end
234234

235235
@test _lower(TestExpandInWorldModule, :(@m), TestExpandInWorldModule.wa) == 1
236+
237+
f(::T) where {T} = T
238+
ci = code_lowered(f, Tuple{Int})[1]
239+
@test Meta.partially_inline!(ci.code, [], Tuple{typeof(f),Int}, Any[Int], 0, 0, :propagate) ==
240+
Any[Core.ReturnNode(QuoteNode(Int))]

0 commit comments

Comments
 (0)