Fix generateMock fixit insertion order#230
Merged
Merged
Conversation
The addGenerateMockArgument fixit was appending `generateMock: true` to the end of the argument list, placing it after `customMockName`. This produced invalid parameter ordering like `@Instantiable(customMockName: "x", generateMock: true)` instead of `@Instantiable(generateMock: true, customMockName: "x")`. Insert `generateMock: true` directly before the `customMockName` argument to preserve the declared parameter order. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #230 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 39 39
Lines 6015 6020 +5
=========================================
+ Hits 6015 6020 +5
🚀 New features to boost your workflow:
|
The preceding argument in a parsed argument list always has a trailing comma, so the guard was unreachable. Add the extension-path test with preceding arguments for full coverage of both code paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move argument list and customMockName index extraction to the call sites, which already validate these values exist. The method now takes the pre-validated LabeledExprListSyntax and integer offset directly, eliminating all force unwraps and unreachable guard branches. Also adds the extension-path test with preceding arguments for complete coverage of both struct and extension code paths. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
addGenerateMockArgumentfixit was appendinggenerateMock: trueto the end of the@Instantiableargument list, placing it aftercustomMockNameand producing invalid parameter orderinggenerateMock: truedirectly before thecustomMockNameargument to match the declared parameter orderTest plan
fixedSourceverification toproducesDiagnostic_whenCustomMockNameIsSetWithoutGenerateMock(struct path)fixedSourceverification toextension_producesDiagnostic_whenCustomMockNameIsSetWithoutGenerateMock(extension path)fixItInsertsGenerateMockBeforeCustomMockName_whenOtherArgumentsArePresentto test with preceding arguments likeisRoot: true🤖 Generated with Claude Code