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 type inference to constraint satisfaction. We then formulate the problem of computing minimum error sources in terms of weighted maximum satisfiability modulo theories (MaxSMT). Ranking criteria are incorporated by assigning weights to typing constraints. The reduction to MaxSMT allows us to built on SMT solvers to support rich type systems. We have implemented an instance of our framework targeted at Hindley-Milner type systems. We have evaluated our implementation on existing OCaml benchmarks for type error localization and showed that our approach can find minimum error sources subject to useful ranking criteria.
Video: http://www.infoq.com/presentations/mimimum-type-errors
Finding Minimum Type Error Sources (oopsla2014-pavlinovic.pdf) | 1.1MiB |
Thu 23 OctDisplayed time zone: Tijuana, Baja California change
15:30 - 17:00 | |||
15:30 22mTalk | CheckCell: Data Debugging for Spreadsheets OOPSLA Dan Barowy University of Massachusetts, Amherst, Dimitar Gochev University of Massachusetts, Amherst, Emery D. Berger University of Massachusetts, Amherst Link to publication | ||
15:52 22mTalk | Finding Minimum Type Error Sources OOPSLA Zvonimir Pavlinovic New York University, Tim King New York University, Thomas Wies New York University Link to publication File Attached | ||
16:15 22mTalk | Flint: Fixing Linearizability Violations OOPSLA Peng Liu Purdue University, Omer Tripp IBM Thomas J. Watson Research Center, Xiangyu Zhang Purdue University Link to publication | ||
16:37 22mTalk | Statistical Debugging for Real-World Performance Problems OOPSLA Link to publication |