Skip to content

Fix indexer generation and add documentation for interface delegation#26

Merged
StevenTCramer merged 2 commits into
masterfrom
Cramer/2025-07-31/filename-rule
Oct 17, 2025
Merged

Fix indexer generation and add documentation for interface delegation#26
StevenTCramer merged 2 commits into
masterfrom
Cramer/2025-07-31/filename-rule

Conversation

@StevenTCramer
Copy link
Copy Markdown
Contributor

Summary

Changes

Indexer Generation Fix

Problem: The generator produced invalid code for interfaces with indexers (like IList<T>):

public T this[]  // Missing parameters - CS1551 error
{
    get => field.this[];  // Invalid syntax
}

Solution: Added proper indexer detection and generation:

public T this[int index]
{
    get => field[index];
    set => field[index] = value;
}

Files Modified

Test Plan

  • Build passes
  • Verified generated indexer code has correct syntax
  • Tested with IList<T> interface delegation
  • All existing functionality remains unchanged

Fixes

Closes #25

🤖 Generated with Claude Code

- Add comprehensive documentation for interface delegation generator
- Add file name rule analyzer documentation
- Include usage examples, requirements, and diagnostics
- Bump version from beta.5 to beta.6
Fixes #25

- Add support for indexer properties in GeneratePropertyDelegation
- Check property.IsIndexer to detect indexers
- Generate parameters and arguments for indexer access
- Use 'this[params]' syntax instead of 'propertyName'
- Verified fix generates correct code: 'public T this[int index]'

Before: public T this[] { get => field.this[]; }
After:  public T this[int index] { get => field[index]; }
@StevenTCramer StevenTCramer merged commit b51ac46 into master Oct 17, 2025
1 check passed
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.

Indexer generation missing parameter in interface delegation

1 participant