-
Notifications
You must be signed in to change notification settings - Fork 4
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
Formatting changes semantics (removes ;
)
#38
Comments
Thanks for the report. The fault is that we first have a
|
JuliaFormatter re-parses the output after formatting to check whether it's equivalent. I'd suggest doing that here as well, just as a basic sanity check (I don't think the overhead should be prohibitive). |
Yea, locally I reparse to check that the output is at least parseable, but I don't compare the expressions. It doesn't seem trivial though(?) because some changes can modify the tree without the meaning I think? E.g. if you insert a
|
Oh, yeah, good point. I guess there needs to be a "semantic normalization" pass that doesn't act on macro inputs. Not actually sure how JuliaFormatter handles that... |
It also doesn't seem feasible to skip all formatting except whitespace inside macros even if a macro can observe it. Then you couldn't format a function with an |
Thanks for the report, this is fixed in the patch linked above. This is comparable to |
In situations involving macros, removing a trailing
;
sometimes changes semantics. For example, inremoving the
;
actually makes this code invalid.Runic should keep the
;
in cases like this.The text was updated successfully, but these errors were encountered: