• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moonbitlang / core / 4122
94%

Build:
DEFAULT BRANCH: main
Ran 04 May 2026 01:18AM UTC
Jobs 1
Files 364
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 May 2026 01:17AM UTC coverage: 94.573% (-0.009%) from 94.582%
4122

push

github

bobzhang
refactor(hashmap)!: rename update_or_init -> update_or_default, change semantics

Two changes, motivated by the same problem with the previous design:

1. Naming: rename to update_or_default to match the existing core
   convention where _or_default(k, value) takes an eager value and
   _or_init(k, () -> value) takes a lazy thunk. update_or_init took an
   eager value, so it was mis-following the convention; the new name
   sits cleanly next to get_or_default.

2. Semantics: insert `default` as-is when the key is absent, instead of
   inserting `f(default)`. Under the old "always apply f" semantics, the
   call update_or_init(k, 0, x => x + 1) silently inserted 1 (not 0) on
   first observation, because the named "init" value was actually the
   pre-f seed rather than the inserted value. New semantics matches
   Java's Map.merge and Rust's Entry::and_modify(f).or_insert(v):
   default IS what gets stored when absent.

Counter pattern now reads literally:
  counts.update_or_default(k, 1, x => x + 1)
First call inserts 1; subsequent calls increment.

BREAKING CHANGE on this branch only (not yet released).

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

2 of 3 new or added lines in 1 file covered. (66.67%)

1 existing line in 1 file now uncovered.

14865 of 15718 relevant lines covered (94.57%)

218318.75 hits per line

Uncovered Changes

Lines Coverage ∆ File
1
98.23
-1.77% hashmap/hashmap.mbt

Coverage Regressions

Lines Coverage ∆ File
1
98.23
-1.77% hashmap/hashmap.mbt
Jobs
ID Job ID Ran Files Coverage
1 4122.1 04 May 2026 01:18AM UTC 365
94.58
GitHub Action Run
Source Files on build 4122
  • Tree
  • List 364
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • fbef46a6 on github
  • Prev Build on main (#4120)
  • Next Build on main (#4125)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc