Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 28, 2025

Consolidates let-to-define refactoring rules and their test files into default-recommendations/let-replacement/, mirroring the existing loops/ directory structure.

Files moved:

  • let-binding-suggestions.rkt and 4 test files → let-replacement/
  • private/let-binding.rktlet-replacement/private/

Files split:

  • let-binding-suggestions.rkt was split into:
    • let-replacement.rkt - contains only rules that convert let to define: let-to-define, define-let-to-double-define, begin0-let-to-define-begin0
    • let-binding-suggestions.rkt - contains other let-related rules: named-let-to-plain-let, let-values-then-call-to-call-with-values, delete-redundant-let

Rules extracted and moved:

  • cond-let-to-cond-define from conditional-shortcutslet-replacement/cond-let-replacement.rkt
  • match-let-to-match-define from match-shortcutslet-replacement/match-let-replacement.rkt

New files created:

  • cond-let-replacement.rkt and cond-let-replacement-test.rkt
  • match-let-replacement.rkt and match-let-replacement-test.rkt
  • let-replacement.rkt and let-replacement-test.rkt

Import paths updated in:

  • default-recommendations.rkt
  • conditional-shortcuts.rkt
  • match-shortcuts.rkt
  • loops/for-loop-shortcuts.rkt
  • loops/named-let-loopification.rkt
  • loops/private/syntax-classes.rkt

All rules in the let-replacement directory now exclusively handle converting let-style bindings to define-style bindings. Other let-related rules remain in let-binding-suggestions.rkt for better organization and maintainability.

Original prompt

This section details on the original issue you should resolve

<issue_title>Consolidate let-to-define suggestions</issue_title>
<issue_description>There are several refactoring rules across multiple files that replace let-style bindings with define-style bindings. These rules have a lot of edge cases to them, so their test files are large. Similar to the for rules, it would be more manageable if all of these rules were grouped into a directory named default-recommendations/let-replacement.</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] Consolidate let-to-define suggestions into a single directory Consolidate let-binding rules into let-replacement directory Oct 28, 2025
Copilot AI requested a review from jackfirth October 28, 2025 02:06
Copilot finished work on behalf of jackfirth October 28, 2025 02:06
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.

@copilot There's a few other rules that need to move here which are currently parts of other refactoring suites. Those rules should be extracted into new suites and files into the new directory. The only two rules like this I'm aware of are:

  • cond-let-to-cond-define
  • match-let-to-match-define

Both the implementations and tests of those rules should be moved.

Copy link
Contributor Author

Copilot AI commented Oct 28, 2025

@copilot There's a few other rules that need to move here which are currently parts of other refactoring suites. Those rules should be extracted into new suites and files into the new directory. The o...

Done. Both rules and their tests have been extracted and moved to the let-replacement directory:

  • cond-let-replacement.rkt and cond-let-replacement-test.rkt
  • match-let-replacement.rkt and match-let-replacement-test.rkt

The original rules were removed from conditional-shortcuts and match-shortcuts, and their tests were removed from the respective test files. All 671 tests pass. (23e0e2c)

Copilot AI requested a review from jackfirth October 28, 2025 02:37
Copilot finished work on behalf of jackfirth October 28, 2025 02:37
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.

@copilot This is almost ready. However, there's one issue: not everything in let-binding-suggestions should be moved into this directory. Only the rules that rewrite let forms into define forms should be moved. That includes:

  • let-to-define
  • define-let-to-double-define
  • begin0-let-to-define-begin0

These rules should be moved to a let-replacement.rkt file in the new directory, and the other rules should remain in let-binding-suggestions.rkt. That way, the only rules in the let-replacement directory are rules for replacing let and let-like forms with define.

Copy link
Contributor Author

Copilot AI commented Oct 28, 2025

@copilot This is almost ready. However, there's one issue: not everything in let-binding-suggestions should be moved into this directory. Only the rules that rewrite let forms into define forms ...

Done. The let-binding-suggestions suite has been split:

  • let-replacement.rkt now contains only the three rules that convert let to define: let-to-define, define-let-to-double-define, and begin0-let-to-define-begin0
  • let-binding-suggestions.rkt now contains the other rules: named-let-to-plain-let, let-values-then-call-to-call-with-values, and delete-redundant-let

Tests have been updated accordingly. All 667 tests pass. (8a5752e)

Copilot AI requested a review from jackfirth October 28, 2025 07:36
Copilot finished work on behalf of jackfirth October 28, 2025 07:36
@jackfirth jackfirth marked this pull request as ready for review October 28, 2025 07:59
@jackfirth jackfirth enabled auto-merge (squash) October 28, 2025 08:00
@jackfirth jackfirth merged commit e091796 into master Oct 28, 2025
2 checks passed
@jackfirth jackfirth deleted the copilot/consolidate-let-to-define-suggestions branch October 28, 2025 08:07
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.

Consolidate let-to-define suggestions

2 participants