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

Ouverte
#2,196 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
72/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
c
Domaine
backend, compilers

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

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

Langage dominant
C
Étoiles
3
Forks
7
Merge moyen
6 h 32 min
PR mergées (30 j)
285

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de InauguralSystems/EigenScript

Toutes les issues de InauguralSystems/EigenScript

Issues similaires

Plus d'issues C

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.