paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Systematic identification and communication of type errors

类型错误的系统性识别与传达
JFP vol.282018匹配度 3/10 · 该论文属于类型系统与静态分析中的类型错误定位/修复方向,与 PL 相关,但不涉及用户核心关注的 LLM/Agent 与静态分析交叉、浮点程序分析或贝叶斯程序分析,也未以 ML/Agentic 程序为分析对象。引用 3 inbox
SHENG CHEN, MARTIN ERWIG
crossref: 2026-09-10

AI 速览

一句话:提出 counter-factual typing 与 variational typing,系统定位类型错误、生成纠错信息并排序呈现最可能原因。

类型推断失败时,错误可能源于多个候选位置,且类型信息有限使生成有用纠错信息十分困难。现有方法常不完备、未区分潜在原因,或几乎不说明如何消除错误。本文提出 counter-factual typing:在 AST 叶节点全面发现错误原因,为每个原因计算消除类型错误的消息,并排序后迭代呈现最可能原因。最大技术挑战是高效生成所有消息,其成本看似随表达式规模指数增长;作者借助 variational typing 复用共享子计算,只需对 ill-typed 表达式类型化一次即可生成全部消息。在文献中收集的大量例子上评估,结果表明该方法优于此前方法且计算可行。

问题
类型推断失败时,如何系统定位真正的错误原因,并向用户提供可操作的纠错信息。
方法
提出 counter-factual typing,在 AST 叶节点枚举错误原因并为每个原因生成消除消息、排序呈现;用 variational typing 复用共享计算,一次类型化生成所有消息。
评估
在从先前文献收集的大量示例上评估,显示该方法优于现有方法且计算可行。
原文摘要(Abstract)

Abstract When type inference fails, it is often difficult to pinpoint the cause of the type error among many potential candidates. Generating informative messages to remove the type error is another difficult task due to the limited availability of type information. Over the last three decades many approaches have been developed to help debug type errors. However, most of these methods suffer from one or more of the following problems: (1) Being incomplete, they miss the real cause. (2) They cover many potential causes without distinguishing them. (3) They provide little or no information for how to remove the type error. Any one of this problems can turn the type-error debugging process into a tedious and ineffective endeavor. To address this issue, we have developed a method named counter-factual typing , which (1) finds a comprehensive set of error causes in AST leaves, (2) computes an informative message on how to get rid of the type error for each error cause, and (3) ranks all messages and iteratively presents the message for the most likely error cause. The biggest technical challenge is the efficient generation of all error messages, which seems to be exponential in the size of the expression. We address this challenge by employing the idea of variational typing that systematically reuses computations for shared parts and generates all messages by typing the whole ill-typed expression only once. We have evaluated our approach over a large set of examples collected from previous publications in the literature. The evaluation result shows that our approach outperforms previous approaches and is computationally feasible.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot345,
  title = {Systematic identification and communication of type errors},
  author = {SHENG CHEN and MARTIN ERWIG},
  journal = {Journal of Functional Programming},
  volume = {28},
  year = {2018},
  doi = {10.1017/s095679681700020x}
}