Getting into the Flow: Towards Better Type Error Messages for Constraint-Based Type Inference

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Bhanuka, Ishan, Parreaux, Lionel, Binder, David, Brachthäuser, Jonathan Immanuel
Formato: Preprint
Publicado: 2024
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866909112141348864
author Bhanuka, Ishan
Parreaux, Lionel
Binder, David
Brachthäuser, Jonathan Immanuel
author_facet Bhanuka, Ishan
Parreaux, Lionel
Binder, David
Brachthäuser, Jonathan Immanuel
contents Creating good type error messages for constraint-based type inference systems is difficult. Typical type error messages reflect implementation details of the underlying constraint-solving algorithms rather than the specific factors leading to type mismatches. We propose using subtyping constraints that capture data flow to classify and explain type errors. Our algorithm explains type errors as faulty data flows, which programmers are already used to reasoning about, and illustrates these data flows as sequences of relevant program locations. We show that our ideas and algorithm are not limited to languages with subtyping, as they can be readily integrated with Hindley-Milner type inference. In addition to these core contributions, we present the results of a user study to evaluate the quality of our messages compared to other implementations. While the quantitative evaluation does not show that flow-based messages improve the localization or understanding of the causes of type errors, the qualitative evaluation suggests a real need and demand for flow-based messages.
format Preprint
id arxiv_https___arxiv_org_abs_2402_12637
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Getting into the Flow: Towards Better Type Error Messages for Constraint-Based Type Inference
Bhanuka, Ishan
Parreaux, Lionel
Binder, David
Brachthäuser, Jonathan Immanuel
Programming Languages
Human-Computer Interaction
Creating good type error messages for constraint-based type inference systems is difficult. Typical type error messages reflect implementation details of the underlying constraint-solving algorithms rather than the specific factors leading to type mismatches. We propose using subtyping constraints that capture data flow to classify and explain type errors. Our algorithm explains type errors as faulty data flows, which programmers are already used to reasoning about, and illustrates these data flows as sequences of relevant program locations. We show that our ideas and algorithm are not limited to languages with subtyping, as they can be readily integrated with Hindley-Milner type inference. In addition to these core contributions, we present the results of a user study to evaluate the quality of our messages compared to other implementations. While the quantitative evaluation does not show that flow-based messages improve the localization or understanding of the causes of type errors, the qualitative evaluation suggests a real need and demand for flow-based messages.
title Getting into the Flow: Towards Better Type Error Messages for Constraint-Based Type Inference
topic Programming Languages
Human-Computer Interaction
url https://arxiv.org/abs/2402.12637