From d92bb3162a802013819982b0805dfb916256f689 Mon Sep 17 00:00:00 2001 From: Simeon Schaub Date: Wed, 6 Jan 2021 02:09:49 +0100 Subject: [PATCH] fix Meta.partially_inline! again forgot to take `statement_offset` into account in #38519 --- base/meta.jl | 2 +- test/meta.jl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/base/meta.jl b/base/meta.jl index 9f545b108353b..98bbcc8cdd358 100644 --- a/base/meta.jl +++ b/base/meta.jl @@ -354,7 +354,7 @@ function _partially_inline!(@nospecialize(x), slot_replacements::Vector{Any}, return Core.GotoIfNot( _partially_inline!(x.cond, slot_replacements, type_signature, static_param_values, slot_offset, statement_offset, boundscheck), - x.dest, + x.dest + statement_offset, ) end if isa(x, Expr) diff --git a/test/meta.jl b/test/meta.jl index e13d986e667e3..ab073668677c6 100644 --- a/test/meta.jl +++ b/test/meta.jl @@ -243,3 +243,5 @@ g(::Val{x}) where {x} = x ? 1 : 0 ci = code_lowered(g, Tuple{Val{true}})[1] @test Meta.partially_inline!(ci.code, [], Tuple{typeof(g),Val{true}}, Any[Val{true}], 0, 0, :propagate)[1] == Core.GotoIfNot(QuoteNode(Val{true}), 3) +@test Meta.partially_inline!(ci.code, [], Tuple{typeof(g),Val{true}}, Any[Val{true}], 0, 2, :propagate)[1] == + Core.GotoIfNot(QuoteNode(Val{true}), 5)