Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 29, 2025

The miscellaneous-suggestions suite 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

  • Moved to conditional-shortcuts: if-else-cond-to-cond, cond-else-if-to-cond, cond-begin-to-cond
  • Moved to match-shortcuts: and-match-to-match
  • Removed duplicates: if-then-begin-to-cond and if-else-begin-to-cond (already covered by existing if-begin-to-cond)
  • Added guards to prevent rule conflicts: Added #:when conditions to cond-begin-to-cond to prevent it from matching contexts that should be handled by cond-void-to-when-or-unless. Rules are now in alphabetical order rather than relying on specific ordering to avoid conflicts.
  • Added tests: Comprehensive coverage for all moved rules following existing test patterns

Example

The cond-begin-to-cond rule now simplifies:

(cond ['a (begin 'b 'c 'd)])
;; ↓
(cond ['a 'b 'c 'd])

The and-match-to-match rule reduces nesting:

(and x (match x [1 2]))
;; ↓
(match x [#f #f] [1 2])
Original prompt

This section details on the original issue you should resolve

<issue_title>Get rid of miscellaneous-suggestions</issue_title>
<issue_description>The miscellaneous-suggestions suite is a holdover from the early days of Resyntax when all of the refactoring rules were in a single file. That suite should be deleted, and all of the refactoring rules in it should be moved to other suites. Tests should be added for them too, since there are no tests for the miscellaneous suggestions suite. Some of the rules might be duplicates of other rules elsewhere in Resyntax; in that case, they should be deleted instead of moved.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Remove miscellaneous suggestions suite and refactor rules Remove miscellaneous-suggestions suite Oct 29, 2025
Copilot AI requested a review from jackfirth October 29, 2025 06:34
Copy link
Owner

@jackfirth jackfirth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 270 to 271
cond-void-to-when-or-unless
cond-begin-to-cond
Copy link
Owner

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 _ ...).

Copy link
Contributor Author

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-cond now 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 clause
  • cond-void-to-when-or-unless removed the begin-checking guards since block-expression already handles begin forms correctly
  • Rules are now in alphabetical order

All tests pass.

Copilot AI requested a review from jackfirth October 29, 2025 07:13
@jackfirth jackfirth marked this pull request as ready for review October 29, 2025 08:24
@jackfirth jackfirth force-pushed the copilot/remove-miscellaneous-suggestions branch from c13073c to d34ea09 Compare October 29, 2025 08:50
@jackfirth jackfirth merged commit 40d995d into master Oct 29, 2025
4 checks passed
@jackfirth jackfirth deleted the copilot/remove-miscellaneous-suggestions branch October 29, 2025 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Get rid of miscellaneous-suggestions

2 participants