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

lowering: Don't closure-convert in import or using #57774

Merged
merged 1 commit into from
Mar 15, 2025

Conversation

mlechu
Copy link
Contributor

@mlechu mlechu commented Mar 14, 2025

Fixes #57702. We're calling cl-convert- on using and import statements when we shouldn't, so if there's a nearby local that gets boxed (recursive function definition in this case), and the local shares a name with something in an import statement, we get a box access where we want a raw symbol.

Before:

julia> let; let; import SHA: R; end; let; R(x...) = R(x); end; end
ERROR: TypeError: in import, expected Symbol, got a value of type Expr
Stacktrace:
 [1] top-level scope
   @ REPL[1]:1

After:

julia> let; let; import SHA: R; end; let; R(x...) = R(x); end; end
(::var"#R#R##0") (generic function with 1 method)

Previously, symbols in import/using statements would be wrapped with outerref, which cl-convert- wouldn't peek into. This protected us from this problem in 1.11.

@mlechu mlechu added compiler:lowering Syntax lowering (compiler front end, 2nd stage) bugfix This change fixes an existing bug labels Mar 14, 2025
@vtjnash vtjnash added the merge me PR is reviewed. Merge when all tests are passing label Mar 14, 2025
@KristofferC KristofferC added the backport 1.12 Change should be backported to release-1.12 label Mar 14, 2025
@topolarity
Copy link
Member

Thanks @mlechu !

@topolarity topolarity merged commit ca17927 into JuliaLang:master Mar 15, 2025
11 checks passed
@topolarity topolarity removed the merge me PR is reviewed. Merge when all tests are passing label Mar 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.12 Change should be backported to release-1.12 bugfix This change fixes an existing bug compiler:lowering Syntax lowering (compiler front end, 2nd stage)
Projects
None yet
4 participants