Skip to content

Commit

Permalink
fix no arg @with within a scope
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Oct 6, 2024
1 parent 2ca88ad commit 63ad813
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/scopedvalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ struct Scope
values::ScopeStorage
end

function Scope(parent::Scope)
return Scope(parent.values)
end

function Scope(parent::Union{Nothing, Scope}, key::ScopedValue{T}, value) where T
val = convert(T, value)
if parent === nothing
Expand Down
6 changes: 6 additions & 0 deletions test/scopedvalues.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ end
@test sval[] == 1
@test sval_float[] == 1.0
end
@with sval=>2 sval_float=>2.0 begin
@with begin
@test sval[] == 2
@test sval_float[] == 2.0
end
end
end

@testset "isassigned" begin
Expand Down

0 comments on commit 63ad813

Please sign in to comment.