Description
I propose we ...
Do sanity checks to ensure the output matches the semantics of the input
The existing way of Fantomas deals with this problem is ...
If it breaks something, there isn't any guarantee that anyone will notice
Pros and Cons
The advantages of making this adjustment to Fantomas are ...
- Ensure that Fantomas doesn't introduce bugs in code or delete code etc.
- Confidence for use in production
- More robust unit tests
The disadvantages of making this adjustment to Fantomas are ...
- Slight performance hit
- Need to consider situations where AST differs but behavior doesn't (e.g. superfluous brackets)
Examples
Please provide multiple examples (before and after scenarios) and explain what rules did apply to achieve the outcome.
A bug like #1352 provides an error message instead of producing incorrect code without warning.
Extra information
Estimated cost (XS, S, M, L, XL, XXL):
M
Related suggestions: (put links to related suggestions here)
I would prefer that Fantomas refuse to change code if it incorrectly thinks it may have changed the semantics, than for it to produce code that may or may not compile but is nonetheless wrong.
Affidavit (please submit!)
Please tick this by placing a cross in the box:
- I have read the Contribution Guidelines.
- I have searched both open and closed suggestions on this site and believe this is not a duplicate
Please tick all that apply:
- This is not a breaking change to Fantomas
- I or my company would be willing to help implement and/or test this
- This suggestion is part of the Microsoft style guide (please add a link to section if so)
- This suggestion is part of the G-Research style guide (please add a link to section if so)