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

未關閉
#2,196 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
72/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
c
領域
backend, compilers

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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

主要語言
C
星號
3
分支
7
平均合併
6 小時 32 分鐘
30 天內合併 PR
285

環境準備

在 Codespaces 中開啟

在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

InauguralSystems/EigenScript 的其他 Issue

查看 InauguralSystems/EigenScript 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。