Revision d215d914ee388efb0737135d81dcc581e0016f8e authored by Keno Fischer on 15 July 2023, 17:01:26 UTC, committed by GitHub on 15 July 2023, 17:01:26 UTC
Fixes the case from #50518, but we actually have two test cases in the tests that also hit this (e.g. this one: ``` f40964(xs::Int...=1; k = 2) = (xs, k) ``` ), but just happened not to hit the bad codegen path. #50556, once merged would have complained on those definitions as well, without this fix.
interpreter.jl
# This file is a part of Julia. License is MIT: https://julialang.org/license
using Test
# interpreted but inferred/optimized top-level expressions with vars
let code = """
while true
try
this_is_undefined_29213
ed = 0
break
finally
break
end
end
print(42)
"""
@test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -e $code`, String) == "42"
end
let code = "Threads.atomic_add!(Threads.Atomic{Int}(40), 2)"
@test read(`$(Base.julia_cmd()) --startup-file=no --compile=min -E $code`, String) == "40\n"
end
let p = Pipe(),
c = pipeline(`$(Base.julia_cmd()) --startup-file=no --compile=min -E 'error()'`, stderr=p)
proc = run(c, wait=false)
readline(p)
@test readline(p) == "Stacktrace:"
wait(proc)
close(p)
end
Computing file changes ...