Bool index says 'cannot index list' without naming the bool (slice path names it)

Open
#2,196 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
backend, compilers

Research direction

Start by reproducing the examples in the issue on v0.48.0, then trace how list and dictionary indexing errors are produced in the interpreter and JIT. Add a regression test for the wrong index types and compare interpreter and JIT output with tools/jit_diff.sh. Done means each error names the received type and accepted index type, while preserving the error kind.

Written by the indexing model from the issue text.

Description

area:runtime-vm bug found-by:cold-read kind:bug status:held

Indexing with a bool raises, as docs/llms.txt says it should, but the message does not say why. The slice path already gives a precise message, so the two disagree.

To reproduce (v0.48.0, release build)
xs is [1, 2]
d is {"a": 1}
try:
    print of xs[true]
catch e:
    print of e.message
try:
    print of d[true]
catch e:
    print of e.message
try:
    print of xs[true:]
catch e:
    print of e.message
Actual
cannot index list
cannot index dict
slice bound must be an integer or null, got bool
Expected

The index messages name the index type the way the slice message does, e.g. list index must be an integer, got bool and dict key must be a string, got bool (whatever the real accepted key types are).

Done when
  • xs[true] and d[true] raise with a message that names bool and the accepted index type; the error kind is unchanged.
  • Other wrong index types (xs["a"], xs[null], xs[[0]]) name their type too.
  • Interpreter and JIT give the same text (tools/jit_diff.sh stays clean).
  • A regression test fails on v0.48.0 and passes on the fix.

Found while checking docs/llms.txt against the runtime (PR #2193).


Generated by Claude Code

Dominant language
C
Stars
3
Forks
7
Avg merge
6h 32m
Merged PRs (30d)
285

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from InauguralSystems/EigenScript

All issues in InauguralSystems/EigenScript

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.