Skip to content

Commit a40db47

Browse files
committed
forward-port the test cases added in #53076
The fix for #53062 was included in #50805, but it lacked explicit test cases added. This commit cherry-picks the test cases from #53076 to prevent future regression.
1 parent c32aeb5 commit a40db47

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

base/compiler/ssair/inlining.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1396,7 +1396,7 @@ function compute_inlining_cases(@nospecialize(info::CallInfo), flag::UInt32, sig
13961396
fully_covered &= split_fully_covered
13971397
end
13981398

1399-
(handled_all_cases && fully_covered) || (joint_effects = Effects(joint_effects; nothrow=false))
1399+
(handled_all_cases & fully_covered) || (joint_effects = Effects(joint_effects; nothrow=false))
14001400

14011401
if handled_all_cases && revisit_idx !== nothing
14021402
# we handled everything except one match with unmatched sparams,

test/compiler/inline.jl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2116,3 +2116,20 @@ let src = code_typed1() do
21162116
end
21172117
@test count(isinvoke(:iterate), src.code) == 0
21182118
end
2119+
2120+
# JuliaLang/julia#53062: proper `joint_effects` for call with empty method matches
2121+
let ir = first(only(Base.code_ircode(setproperty!, (Base.RefValue{Int},Symbol,Base.RefValue{Int}))))
2122+
i = findfirst(iscall((ir, convert)), ir.stmts.inst)::Int
2123+
@test iszero(ir.stmts.flag[i] & Core.Compiler.IR_FLAG_NOTHROW)
2124+
end
2125+
function issue53062(cond)
2126+
x = Ref{Int}(0)
2127+
if cond
2128+
x[] = x
2129+
else
2130+
return -1
2131+
end
2132+
end
2133+
@test !Core.Compiler.is_nothrow(Base.infer_effects(issue53062, (Bool,)))
2134+
@test issue53062(false) == -1
2135+
@test_throws MethodError issue53062(true)

0 commit comments

Comments
 (0)