Native tsc: merge conflict markers after U+2028/U+2029 are not recognized (false TS1109 instead of TS1185)
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 62/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- go, typescript
- 領域
- compilers
研究方向
此缺陷位於 tsc/internal/scanner/scanner.go 中的 isConflictMarkerTrivia,約第 2422–2425 行,其中行首回退邏輯解碼的是 text[:pos-2] 而非 text[:pos]。請先在字面 U+2028 出現於 <<<<<<< HEAD 之前的情況下重現,並確認出現的是 TS1109 而非 TS1185。修復方法是從 text[:pos] 解碼前一個 rune;當 LS 和 PS 案例與 LF/CR 對照一樣回報 TS1185 時即完成。
由索引模型根據 Issue 內容生成。
描述
🔎 Search Terms
merge conflict marker, TS1185, isConflictMarkerTrivia, U+2028, U+2029, line separator, paragraph separator, UTF-8
🕗 Version & Regression Information
- This changed between classic TypeScript 5.9.3 and native
tsc7.1.0-dev - Verified on current
main(Go / tsgo) - Markers after LF/CR still work; only LS/PS break recognition
⏯ Playground Link
N/A (needs a literal U+2028 / U+2029 in the source)
💻 Code
export {};
<<<<<<< HEAD
(U+2028 between {}; and <<<<<<<; same with U+2029. Also reproduces with ======= / >>>>>>>.)
tsc file.ts
Control (works on both):
export {};
<<<<<<< HEAD
🙁 Actual behavior
Native tsc treats the markers as ordinary tokens, e.g.:
error TS1109: Expression expected.
(and further cascade errors)
🙂 Expected behavior
Classic 5.9.3:
error TS1185: Merge conflict marker encountered.
Additional information about the issue
Root cause in tsc/internal/scanner/scanner.go (isConflictMarkerTrivia, ~2422–2425):
atLineStart := pos == 0 || stringutil.IsLineBreak(rune(text[pos-1]))
if !atLineStart && pos >= 2 {
prev, _ := utf8.DecodeLastRuneInString(text[:pos-2]) // should be text[:pos]
atLineStart = stringutil.IsLineBreak(prev)
}
After LS (E2 80 A8), text[pos-1] is 0xA8 (not a line break). The fallback decodes text[:pos-2] (ends at E2) instead of the full prior rune. Classic UTF-16 charCodeAt(pos-1) sees 0x2028 correctly.
Fix: utf8.DecodeLastRuneInString(text[:pos]).
Same UTF-8 line-break family as literal U+2028 in regex first-pass scanning.
- 主要語言
- Go
- 星號
- 112k
- 分支
- 15.4k
- 平均合併
- 3 天 5 小時
- 30 天內合併 PR
- 149
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/TypeScript 的其他 Issue
-
`tsc --watch` in virtual machine fails with `fanotify_mark on '...' failed: invalid cross-device link` trying to watch parent directories可能已有人在做 @jakebailey 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 62/100
microsoft/TypeScript#65290 ·
維護者通常 1 天內回覆
-
Native API: formatDiagnosticsWithColorAndContext drops related information without a file location可能重新可做 關聯的 PR 已關閉且未合併。 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
microsoft/TypeScript#65087 ·
維護者通常 1 天內回覆
-
TS7 LSP: documentHighlight returns nothing when the file path contains '@'可能重新可做 關聯的 PR 已關閉且未合併。 未關閉Bug
難度 2/5 1-3 小時 新手友好度 78/100
microsoft/TypeScript#64758 ·
維護者通常 1 天內回覆
-
Language server (tsc --lsp) exits with code 1 after `shutdown` and `exit`可能已有人在做 @rajnish-verma-22172 於 15 天前認領。 未關閉Bug
難度 2/5 1-3 小時 新手友好度 76/100
microsoft/TypeScript#64742 · 1 則留言 ·
維護者通常 1 天內回覆
-
Non-enum CLI options with multiple values separated by comma and space aren't whitespace trimmed可能已有人在做 @RyanCavanaugh 於 29 天前認領。 未關閉Bug
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/TypeScript#64618 · 已指派 1 人 ·
維護者通常 1 天內回覆
查看 microsoft/TypeScript 的全部 Issue
相似的 Issue
-
WriterSetTimes: the UTIME_NOW check fails when the kernel uses its coarse clock可能已有人在做 @JakeChampion 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 78/100
JakeChampion/lang#14224 ·
維護者通常 1 天內回覆
-
agent-butler-finding bug
難度 1/5 1 小時以內 新手友好度 88/100
jordansmall/spindrift#6391 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 65/100
SAP/crossplane-provider-btp#1175 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 82/100
維護者通常 1 天內回覆
-
adk: stream concatenation errors bypass retry and failover可能已有人在做 @OUAO-FRANK 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆