Title
Practical SMT-based type error localization
Abstract
Compilers for statically typed functional programming languages are notorious for generating confusing type error messages. When the compiler detects a type error, it typically reports the program location where the type checking failed as the source of the error. Since other error sources are not even considered, the actual root cause is often missed. A more adequate approach is to consider all possible error sources and report the most useful one subject to some usefulness criterion. In our previous work, we showed that this approach can be formulated as an optimization problem related to satisfiability modulo theories (SMT). This formulation cleanly separates the heuristic nature of usefulness criteria from the underlying search problem. Unfortunately, algorithms that search for an optimal error source cannot directly use principal types which are crucial for dealing with the exponential-time complexity of the decision problem of polymorphic type checking. In this paper, we present a new algorithm that efficiently finds an optimal error source in a given ill-typed program. Our algorithm uses an improved SMT encoding to cope with the high complexity of polymorphic typing by iteratively expanding the typing constraints from which principal types are derived. The algorithm preserves the clean separation between the heuristics and the actual search. We have implemented our algorithm for OCaml. In our experimental evaluation, we found that the algorithm reduces the running times for optimal type error localization from minutes to seconds and scales better than previous localization algorithms.
Year
DOI
Venue
2015
10.1145/2784731.2784765
Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
Keywords
Field
DocType
satisfiability modulo theories
Decision problem,Heuristic,Programming language,Functional programming,Computer science,Algorithm,Theoretical computer science,Compiler,Heuristics,Search problem,Optimization problem,Satisfiability modulo theories
Journal
Volume
Issue
ISSN
abs/1508.06836
9
0362-1340
ISBN
Citations 
PageRank 
978-1-4503-3669-7
1
0.36
References 
Authors
0
3
Name
Order
Citations
PageRank
Zvonimir Pavlinovic1193.01
Tim King 00012302.51
Thomas Wies3130.91