Abstract
AbstractWhen 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.
Publisher
Cambridge University Press (CUP)
Reference50 articles.
1. Chen S. , Erwig M. & Walkingshaw E. (2012) An error-tolerant type system for variational lambda calculus. In Proceedings of ACM International Conference on Functional Programming, pp. 29–40.
2. Zhang D. & Myers A. C. (2014) Toward general diagnosis of static errors. In Proceedings of ACM Symposium on Principles of Programming Languages, pp. 569–581.
3. Yang J. (2001 May). Improving Polymorphic Type Explanations. Ph.D. thesis, Heriot-Watt University.
4. McAdam B. J. (2002b). Repairing Type Errors in Functional Programs. Ph.D. thesis, University of Edinburgh. College of Science and Engineering. School of Informatics.
5. Interactive type debugging in Haskell
Cited by
4 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Error Localization for Sequential Effect Systems;Static Analysis;2023
2. Efficient counter-factual type error debugging;Science of Computer Programming;2020-12
3. Live functional programming with typed holes;Proceedings of the ACM on Programming Languages;2019-01-02
4. Gradual liquid type inference;Proceedings of the ACM on Programming Languages;2018-10-24