一句话:提出 Static Blame 框架,静态揭示渐进类型程序中隐藏的数据流并刻画其运行时影响。
渐进类型用动态类型和一致性关系整合静态与动态类型,但一致性不传递,动态类型易掩盖错误数据流。本文提出并形式化 Static Blame,揭示渐进类型程序中隐藏的数据流,并建立静态数据流与运行时行为的对应关系。基于此,作者对潜在错误分类,形式化刻画各类错误对程序执行的可能影响,而非直接拒绝整个程序。他们在学术渐进类型语言 Grift 上实现 Static Blame,并用变异分析验证理论结果。结果显示,Static Blame 检测类型相关缺陷时具有较高精确率和召回率,并通过人工分类解释失败原因;运行时间随程序规模呈二次增长。
Abstract Gradual typing integrates static and dynamic typing by introducing a dynamic type and a consistency relation. A problem of gradual type systems is that dynamic types can easily hide erroneous data flows since consistency relations are not transitive. Therefore, a more rigorous static check is required to reveal these hidden data flows statically. However, in order to preserve the expressiveness of gradually typed languages, static checks for gradually typed languages cannot simply reject programs with potentially erroneous data flows. By contrast, a more reasonable request is to show how these data flows can affect the execution of the program. In this paper, we propose and formalize Static Blame , a framework that can reveal hidden data flows for gradually typed programs and establish the correspondence between static-time data flows and runtime behavior. With this correspondence, we build a classification of potential errors detected from hidden data flows and formally characterize the possible impact of potential errors in each category on program execution, without simply rejecting the whole program. We implemented Static Blame on Grift, an academic gradually typed language, and evaluated the effectiveness of Static Blame by mutation analysis to verify our theoretical results. Our findings revealed that Static Blame exhibits a notable level of precision and recall in detecting type-related bugs. Furthermore, we conducted a manual classification to elucidate the reasons behind instances of failure. We also evaluated the performance of Static Blame, showing a quadratic growth in run time as program size increases.