-
Notifications
You must be signed in to change notification settings - Fork 12
Remove miscellaneous-suggestions suite #669
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
Conversation
jackfirth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| cond-void-to-when-or-unless | ||
| cond-begin-to-cond |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of relying on a non-alphabetical ordering of these rules to prevent the cond-begin-to-cond rule and cond-void-to-when-or-unless rule from overlapping, let's add some extra #:when conditions to those rules so that they don't stomp on each other. The cond-begin-to-cond rule can have this condition:
#:when (syntax-parse #'(clause-after ...)
#:literals (else void)
[(~not ([else (void)])) #true] [_ #false])
(You'll also need to change the pattern on line 261 from clause-after ... to clause-after ...+ because if no clauses are provided after, that's equivalent to [else (void)].)
The cond-void-to-when-or-unless rule can have a similar #:when condition that checks that the non-void body isn't a single form matching (begin _ ...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in c13073c. Added #:when guards to both rules:
cond-begin-to-condnow prevents matching when the clause after is[else (void)]or when it's in an else clause that's part of a 2-clause cond with a void clausecond-void-to-when-or-unlessremoved the begin-checking guards sinceblock-expressionalready handles begin forms correctly- Rules are now in alphabetical order
All tests pass.
…tests Co-authored-by: jackfirth <[email protected]>
Co-authored-by: jackfirth <[email protected]>
Co-authored-by: jackfirth <[email protected]>
c13073c to
d34ea09
Compare
The
miscellaneous-suggestionssuite was a holdover from early Resyntax development when all rules lived in a single file. This removes it by relocating rules to appropriate suites and eliminating duplicates.Changes
conditional-shortcuts:if-else-cond-to-cond,cond-else-if-to-cond,cond-begin-to-condmatch-shortcuts:and-match-to-matchif-then-begin-to-condandif-else-begin-to-cond(already covered by existingif-begin-to-cond)#:whenconditions tocond-begin-to-condto prevent it from matching contexts that should be handled bycond-void-to-when-or-unless. Rules are now in alphabetical order rather than relying on specific ordering to avoid conflicts.Example
The
cond-begin-to-condrule now simplifies:The
and-match-to-matchrule reduces nesting:miscellaneous-suggestions#656Original prompt
miscellaneous-suggestions#656💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.