paperbot · PL 论文追踪

全部论文 待读 收藏

P2 DiffFix: Incrementally Fixing AST Diffs via Context and Type Information

DiffFix:通过上下文与类型信息增量修复 AST 差异
ASE 2025 40th IEEE/ACM International Conference on Automated Software Engineering (ASE)2025匹配度 2/10 · 论文研究AST差异映射的增量修复,属于程序分析与软件工程范畴,但未涉及用户核心关注的LLM/Agent与静态分析交叉、浮点程序分析或贝叶斯程序分析。其问题、方法和实验均不围绕用户画像中的研究问题展开,仅可视为广义程序分析的相关工作。引用 0 inbox
Guofeng Zeng, Chang-Ai Sun, Kai Gao, Huai Liu
crossref: 2026-09-12

AI 速览

一句话:提出 DiffFix,利用节点上下文与类型约束迭代增量修复不完美的 AST 差异映射,显著提升完美 diff 率。

AST 差异(ASTDiff)通过比较程序的一对抽象语法树来刻画语法层面的代码变更,广泛用于代码评审、克隆检测与回归测试等任务。其核心难点在于两棵 AST 节点之间的准确映射,而现有方法受多样代码变更与不健全节点匹配启发式的影响,往往无法生成完美 diff。作者深入调查发现,多数不准确映射源于忽略上下文与类型层面的约束。为此,论文提出 DiffFix:同时利用节点的上下文约束与类型约束,对不完美 diff 进行迭代、增量式修复。作者开展全面实验,将 DiffFix 用于修复五种先进 ASTDiff 技术生成的 diff。结果表明,DiffFix 将基线技术的完美 diff 率提升 5.25% 至 51.12%,且时间开销可忽略不计。

问题
ASTDiff 需要准确映射两棵 AST 的节点,但现有启发式方法在多样代码变更下常产生不完美 diff,多数错误映射源于忽略上下文与类型约束。
方法
提出 DiffFix,结合节点的上下文约束与类型约束,以迭代增量的方式修复不完美的 AST diff。
评估
在五种先进 ASTDiff 技术生成的 diff 上开展实验,完美 diff 率提升 5.25%–51.12%,时间开销可忽略。
原文摘要(Abstract)

The abstract syntax tree differencing (ASTDiff) technique aims to capture syntactic code changes through comparing the differences between a pair of ASTs of a program, which has been widely used in various program analysis or testing tasks, such as code review, clone detection, and regression testing. A key issue for ASTDiff lies in the accurate mappings between nodes of two ASTs. However, most existing approaches often fail to generate such perfect diffs due to the gap between diverse code changes and unsound node matching heuristics. Our in-depth investigation reveals that most inaccurate mappings are caused by the ignorance of context- and/or type-specific constraints. Accordingly, we propose an AST diff fixing approach DiffFix that leverages both the node’s context and type constraints to iteratively and incrementally fix imperfect diffs. Comprehensive experiments have been conducted to evaluate the effectiveness of DiffFix through its application to fix diffs generated by five state-of-the-art ASTDiff techniques. The experimental results demonstrate that DiffFix can improve the perfect diff rate of these baseline techniques by 5.25% to 51.12% with negligible time overhead.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot9509,
  title = {DiffFix: Incrementally Fixing AST Diffs via Context and Type Information},
  author = {Guofeng Zeng and Chang-Ai Sun and Kai Gao and Huai Liu},
  booktitle = {ASE},
  year = {2025},
  doi = {10.1109/ase63991.2025.00237}
}