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 天 1 小时
- 30 天内合并 PR
- 136
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/TypeScript 的其他 Issue
-
难度 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 于 14 天前认领。 未关闭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 于 28 天前认领。 未关闭Bug
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/TypeScript#64618 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 microsoft/TypeScript 的全部 Issue
相似的 Issue
-
Routing rule or circuit breaker trip expression with an unknown CEL function hangs daprd可能已有人在做 @RaphaelFakhri 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
[falco-talon] Setting `podAnnotations` makes the chart fail to render可能已有人在做 @RaphaelFakhri 今天认领。 未关闭needs-kind
难度 1/5 1 小时以内 新手友好度 88/100
falcosecurity/charts#1084 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
DataDog/terraform-provider-datadog#4479 ·
维护者通常 2 天内回复
-
component/tests needs-triage
难度 2/5 1-3 小时 新手友好度 62/100
NVIDIA/nodewright#967 ·
维护者通常 1 天内回复