Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
aviatesk committed Apr 11, 2024
1 parent a643984 commit 2118d11
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/scopedvalues.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Base.ScopedValues

include("compiler/irutils.jl")

@testset "errors" begin
@test ScopedValue{Float64}(1)[] == 1.0
@test_throws InexactError ScopedValue{Int}(1.5)
Expand Down Expand Up @@ -160,3 +163,9 @@ end
let code = code_typed(with_macro_slot_cross)[1][1].code
@test !any(x->isa(x, Core.PhiCNode), code)
end

# inline constant scoped values
const inlineable_const_sv = ScopedValue(1)
@test fully_eliminated(; retval=(inlineable_const_sv => 1)) do
inlineable_const_sv => 1
end

0 comments on commit 2118d11

Please sign in to comment.