paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Pluggable Type Inference for Free

无需类型系统特定代码的可插拔类型推断
ASE 2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)2023匹配度 3/10 · 论文是纯 PL 的可插拔类型推断,复用局部推断并落地到 Checker Framework,属于静态分析/类型系统方向;但未涉及 LLM/Agent、浮点程序分析或贝叶斯程序分析,与用户画像中 AI×PL 的核心交叉点没有直接关联。引用 5 inbox
Martin Kellogg, Daniel Daskiewicz, Loi Ngo Duc Nguyen, Muyeed Ahmed, Michael D. Ernst
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出通用可插拔类型推断算法,复用局部推断,在 Checker Framework 实现,平均减少 45% 待注解警告。

可插拔类型系统用类型限定符(如 nonnull、secret)扩展宿主语言,能发现更多错误,但程序员须手写限定符,这是实际采用的主要障碍。传统类型推断与具体类型系统绑定,每新增系统都要实现约束生成与求解。本文观察到实用可插拔类型系统是流敏感的,已实现局部推断,于是提出迭代式全局推断:每轮复用局部推断为过程和字段生成摘要,后续轮次利用摘要改进全程序推断,直至摘要达到不动点。该算法可在框架层实现一次并被所有类型检查器复用。作者在 Checker Framework 上实现,用 11 个类型系统和 12 个项目评估,平均减少 45% 需通过注解解决的警告。

问题
程序员必须为可插拔类型系统手动编写类型限定符,且传统类型推断需针对每个类型系统单独实现。
方法
复用流敏感类型系统已有的局部类型推断,迭代生成过程与字段摘要至不动点,并在框架层实现一次以复用。
评估
在 Checker Framework 的 11 个可插拔类型系统和 12 个项目上实验,平均减少 45% 需手动注解消除的警告。
原文摘要(Abstract)

A pluggable type system extends a host programming language with type qualifiers. It lets programmers write types like unsigned int, secret string, and nonnull object. Typechecking with pluggable types detects and prevents more errors than the host type system. However, programmers must write type qualifiers; this is the biggest obstacle to use of pluggable types in practice. Type inference can solve this problem. Traditional approaches to type inference are type-system-specific: for each new pluggable type system, the type inference algorithm must be extended to build and then solve a system of constraints corresponding to the rules of the underlying type system. We propose a novel type inference algorithm that can infer type qualifiers for any pluggable type system with little to no new type-system-specific code-that is, “for free”. The key insight is that extant practical pluggable type systems are flow-sensitive and therefore already implement local type inference. Using this insight, we can derive a global inference algorithm by re-using existing implementations of local inference. Our algorithm runs iteratively in rounds. Each round uses the results of local type inference to produce summaries (specifications) for procedures and fields. These summaries enable improved inference throughout the program in subsequent rounds. The algorithm terminates when the inferred summaries reach a fixed point. In practice, many pluggable type systems are built on frameworks. By implementing our algorithm once, at the framework level, it can be reused by any typechecker built using that frame-work. Using that insight, we have implemented our algorithm for the open-source Checker Framework project, which is widely used in industry and on which dozens of specialized pluggable typecheckers have been built. In experiments with 11 distinct pluggable type systems and 12 projects, our algorithm reduced, by 45 % on average, the number of warnings that developers must resolve by writing annotations.

链接与引用

DOI 原文 · DBLP

BibTeX
@inproceedings{KelloggDNAE23,
  title = {Pluggable Type Inference for Free},
  author = {Martin Kellogg and Daniel Daskiewicz and Loi Ngo Duc Nguyen and Muyeed Ahmed and Michael D. Ernst},
  booktitle = {ASE},
  year = {2023},
  doi = {10.1109/ase56229.2023.00186}
}