Create interface: doc comments are reindented, and `@deprecated` and doc comments on values are dropped
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- javascript, ocaml
- 領域
- compilers
研究方向
The reindentation and dropped attributes both come from analysis/src/create_interface.ml: start at literal_lines, which marks only string and template tokens as verbatim, and at the Sig_value case, which prints values from their type. Check whether doc comments and the @deprecated attribute are carried through for let values the way they are for external. Done when a multi-line doc comment in a nested module keeps its original indentation in the generated .resi and let f keeps its doc and deprecation attribute.
由索引模型根據 Issue 內容生成。
描述
Found by differential semantic drift analysis from b123b7c3 to c10223e8.
What is broken
-
Doc comments are reindented (since #9144). In a nested module, the lines of a multi-line doc comment after its first are shifted to the declaration's indentation:
module A = { module B = { /** Example: ```rescript let v: t = 1 ``` */ type t = int } }The generated
.resiindents```rescript,let v: t = 1and```by four spaces.rescript-tools docthen reads"Example:\n ```rescript\n let v: t = 1\n ```"from the.resiand"Example:\n```rescript\nlet v: t = 1\n```"from the.res: the fenced block becomes an indented code block. Relative indentation inside a doc comment also collapses (a line at column 0 inside a type at column 4 moves to column 4). #9144 copies lines inside string and template literals verbatim because reindenting them "would change its value"; a doc comment is the string payload of@res.doc.literal_linesmarks only string and template tokens as verbatim. -
@deprecatedand doc comments onletvalues are dropped (before this range as well). For/** Doc of f. */ @deprecated("use g") let f = x => x + 1 let g = x => x + 1the generated interface is
let f: int => intandlet g: int => int. A module callingDep.f(1)gets warning 3 without the.resiand none with it. Anexternalkeeps both attributes. #9096 covers type declarations; theSig_valuecase prints values from their type.
Possible cause (speculation only)
The reindentation added by #9144 protects string and template literals but not comments, although #9096 had already made doc comments part of the copied text.
🤖 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
-
難度 2/5 1-3 小時 新手友好度 63/100
KhronosGroup/SPIRV-LLVM-Translator#4151 ·
維護者通常 2 天內回覆
-
S3: friction & debt ws:emitter ws:wasm
難度 2/5 1-3 小時 新手友好度 78/100
MedakaLang/medaka#4913 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 79/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 74/100
-
bug genc
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆