Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix scope of hoisted signature-local variables #56712

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -4279,6 +4279,7 @@ f(x) = yt(x)
(if (or exists (and short (pair? alldefs)))
`(toplevel-butfirst
(null)
,@(map (lambda (v) `(moved-local ,v)) moved-vars)
,@sp-inits
,@mk-method
(latestworld))
Expand Down
8 changes: 8 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4033,3 +4033,11 @@ end
@test isa(create_inner_f_no_methods(), Function)
@test length(methods(create_inner_f_no_methods())) == 0
@test Base.invoke_in_world(first(methods(create_inner_f_one_method)).primary_world, create_inner_f_one_method()) == 1

# Issue 56711 - Scope of signature hoisting
function fs56711()
f(lhs::Integer) = 1
f(lhs::Integer, rhs::(local x_should_not_be_defined=Integer; x_should_not_be_defined)) = 2
return f
end
@test !@isdefined(x_should_not_be_defined)