-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Parse begin/end in ref as Expr #57368
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
base: master
Are you sure you want to change the base?
Conversation
Needs a pkgeval to evaluate how widespread the macro usage of this is. We don't technically consider the AST representation fully stable, but it's quite stable in practice. If this is too widespread, my suggestion would be to provide guidance to downstream packages to accept both forms, merge this off-by-default and then re-consider turning it on next release (possibly together with the JuliaLowering changes, which might entail some disruption in macros anyway). |
I feel like this is too breaking to be worthwhile. Also note that this does not fix #57269, since the context-sensitivity of the expression is unchanged, but rather may make fixing that slightly harder since the syntax form for this becomes slightly more difficult to write literally. |
@nanosoldier |
The package evaluation job you requested has completed - possible new issues were detected. Report summary❗ Packages that crashed5 packages crashed only on the current version.
97 packages crashed on the previous version too. ✖ Packages that failed517 packages failed only on the current version.
1934 packages failed on the previous version too. ✔ Packages that passed tests12 packages passed tests only on the current version.
4427 packages passed tests on the previous version too. ~ Packages that at least loaded2 packages successfully loaded only on the current version.
2382 packages successfully loaded on the previous version too. ➖ Packages that were skipped altogether3 packages were skipped only on the current version.
918 packages were skipped on the previous version too. |
Looks like there's an issue with LHS type-asserts: julia> function foo()
v[end]::Int = 1
end
ERROR: syntax: invalid syntax (end) |
5c3d054
to
fe6a4e3
Compare
LHS type asserts: in the special case
Printing: I didn't catch it my first time looking through show.jl, but it looks like someone has already done the work to track whether we're in an indexing expression (though it might need some tweaking). If we decide not to go through with this PR, I can still print both |
The bulk of the the pkgeval failures seem to come from macros in Setfield.jl and Accessors.jl. JuliaFormatter was also failing to precompile due to the LHS issue, but this should be fixed now (retrying it and depending packages). @nanosoldier Other "real" failures that I could find: TidierData, Unrolled, PEG, GraphPPL |
Just as another datapoint – I specifically asked about the parsed expr structure stability recently, in #53531. My resulting understanding was that parsing is expected to stay stable. |
The AST is not technically part of the stable API surface as defined, but it's been pretty stable in practice. However, there have technically been minor breaking changes most releases. There'll likely be somewhat more disruption in 1.13 because of the contemplated switch to JuliaLowering. That said, there's of course a compatibility layer there. Additionally, we're looking at more gentle mechanisms for language evolution (including syntax) in general. As for this change, the general consensus is in favor, but there's a question of timing giving the reliance considerations. That's why my suggestion was to update the packages now to accept both versions. That way, this can either be folded into the general Julia 1.13 AST/lowering related changes, be a test case for whatever evolution mechanism we come up with, or if those both fail, we can probably merge this eventually in the 1.13 or 1.14 time frame once the ecosystem has adapted. |
"Minor" breaking changes are common in Julia even aside from parsing, so seems consistent :) Thanks for the context! So you recommend merging the linked Accessors.jl PR, as this parsing change is likely to appear anyways in some Julia version? |
Yes |
The package evaluation job you requested has completed - no new issues were detected. Report summary✖ Packages that failed18 packages failed on the previous version too. ✔ Packages that passed tests42 packages passed tests on the previous version too. ~ Packages that at least loaded12 packages successfully loaded on the previous version too. ➖ Packages that were skipped altogether1 packages were skipped on the previous version too. |
fe6a4e3
to
e910e6f
Compare
Accessors and Setfield changes have been released (many thanks to @jw3126). Expected to pass now: ~400-500 dependencies of the above Expected to still fail: JuliaSyntax, PEG and ~10 dependent packages, TidierData, Unrolled, GraphPPL. I know you're tired but @nanosoldier |
The package evaluation job you requested has completed - possible new issues were detected. Report summary❗ Packages that crashed1 packages crashed only on the current version.
15 packages crashed on the previous version too. ✖ Packages that failed62 packages failed only on the current version.
1067 packages failed on the previous version too. ✔ Packages that passed tests26 packages passed tests only on the current version.
5321 packages passed tests on the previous version too. ~ Packages that at least loaded7 packages successfully loaded only on the current version.
2948 packages successfully loaded on the previous version too. ➖ Packages that were skipped altogether899 packages were skipped on the previous version too. |
What's the status of the |
The following packages tried to use Roots v1.4.1 (latest is 2.2.6), which uses Setfield v0.8.2 (latest is 1.1.2): EquationsOfStateOfSolids Of the available options (loosening the roots compat bound in all of these, loosening the setfield compat bound in old roots, or updating old setfield) I think updating setfield would be the most sensible. If this sounds reasonable to you @jw3126, I've added the new parser compatibility to v0.8.2 of my fork of setfield here and I would just need you to make a |
Two things to fix: - We do correct-but-ugly printing of `end` when it's inside another expression (probably due to setting beginsym to false too often) - `show` doesn't play nicely with ternary expressions, which seems like an unrelated issue.
@nanosoldier |
The package evaluation job you requested has completed - possible new issues were detected. Report summary❗ Packages that crashed1 packages crashed only on the current version.
4 packages crashed on the previous version too. ✖ Packages that failed45 packages failed only on the current version.
1438 packages failed on the previous version too. ✔ Packages that passed tests11 packages passed tests only on the current version.
5258 packages passed tests on the previous version too. ~ Packages that at least loaded8 packages successfully loaded only on the current version.
2841 packages successfully loaded on the previous version too. ➖ Packages that were skipped altogether2 packages were skipped only on the current version.
915 packages were skipped on the previous version too. |
The package evaluation job you requested has completed - possible new issues were detected. Report summary❗ Packages that crashed5 packages crashed on the previous version too. ✖ Packages that failed33 packages failed only on the current version.
1360 packages failed on the previous version too. ✔ Packages that passed tests12 packages passed tests only on the current version.
5313 packages passed tests on the previous version too. ~ Packages that at least loaded6 packages successfully loaded only on the current version.
2879 packages successfully loaded on the previous version too. ➖ Packages that were skipped altogether915 packages were skipped on the previous version too. |
TODO:
julia-syntax.scm
andviews.jl
(Parse arr[end] differently from arr[var"end"] JuliaSyntax.jl#537)Fixes #57269.
Before:
After: