-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
MacroTools.flatten
does not work on 1.10 beta
#50710
Comments
Edit: see the next comment for an even simpler MWE The problem is with On 1.10 beta, the
|
ResumableFunctions
does not work on 1.10 beta due to malfunctioning macro and syntax errorMacroTools.flatten
does not work on 1.10 beta
Yet more simplified: On 1.9:
On 1.10 beta
@c42f , any chance this is due to the new JuliaSyntax parser? |
This just seems to be due to the new parser adding an extra line info node? 1.9:
1.10:
Seems like this should be fixed in MacroTools. |
It can be fixed in MacroTools and I would be happy to even submit the PR myself later today, but is this not a "breaking change" that might lead to incompatibilities with user code running in production "somewhere". |
I don't think more accurate line info in expressions is considered breaking no. |
Twist: And so I'd say that #50710 (comment) is an unrelated bug with respect to this issue. |
@Krastanov Did you test that FluxML/MacroTools.jl#195 really fixes the ResumableFunctions issue? |
Actually, no. I will go head and to that shortly. |
@brenhinkeller, what's the regression here? |
I mean, it's a regression in that something used to work in a past version and now doesn't, but I agree that this is MacroTools responsibility to fix |
Maybe a team member can update the label description for "regression" - I have seen this come up a few times where some people assume it is either "any regression" or "only performance regressions or breakage covered by Julia's semver guarantees". Another source of confusion is that the naive interpretation of "semver guarantee" is different from the battle-born version used by Julia devs (I think reasonably so, but still, it does cause confusion in this type of conversation every couple of weeks) |
I will submit a different approach to the MacroTools fix tonight (there is one fix submitted already, but there is discussion about whether it is the appropriate way to do it) |
Perhaps I missed something, but I still don't understand what the bug is. As I mentioned in #50710 (comment), the bug in this issue and in FluxML/MacroTools.jl#194 is with the pretty printer, there's no difference in outcome. FluxML/MacroTools.jl#196 is a true bug, but it's unrelated AFAICT? So if the latest MacroTools PR really fixes |
I will attempt to answer: Julia 1.9.2, MacroTools 0.5.10, ResumableFunctions 0.6.4
Julia 1.11-dev, MacroTools 0.5.10, ResumableFunctions 0.6.4This is wrong, it gives me a try block with 2 arguments when the minimum valid one is a try block with 3 arguments. Then
Julia 1.11-dev, MacroTools 0.5.10 with the fix, ResumableFunctions 0.6.4
the fix also includes tests for this |
In other words, it is not just a pretty printing issue: the catch block was actually being deleted, try was left with 2 arguments, while it was supposed to have 3. What triggered this was that in 1.10 extra line number nodes were being emitted, and the original |
I am going to close this here, since this is a MacroTools bug and not a Julia base one. @Krastanov thanks for digging into this! |
Thank you for the details! Just one piece that I didn't understand: julia> quote
try
begin f() end
catch
end
end |> flatten |> dump
Expr
head: Symbol block
args: Array{Any}((2,))
1: LineNumberNode
line: Int64 2
file: Symbol REPL[8]
2: Expr
head: Symbol try
args: Array{Any}((3,))
1: Expr
head: Symbol block
args: Array{Any}((3,))
1: LineNumberNode
line: Int64 3
file: Symbol REPL[8]
2: LineNumberNode
line: Int64 3
file: Symbol REPL[8]
3: Expr
head: Symbol call
args: Array{Any}((1,))
1: Symbol f
2: Bool false
3: LineNumberNode
line: Int64 4
file: Symbol REPL[8] Third element is a |
My understanding is that this is also an example of |
Right - but that's what your PR fixes, no? |
yes |
Edit: a simpler MWE is shown in the next comment. Skip this earlier description of the problem.
ResumableFunctions
has a rather complicated macro@resumable
. That macro used to work fine in 1.9, but now it produces code with syntax errors:The creator of that macro is not active anymore. I will try to investigate and prepare a smaller example.
The text was updated successfully, but these errors were encountered: