Refactor: Consolidate duplicate resolveCaseIdent logic into GeneratorHelpers#260
Refactor: Consolidate duplicate resolveCaseIdent logic into GeneratorHelpers#260Copilot wants to merge 3 commits into
resolveCaseIdent logic into GeneratorHelpers#260Conversation
…ication Co-authored-by: 7sharp9 <588746+7sharp9@users.noreply.github.com>
resolveCaseIdent logic into GeneratorHelpers
There was a problem hiding this comment.
Pull request overview
This PR consolidates duplicated DU case identifier resolution logic into GeneratorHelpers so both DUCasesGenerator and LensesGenerator apply the same RequireQualifiedAccess-aware naming behavior.
Changes:
- Added
GeneratorHelpers.resolveCaseIdentto resolve (optionally qualified) DU case identifiers. - Updated
DUCasesGeneratorto call the shared helper and removed its local implementation. - Updated
LensesGeneratorto replace inline logic with a call to the shared helper.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Myriad.Plugins/GeneratorHelpers.fs | Introduces shared resolveCaseIdent helper for DU case SynLongIdent construction. |
| src/Myriad.Plugins/DUCasesGenerator.fs | Removes duplicated helper and switches call sites to GeneratorHelpers.resolveCaseIdent. |
| src/Myriad.Plugins/LensesGenerator.fs | Replaces inline DU case qualification logic with the shared helper call. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot resolve the merge conflicts |
…plicate-resolvecaseident-logic # Conflicts: # src/Myriad.Plugins/GeneratorHelpers.fs Co-authored-by: 7sharp9 <588746+7sharp9@users.noreply.github.com>
Resolved. There was one conflict in |
DUCasesGeneratorandLensesGeneratorboth independently implemented the same qualified DU case name resolution logic — any divergence between the two would cause inconsistent behaviour across generators.Changes
GeneratorHelpers.fs— Added sharedresolveCaseIdenthelper that resolves a DU case identifier, optionally fully qualifying it with the parent type name whenRequireQualifiedAccessis presentDUCasesGenerator.fs— Removed localresolveCaseIdent; updated call sites toGeneratorHelpers.resolveCaseIdentLensesGenerator.fs— Replaced inlinematchCaseIdentPartsblock with a call toGeneratorHelpers.resolveCaseIdentOriginal prompt
resolveCaseIdentLogic Duplicated Across DUCasesGenerator and LensesGenerator #244💡 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.