Skip to content

Commit e2cb27b

Browse files
vchuravyaviatesk
andcommitted
Update test/compiler/effects.jl
Co-authored-by: Shuhei Kadowaki <[email protected]>
1 parent a88b16b commit e2cb27b

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

test/compiler/effects.jl

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,9 +1347,9 @@ const a52531 = Core.Ref(1)
13471347
@test !Core.Compiler.is_consistent(Base.infer_effects(getref52531))
13481348
let
13491349
global set_a52531!, get_a52531
1350-
_a::Int = -1
1350+
_a::Int = -1
13511351
set_a52531!(a::Int) = (_a = a; return get_a52531())
1352-
get_a52531() = _a
1352+
get_a52531() = _a
13531353
end
13541354
@test !Core.Compiler.is_consistent(Base.infer_effects(set_a52531!, (Int,)))
13551355
@test !Core.Compiler.is_consistent(Base.infer_effects(get_a52531, ()))
@@ -1359,20 +1359,17 @@ end
13591359

13601360
let
13611361
global is_initialized52531, set_initialized52531
1362-
_is_initialized = false
1363-
set_initialized52531(flag::Bool) = (_is_initialized = flag)
1364-
is_initialized52531() = _is_initialized
1362+
_is_initialized = false
1363+
set_initialized52531!(flag::Bool) = (_is_initialized = flag)
1364+
is_initialized52531() = _is_initialized
13651365
end
1366-
1367-
@test !is_initialized52531()
1368-
@test set_initialized52531(true)
1369-
@test is_initialized52531()
1370-
@test !set_initialized52531(false)
1366+
top_52531(_) = (set_initialized52531!(true); nothing)
1367+
@test !Core.Compiler.is_consistent(Base.infer_effects(is_initialized52531))
1368+
@test !Core.Compiler.is_removable_if_unused(Base.infer_effects(set_initialized52531!, (Bool,)))(false)
13711369
@test !is_initialized52531()
1372-
foo52531(4)
1370+
top_52531(0)
13731371
@test is_initialized52531()
13741372

13751373
# pointerref nothrow for invalid pointer
13761374
@test !Core.Compiler.intrinsic_nothrow(Core.Intrinsics.pointerref, Any[Type{Ptr{Vector{Int64}}}, Int, Int])
13771375
@test !Core.Compiler.intrinsic_nothrow(Core.Intrinsics.pointerref, Any[Type{Ptr{T}} where T, Int, Int])
1378-
foo52531(x) = (set_initialized52531(true); nothing)

0 commit comments

Comments
 (0)