Skip to content

Fix string indexing warnings and type conversion issues#3

Merged
peter-jerry-ye merged 3 commits intomainfrom
ai-fix-1764918812579
Dec 9, 2025
Merged

Fix string indexing warnings and type conversion issues#3
peter-jerry-ye merged 3 commits intomainfrom
ai-fix-1764918812579

Conversation

@peter-jerry-ye
Copy link
Contributor

Summary

Fixed compilation warnings by updating string indexing operations to use UInt16 instead of Int, and made minimal type conversion adjustments throughout the codebase.

Changes

  • src/ini_file.mbt: Updated string indexing operations and type conversions
  • src/parser.mbt: Fixed string indexing to return UInt16 instead of Int
  • src/parser_test.mbt: Updated test cases to match new type requirements
  • src/pkg.generated.mbti: Added type definitions for the updated interfaces

Why These Changes Were Made

The main issue was that string indexing operations (string[i]) were returning Int but now need to return UInt16. This change was required to eliminate compilation warnings and ensure moon check works properly. The fixes were made with minimal changes to preserve existing functionality while addressing the type conversion requirements.

Implementation Details

  • Updated string indexing operations to use proper UInt16 type conversion
  • Made minimal changes to preserve existing logic and functionality
  • Ensured all type conversions are explicit and correct
  • Updated corresponding test cases to match the new type expectations

The changes should resolve all warnings while maintaining backward compatibility and ensuring both moon check and moon test work correctly.

peter-jerry-ye and others added 3 commits December 5, 2025 15:15
- Replace deprecated @hashmap.T with @hashmap.HashMap (8 warnings)
- Replace deprecated is_empty() with is None pattern (6 warnings)
- Replace deprecated substring with str[:] syntax (1 warning)
- Fix duplicate test name (1 warning)
- Fix syntax lint warning by rewriting match (try? expr) to try-catch pattern (1 warning)

All changes are minimal and focused on fixing deprecation warnings.
moon check now passes with 0 warnings, and all 70 tests pass.

Co-authored-by: openhands <openhands@all-hands.dev>
…ssible. The bottom line is that moon check works. It would be better if moon test works. The package may not need fix. In this case, do nothing. One major change is that the string[i] used to return Int, but now it needs to return UInt16. Try to fix it by using the correct type conversion.
@peter-jerry-ye peter-jerry-ye merged commit aef294f into main Dec 9, 2025
4 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.

1 participant