Abstract | ||
---|---|---|
Automatic type inference is a popular feature of functional programming languages. If a program cannot be typed, the compiler typically reports a single program location in its error message. This location is the point where the type inference failed, but not necessarily the actual source of the error. Other potential error sources are not even considered. Hence, the compiler often misses the true error source, which increases debugging time for the programmer. In this paper, we present a general framework for automatic localization of type errors. Our algorithm finds all minimum error sources, where the exact definition of minimum is given in terms of a compiler-specific ranking criterion. Compilers can use minimum error sources to produce more meaningful error reports, and for automatic error correction. Our approach works by reducing the search for minimum error sources to an optimization problem that we formulate in terms of weighted maximum satisfiability modulo theories (MaxSMT). The reduction to weighted MaxSMT allows us to build on SMT solvers to support rich type systems and at the same time abstract from the concrete criterion that is used for ranking the error sources. We have implemented an instance of our framework targeted at Hindley-Milner type systems and evaluated it on existing OCaml benchmarks for type error localization. Our evaluation shows that our approach has the potential to significantly improve the quality of type error reports produced by state of the art compilers. |
Year | DOI | Venue |
---|---|---|
2014 | 10.1145/2660193.2660230 | Software Engineering & Management |
Keywords | DocType | Volume |
diagnostics,program analysis,satisfiability modulo theories,type errors | Conference | 49 |
Issue | ISSN | Citations |
10 | 0362-1340 | 12 |
PageRank | References | Authors |
0.55 | 24 | 3 |
Name | Order | Citations | PageRank |
---|---|---|---|
Zvonimir Pavlinovic | 1 | 19 | 3.01 |
Tim King 0001 | 2 | 30 | 2.51 |
Thomas Wies | 3 | 13 | 0.91 |