DiffFix: Incrementally Fixing AST Diffs via Context and Type Information
Guofeng Zeng, Chang-Ai Sun, Kai Gao, Huai Liu
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.
Ask Lune
Know where this paper stands in minutes, not an afternoon.
Lune can read the top-tier papers that cite it and the ones closest to it, and tells you what it claims, what came after and where it falls short, each point cited to the paper it comes from. No skimming, no AI slop.
Related papers
- iASTMapper: An Iterative Similarity-Based Abstract Syntax Tree Mapping AlgorithmNeng Zhang, Qinde Chen, Zibin Zheng, Ying ZouASE 2023 · 2 citations
- A Differential Testing Approach for Evaluating Abstract Syntax Tree Mapping AlgorithmsYuanrui Fan, Xin Xia, David Lo, Ahmed E. Hassan et al.ICSE 2021 · 18 citations
- Fine-grained, accurate and scalable source differencingJean-Rémy Falleri, Matias MartinezICSE 2024 · 9 citations
- TransplantFix: Graph Differencing-based Code Transplantation for Automated Program RepairDeheng Yang, Xiaoguang Mao, Liqian Chen, Xuezheng Xu et al.ASE 2022 · 22 citations
- Concise, type-safe, and efficient structural diffingSebastian Erdweg, Tamás Szabó, André PacakPLDI 2021 · 6 citations
