Skip to content

refactor(builtin): Array::starts_with/ends_with take ArrayView#3470

Merged
bobzhang merged 1 commit intomainfrom
hongbo/ArrayView_starts_ends
Apr 26, 2026
Merged

refactor(builtin): Array::starts_with/ends_with take ArrayView#3470
bobzhang merged 1 commit intomainfrom
hongbo/ArrayView_starts_ends

Conversation

@bobzhang
Copy link
Copy Markdown
Contributor

@bobzhang bobzhang commented Apr 26, 2026

Summary

  • Mirror the recently-merged strip_prefix/strip_suffix migration: Array::starts_with and Array::ends_with now take ArrayView[T] instead of Array[T].
  • Symmetric with the String API (String::starts_with takes StringView) and with Array::strip_prefix/Array::strip_suffix.
  • Existing callers that pass an array literal (arr.starts_with([1, 2])) are unaffected — the literal is inferred as an ArrayView.

Test plan

  • moon fmt, moon info
  • moon test -p moonbitlang/core/builtin — 2812/2812 pass

Open in Devin Review

Mirrors the strip_prefix/strip_suffix migration so the prefix/suffix
parameter is an ArrayView[T] instead of Array[T]. Existing callers
that pass array literals are unaffected — the literal is inferred as
an ArrayView.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@coveralls
Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 3945

Coverage remained the same at 94.888%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 15572
Covered Lines: 14776
Line Coverage: 94.89%
Coverage Strength: 211736.18 hits per line

💛 - Coveralls

@bobzhang bobzhang merged commit 9917702 into main Apr 26, 2026
12 of 19 checks passed
@bobzhang bobzhang deleted the hongbo/ArrayView_starts_ends branch April 26, 2026 06:28
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