A fast, friendly, functional language. https://roc-lang.org
Find a file
Richard Feldman f26fedb444
Fix List.get with polymorphic numeric index from for loop (issue #8666)
When a numeric literal like `0` is used in a polymorphic context (e.g., `[0]`),
its type may be a flex var that defaults to Dec during evaluation. Later, when
this value is used as an index to List.get (which expects U64), the type gets
unified to U64 but the value's layout is already Dec. This caused a panic
because asI128() asserted the layout was an integer.

The fix adds extractIndexAsI128() helper that handles both int and frac layouts
to extract the integer value correctly, converting Dec values by dividing by
the scaling factor.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-14 21:44:17 -05:00
.cargo
.devcontainer
.github retry on connectTcp flaky (#8652) 2025-12-12 19:16:11 +01:00
.reuse
ci Add lint for no // ======= comments 2025-12-10 15:31:53 -05:00
crates Restore old list.zig 2025-12-07 14:43:58 -05:00
design
devtools
docker
examples
nix
src Fix List.get with polymorphic numeric index from for loop (issue #8666) 2025-12-14 21:44:17 -05:00
test Merge pull request #8674 from godalming123/main 2025-12-14 19:25:23 -05:00
.gitattributes
.gitignore Cleanup target handling and deuplication 2025-12-09 13:30:36 +11:00
.llvmenv
.rules
AGENT.md
authors
build.zig fix #8641 (#8644) 2025-12-12 13:28:25 +01:00
build.zig.zon
BUILDING_FROM_SOURCE.md
Cargo.lock
Cargo.toml
code_of_conduct.md
CONTRIBUTING.md
default.nix
flake.lock
flake.nix
Glossary.md ownership semantic docs and comptime check 2025-11-30 21:39:41 +11:00
legal_details
LICENSE
mlc_config.json
README.md
rust-toolchain.toml
shell.nix
typos.toml sigfault is not a typo 2025-12-05 23:16:14 -05:00
version.txt

Work in progress!

Roc is not ready for a 0.1 release yet, but we do have:

If you'd like to contribute, get started here. Don't hesitate to ask for help on our group chat, we're friendly!

Sponsors

You can 💜 sponsor 💜 Roc on:

We are very grateful for our corporate sponsors Lambda Class, ohne-makler, and Decem:

Lambda Class logo      ohne-makler logo      Decem logo

If you would like your company to become a corporate sponsor of Roc's development, please DM Richard Feldman on Zulip!

We'd also like to express our gratitude to our generous individual sponsors! A special thanks to those sponsoring $25/month or more:

Thank you all so much for helping Roc progress!