Skip to content

Commit

Permalink
Update test/compiler/effects.jl
Browse files Browse the repository at this point in the history
Co-authored-by: Shuhei Kadowaki <40514306+aviatesk@users.noreply.github.com>
  • Loading branch information
vchuravy and aviatesk committed Dec 22, 2023
1 parent 07ab2f0 commit 4f95066
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions test/compiler/effects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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, ()))
Expand All @@ -1358,17 +1358,16 @@ end
@test get_a52531() == 1

let
global is_initialized52531, set_initialized52531
_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)
global is_initialized52531, set_initialized52531!
_is_initialized = false
set_initialized52531!(flag::Bool) = (_is_initialized = flag)
is_initialized52531() = _is_initialized
end
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,)))
@test !is_initialized52531()
foo52531(4)
top_52531(0)
@test is_initialized52531()

@test Core.Compiler.is_inaccessiblememonly(Base.infer_effects(identityidentity, Tuple{Any}))
Expand All @@ -1377,4 +1376,3 @@ foo52531(4)
# pointerref nothrow for invalid pointer
@test !Core.Compiler.intrinsic_nothrow(Core.Intrinsics.pointerref, Any[Type{Ptr{Vector{Int64}}}, Int, Int])
@test !Core.Compiler.intrinsic_nothrow(Core.Intrinsics.pointerref, Any[Type{Ptr{T}} where T, Int, Int])
foo52531(x) = (set_initialized52531(true); nothing)

0 comments on commit 4f95066

Please sign in to comment.