From a65ee473ecd42fe42d3762f25bbe6cd2ac066cd9 Mon Sep 17 00:00:00 2001 From: Valentin Churavy Date: Thu, 21 Dec 2023 06:03:58 +0100 Subject: [PATCH] Update test/compiler/effects.jl Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com> --- test/compiler/effects.jl | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/test/compiler/effects.jl b/test/compiler/effects.jl index c82c54590bc55..79e327fb5dff4 100644 --- a/test/compiler/effects.jl +++ b/test/compiler/effects.jl @@ -1347,9 +1347,9 @@ const a52531 = Core.Ref(1) @test !Core.Compiler.is_consistent(Base.infer_effects(getref52531)) let global set_a52531!, get_a52531 - _a::Int = -1 + _a::Int = -1 set_a52531!(a::Int) = (_a = a; return get_a52531()) - get_a52531() = _a + get_a52531() = _a end @test !Core.Compiler.is_consistent(Base.infer_effects(set_a52531!, (Int,))) @test !Core.Compiler.is_consistent(Base.infer_effects(get_a52531, ())) @@ -1359,17 +1359,15 @@ end let global is_initialized52531, set_initialized52531 - _is_initialized = false - set_initialized52531(flag::Bool) = (_is_initialized = flag) - is_initialized52531() = _is_initialized + _is_initialized = false + set_initialized52531!(flag::Bool) = (_is_initialized = flag) + is_initialized52531() = _is_initialized end - -@test !is_initialized52531() -@test set_initialized52531(true) -@test is_initialized52531() -@test !set_initialized52531(false) +top_52531(_) = (set_initialized52531!(true); nothing) +@test !Core.Compiler.is_consistent(Base.infer_effects(is_initialized52531)) +@test !Core.Compiler.is_removable_if_unused(Base.infer_effects(set_initialized52531!, (Bool,)))(false) @test !is_initialized52531() -foo52531(4) +top_52531(0) @test is_initialized52531() # pointerref nothrow for invalid pointer