Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jul 24, 2025

  • Explore repository structure and understand codebase
  • Run existing tests to validate current state
  • Analyze existing match-shortcuts and conditional-shortcuts patterns
  • Implement new refactoring rule for converting match conditionals to #:when
  • Add comprehensive tests for the new refactoring rule
  • Basic rule works for multi-branch match expressions with simple patterns
  • Fix rule to properly restrict to simple patterns only (complex nested patterns currently still match)
  • Fix rule ordering to prevent single-clause matches from being converted incorrectly
  • Validate rule works with both if and cond expressions
  • Test edge cases and ensure minimal changes

The basic refactoring rule is working and correctly transforms conditionals in multi-clause match expressions to use #:when clauses. However, there are still two issues to resolve:

  1. The rule currently matches complex nested patterns when it should only match simple ones
  2. Single-clause matches are being transformed by the existing single-clause-to-match-define rule

Fixes #389.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@jackfirth jackfirth marked this pull request as ready for review July 25, 2025 01:44
@jackfirth jackfirth removed the request for review from actuallyentropy July 25, 2025 01:44
@jackfirth jackfirth merged commit c91ebe5 into master Jul 25, 2025
2 checks passed
@jackfirth jackfirth deleted the copilot/fix-389 branch July 25, 2025 01:45
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.

Replace conditionals in match with #:when

3 participants