一句话:提出类型感知神经修复模型 Tare,用 T-Grammar 与 T-Graph 编码类型规则,减少不可类型化补丁。
基于深度学习的自动程序修复(APR)虽性能可观,却普遍生成大量无法通过类型检查的补丁,原因在于现有模型未考虑类型规则约束。本文提出类型感知模型 Tare 来学习类型规则,包含三个新组件:将类型信息融入标准文法的 T-Grammar、整合 AST 类型检查所需关键信息的代码表示 T-Graph,以及编码 T-Graph 并由 T-Grammar 引导生成补丁的类型感知神经修复方法。实验在三个基准上进行:Defects4J v1.2 的 393 个 bug、Defects4J v2.0 的 444 个额外 bug 以及 QuixBugs 的 40 个 bug。结果显示 Tare 分别修复 62、32 和 27 个 bug,在所有基准上均优于现有 APR 方法,且分析表明借助类型规则信息,它比现有 DL-based APR 方法倾向于生成更多可编译补丁。
Automated program repair (APR) aims to reduce the effort of software development. With the development of deep learning, lots of DL-based APR approaches have been proposed using an encoder-decoder architecture. Despite the promising performance, these models share the same limitation: generating lots of untypable patches. The main reason for this phenomenon is that the existing models do not consider the constraints of code captured by a set of typing rules. In this paper, we propose, Tare, a type-aware model for neural program repair to learn the typing rules. To encode an individual typing rule, we introduce three novel components: (1) a novel type of grammars, T-Grammar, that integrates the type information into a standard grammar, (2) a novel representation of code, T-Graph, that integrates the key information needed for type checking an AST, and (3) a novel type-aware neural program repair approach, Tare, that encodes the T-Graph and generates the patches guided by T-Grammar. The experiment was conducted on three benchmarks, 393 bugs from Defects4J v1.2, 444 additional bugs from Defects4J v2.0, and 40 bugs from QuixBugs. Our results show that Tare repairs 62, 32, and 27 bugs on these benchmarks respectively, and outperforms the existing APR approaches on all benchmarks. Further analysis also shows that Tare tends to generate more compilable patches than the existing DL-based APR approaches with the typing rule information.