Completion offers nothing for an array element after a spread
維護者通常 1 天內回覆
已經有一個關聯 PR 被合併了。
- #9199 來自 @cknitt —— 已合併
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- ocaml
- 領域
- devtools
研究方向
The bug is in traverse_expr in analysis/src/completion_expressions.ml, which handles Pexp_array and dict literals but has no case for the Pexp_spread node. Start by reading the Pexp_array branch to see how element positions are traversed, then add handling so an array spread keeps the expected element type. Done when completion after [...base, ] offers First and Second, matching [First, ], and the untyped File module fallback no longer appears.
由索引模型根據 Issue 內容生成。
描述
Found by differential semantic drift analysis from b123b7c3 to c10223e8.
What is broken
type kind = First | Second
let base: array<kind> = [First]
let ys: array<kind> = [First, ]
// ^com First, Second
let ys2: array<kind> = [...base, ]
// ^com nothing
At c10223e8, completion at the second position returns no items; at b123b7c3 it returned a single bogus [] item of type 'a (from Primitive_array.spread). [...base, Fi] falls back to untyped completion (offering First and the module File). The expected items are the same as for [First, ].
traverse_expr handles Pexp_array and dict literals, including dict spreads, but has no case for the Pexp_spread node that #8905 introduced for array and list literals with spreads.
Possible cause (speculation only)
Before #8905 a spread literal was a call to Primitive_array.spread, which completion treated as a function argument; the new node falls into the default case.
🤖 Generated with Claude Code
- 主要語言
- OCaml
- 星號
- 7.5k
- 分支
- 485
- 平均合併
- 16 小時 51 分鐘
- 30 天內合併 PR
- 268
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
rescript-lang/rescript 的其他 Issue
-
Exception analysis does not know the Temporal `fromStringOrThrow` functions可能已有人在做 @cknitt 於 2 天前認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
rescript-lang/rescript#9182 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 48/100
rescript-lang/rescript#9244 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 56/100
rescript-lang/rescript#9243 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 43/100
rescript-lang/rescript#9242 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 52/100
rescript-lang/rescript#9241 ·
維護者通常 1 天內回覆
查看 rescript-lang/rescript 的全部 Issue
相似的 Issue
-
area/test type/bug
難度 2/5 1-3 小時 新手友好度 76/100
Clodmony/starship-coop#70 ·
維護者通常 1 天內回覆
-
area:permissions enhancement platform:linux platform:vscode
難度 2/5 1-3 小時 新手友好度 72/100
anthropics/claude-code#107899 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
anomalyco/opencode#62322 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
community enhancement good first issue
難度 2/5 1-3 小時 新手友好度 86/100
維護者通常 1 天內回覆