Skip to content

Conversation

@devmotion
Copy link
Contributor

This PR addresses https://github.com/JuliaLang/julia/pull/40778/files#r784416018 and replaces the reference to Core.CodeInfo in @generated with a GlobalRef.

The current implementation caused errors in Turing (TuringLang/Turing.jl#1756) which collected core AD parts in a Core submodule (not anymore, it's renamed to Essential now since it's not the first time this caused problems: JuliaLang/Reexport.jl#33 (comment)).

Currently the PR is still missing some tests. It's a bit embarrassing but I did not manage to come up with a MWE that would be fixed by this PR. I tried things like

module M
module Core
@generated f(x) = :(2 * x)
end
end

M.Core.f(3)

but they all seemed to work fine. Maybe someone has a suggestion how I can reproduce the bug and ensure that Core in @generated refers to the submodule (or something else) without CodeInfo?

Copy link
Member

@simeonschaub simeonschaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a test case that currently errors on nightly:

@test @eval Module() begin
    Core = 1
    @generated f() = 1
    f() == 1
end

@devmotion
Copy link
Contributor Author

🤦 I realized I couldn't come up with a MWE because I used Julia 1.7.1 instead of 1.6.5 or master.

@devmotion
Copy link
Contributor Author

I added a fix for arguments of name tmp as well and added both tests (added you as a commit co-author @simeonschaub). I used gensym since it seemed easier.

Copy link
Member

@simeonschaub simeonschaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That's a great first contribution!

Copy link
Member

@simeonschaub simeonschaub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I actually meant to approve this...

@simeonschaub simeonschaub added backport 1.6 Change should be backported to release-1.6 backport 1.7 bugfix This change fixes an existing bug macros @macros merge me PR is reviewed. Merge when all tests are passing labels Jan 16, 2022
@vchuravy vchuravy merged commit 8536522 into JuliaLang:master Jan 16, 2022
@devmotion devmotion deleted the dw/generated_codeinfo branch January 16, 2022 23:10
@DilumAluthge DilumAluthge removed the merge me PR is reviewed. Merge when all tests are passing label Jan 17, 2022
@KristofferC KristofferC mentioned this pull request Jan 20, 2022
23 tasks
KristofferC pushed a commit that referenced this pull request Jan 20, 2022
Co-authored-by: Simeon Schaub <[email protected]>
(cherry picked from commit 8536522)
N5N3 pushed a commit to N5N3/julia that referenced this pull request Jan 24, 2022
@KristofferC KristofferC mentioned this pull request Feb 19, 2022
50 tasks
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Feb 22, 2022
LilithHafner pushed a commit to LilithHafner/julia that referenced this pull request Mar 8, 2022
KristofferC pushed a commit that referenced this pull request Mar 15, 2022
Co-authored-by: Simeon Schaub <[email protected]>
(cherry picked from commit 8536522)
KristofferC pushed a commit that referenced this pull request Mar 16, 2022
Co-authored-by: Simeon Schaub <[email protected]>
(cherry picked from commit 8536522)
@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label May 16, 2022
staticfloat pushed a commit that referenced this pull request Dec 23, 2022
Co-authored-by: Simeon Schaub <[email protected]>
(cherry picked from commit 8536522)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug macros @macros

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants