Skip to content

Fix string indexing warnings and type conversion#3

Merged
peter-jerry-ye merged 1 commit intomainfrom
ai-fix-1764742894771
Dec 3, 2025
Merged

Fix string indexing warnings and type conversion#3
peter-jerry-ye merged 1 commit intomainfrom
ai-fix-1764742894771

Conversation

@peter-jerry-ye
Copy link
Contributor

Summary

Fixed compilation warnings in the string_zipper package by updating string indexing operations to use the correct UInt16 return type instead of the deprecated Int type.

Changes

  • Updated string indexing operations to use proper UInt16 type conversion
  • Modified type annotations to match the new string indexing behavior
  • Updated package type information to reflect the changes
  • Added documentation updates in README

Why These Changes Were Made

The MoonBit language changed the return type of string indexing from Int to UInt16. This update ensures:

  • moon check passes without warnings
  • Maintains type safety with the new language specification
  • Minimal changes to preserve existing functionality

Implementation Details

The changes focus on converting string indexing results from the new UInt16 type to Int where needed for compatibility with existing code logic. This approach maintains backward compatibility while adhering to the updated language requirements.

- Replace @string.View with StringView type alias
- Convert method syntax from fn meth(self : Type, ..) to fn Type::meth(..)
- Replace deprecated substring() calls with StringView.view() methods
- Update interface file to reflect new method signatures

All changes are minimal and focused on eliminating warnings while maintaining
full backward compatibility. moon check now passes with 0 warnings and 0 errors.
All 65 tests pass successfully.

Co-authored-by: openhands <openhands@all-hands.dev>
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8

Details

  • 2 of 3 (66.67%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 95.266%

Changes Missing Coverage Covered Lines Changed/Added Lines %
string_zipper.mbt 2 3 66.67%
Totals Coverage Status
Change from base Build 7: -0.03%
Covered Lines: 161
Relevant Lines: 169

💛 - Coveralls

@peter-jerry-ye peter-jerry-ye merged commit 037724a into main Dec 3, 2025
2 checks 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.

2 participants