8000 Fix typo in deque panic message by bobzhang · Pull Request #2246 · moonbitlang/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix typo in deque panic message #2246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
Merged

Fix typo in deque panic message #2246

merged 1 commit into from
Jun 11, 2025

Conversation

bobzhang
Copy link
Contributor

Summary

  • fix typo in deque bounds checking message

Testing

  • moon test --target all (fails: moon not found)

https://chatgpt.com/codex/tasks/task_e_684944e6a0f883209bd4225be4a37d11

Copy link
peter-jerry-ye-code-review bot commented Jun 11, 2025
Typo fix in error message

Category
Correctness
Code Snippet
"index out of bounds: Ahe len is from 0 to {len} but the index is {index}"
Recommendation
The fix correctly changes 'Ahe' to 'the', making the error message more professional and clear
Reasoning
Error messages should be clear and professional as they are visible to end users. Typos can make error messages confusing and reflect poorly on code quality.

Duplicated error message string

Category
Maintainability
Code Snippet
Lines 527 and 554 contain identical error messages
Recommendation
Consider extracting the error message to a constant:

const INDEX_OUT_OF_BOUNDS = "index out of bounds: the len is from 0 to {0} but the index is {1}"

Reasoning
Duplicated strings make maintenance harder - if the message needs to be changed in the future, it needs to be changed in multiple places. A constant would centralize this and reduce the chance of inconsistencies.

Consider more specific bound information in error message

Category
Maintainability
Code Snippet
"index out of bounds: the len is from 0 to {len} but the index is {index}"
Recommendation
Consider changing to: "index out of bounds: valid range is 0 to {len - 1} but got {index}"
Reasoning
The current message could be misleading as it suggests the valid range includes 'len', when the actual valid indices are 0 to len-1. Being precise in error messages helps users debug issues more effectively.

@bobzhang bobzhang force-pushed the codex/find-and-fix-bug branch from a3a471d to 4ba68cb Compare June 11, 2025 09:22
@bobzhang bobzhang merged commit d47deca into main Jun 11, 2025
8 of 12 checks passed
@bobzhang bobzhang deleted the codex/find-and-fix-bug branch June 11, 2025 09:22
@coveralls
Copy link
Collaborator
coveralls commented Jun 11, 2025

Pull Request Test Coverage Report for Build 7209

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 93.087%

Totals Coverage Status
Change from base Build 7207: 0.0%
Covered Lines: 8551
Relevant Lines: 9186

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0