Skip to content

Commit a28e5ce

Browse files
authored
add test for behavior of conditional flow with global (#57414)
tests #57315
1 parent f5f6d41 commit a28e5ce

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/core.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8448,3 +8448,18 @@ myfun57023a(::Type{T}) where {T} = (x = @ccall mycfun()::Ptr{T}; x)
84488448
@test only(code_lowered(myfun57023a)).has_fcall
84498449
myfun57023b(::Type{T}) where {T} = (x = @cfunction myfun57023a Ptr{T} (Ref{T},); x)
84508450
@test only(code_lowered(myfun57023b)).has_fcall
8451+
8452+
# issue #57315
8453+
global flag57315=false
8454+
function f57315()
8455+
global flag57315
8456+
if flag57315
8457+
flag_2=true
8458+
else
8459+
if flag_2
8460+
return 2
8461+
end
8462+
end
8463+
return 1
8464+
end
8465+
@test_throws UndefVarError(:flag_2, :local) f57315()

0 commit comments

Comments
 (0)