Skip to content

Commit a77a580

Browse files
fix no arg @with within a scope
1 parent 7cc195c commit a77a580

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

base/scopedvalues.jl

+4
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ struct Scope
8585
values::ScopeStorage
8686
end
8787

88+
function Scope(parent::Scope)
89+
return Scope(parent.values)
90+
end
91+
8892
function Scope(parent::Union{Nothing, Scope}, key::ScopedValue{T}, value) where T
8993
val = convert(T, value)
9094
if parent === nothing

test/scopedvalues.jl

+6
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,12 @@ end
138138
@test sval[] == 1
139139
@test sval_float[] == 1.0
140140
end
141+
@with sval=>2 sval_float=>2.0 begin
142+
@with begin
143+
@test sval[] == 2
144+
@test sval_float[] == 2.0
145+
end
146+
end
141147
end
142148

143149
@testset "isassigned" begin

0 commit comments

Comments
 (0)