Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 13, 2025

Summary

  • Fixed indexing operators in Point<T> and LinkAddress<T> classes to properly validate negative indices
  • Added check for index < 0 in Point indexer to prevent invalid negative access
  • Refactored LinkAddress indexer to use cleaner index != 0 validation
  • Both indexers now correctly throw IndexOutOfRangeException for all invalid indices

Changes Made

  • Point.cs:60: Changed if (index < Size) to if (index < 0 || index >= Size)
  • LinkAddress.cs:45: Changed if (index == 0) to if (index != 0) for better readability

Test plan

  • ✅ Created and ran comprehensive indexer validation tests
  • ✅ Verified negative indices now properly throw IndexOutOfRangeException
  • ✅ Confirmed valid indices still return expected values
  • ✅ All existing tests continue to pass

Fixes #62

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #62
@konard konard self-assigned this Sep 13, 2025
- Add check for negative indices in Point<T> indexer (index < 0)
- Refactor LinkAddress<T> indexer to use != 0 check for better readability
- Both indexers now properly throw IndexOutOfRangeException for all invalid indices
- Fixes issue #62: Bug in all indexing operators

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Bug in all indexing operators Fix indexing operators to validate negative indices Sep 13, 2025
@konard konard marked this pull request as ready for review September 13, 2025 11:34
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>'
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.

Bug in all indexing operators

2 participants