A practical framework for type inference error explanation

被引:0
|
作者
Loncaric C. [1 ]
Chandra S. [2 ]
Schlesinger C. [2 ]
Sridharan M. [2 ]
机构
[1] University of Washington, Seattle, WA
[2] Samsung Research, Mountain View, CA
来源
| 1600年 / Association for Computing Machinery, 2 Penn Plaza, Suite 701, New York, NY 10121-0701, United States卷 / 51期
关键词
Type Error Diagnosis; Type Inference;
D O I
10.1145/2983990.2983994
中图分类号
学科分类号
摘要
Many languages have support for automatic type inference. But when inference fails, the reported error messages can be unhelpful, highlighting a code location far from the source of the problem. Several lines of work have emerged proposing error reports derived from correcting sets: a set of program points that, when fixed, produce a well-typed program. Unfortunately, these approaches are tightly tied to specific languages; targeting a new language requires encoding a type inference algorithm for the language in a custom constraint system specific to the error reporting tool. We show how to produce correcting set-based error reports by leveraging existing type inference implementations, easing the burden of adoption and, as type inference algorithms tend to be efficient in practice, producing error reports of comparable quality to similar error reporting tools orders of magnitude faster. Many type inference algorithms are already formulated as dual phases of type constraint generation and solving; rather than (re)implementing type inference in an error explanation tool, we isolate the solving phase and treat it as an oracle for solving typing constraints. Given any set of typing constraints, error explanation proceeds by iteratively removing conflicting constraints from the initial constraint set until discovering a subset on which the solver succeeds; the constraints removed form a correcting set. Our approach is agnostic to the semantics of any particular language or type system, instead leveraging the existing type inference engine to give meaning to constraints. © 2016 ACM.
引用
收藏
页码:781 / 799
页数:18
相关论文
共 50 条
  • [41] Putting explanation back into "inference to the best explanation"
    Lange, Marc
    NOUS, 2022, 56 (01): : 84 - 109
  • [42] The Contextual Theory of Explanation and Inference to the Best Explanation
    Seungbae Park
    Axiomathes, 2022, 32 : 311 - 326
  • [43] The Contextual Theory of Explanation and Inference to the Best Explanation
    Park, Seungbae
    AXIOMATHES, 2022, 32 (SUPPL 2): : 311 - 326
  • [44] Expansion: the Crucial Mechanism for Type Inference with Intersection Types: A Survey and Explanation
    Wells, Sebastien Carlier J. B.
    ELECTRONIC NOTES IN THEORETICAL COMPUTER SCIENCE, 2005, 136 : 173 - 202
  • [45] Error and Inference
    Hennig, Christian
    THEORIA-REVISTA DE TEORIA HISTORIA Y FUNDAMENTOS DE LA CIENCIA, 2012, 27 (02): : 245 - 247
  • [46] Explanation and confirmation: A bayesian critique of inference to the best explanation
    Salmon, WC
    EXPLANATION: THEORETICAL APPROACHES AND APPLICATIONS, 2001, 302 : 61 - 91
  • [47] PRACTICAL INFERENCE
    VONWRIGHT, GH
    PHILOSOPHICAL REVIEW, 1963, 72 (02): : 159 - 179
  • [48] Practical inference for type-based termination in a polymorphic setting
    Barthe, G
    Grégoire, B
    Pastawski, F
    TYPED LAMBDA CALCULI AND APPLICATIONS, PROCEEDINGS, 2005, 3461 : 71 - 85
  • [49] Practical SMT-Based Type Error Localization
    Pavlinovic, Zvonimir
    King, Tim
    Wies, Thomas
    PROCEEDINGS OF THE 20TH ACM SIGPLAN INTERNATIONAL CONFERENCE ON FUNCTIONAL PROGRAMMING (ICFP'15), 2015, : 412 - 423
  • [50] Practical SMT-Based Type Error Localization
    Pavlinovic, Zvonimir
    King, Tim
    Wies, Thomas
    ACM SIGPLAN NOTICES, 2015, 50 (09) : 412 - 423