Lyricdev
GitHub

LYR-MIG0309

arithmetic that may have meant to wrap

hint · spec 14-cli

A note of lyric fix --from-4: a function computes with an integer constant beyond 32 bits — a hash, a generator —, whose overflow wrapped in Lyric 4 and panics in Lyric 5.

Explanation

An integer that overflowed wrapped silently in Lyric 4; in Lyric 5 it panics (LYR-RT0002), and the operators +%, -% and *% wrap. Which arithmetic was meant to wrap is written nowhere, so the migration changes no operator. It says, once a function, where one computes with a constant beyond 32 bits — the mark of a hash or a pseudo-random generator, whose arithmetic wraps on purpose — and names the operators to write there.

An overflow elsewhere was a fault in Lyric 4 that went unseen; Lyric 5's panic shows it.

Example

proposal[LYR-MIG0309] main.lyr:8:12: 'next' computes with a constant beyond 32 bits; an overflow wrapped in Lyric 4 and panics in Lyric 5 — where the arithmetic is meant to wrap, write '+%' and '*%'