TL;DR
TypeWriter combines probabilistic type prediction with search-based validation to improve type annotation accuracy in dynamically typed languages like Python, aiding large codebase maintenance and developer support.
Contribution
It introduces a novel approach that integrates probabilistic type prediction with search-based refinement, outperforming prior models in accuracy and coverage.
Findings
Achieves an F1 score of 0.64 for return types and 0.57 for argument types.
Fully annotates 14% to 44% of files with ensured type correctness.
Many suggested types have been accepted with minimal changes at Facebook.
Abstract
Maintaining large code bases written in dynamically typed languages, such as JavaScript or Python, can be challenging due to the absence of type annotations: simple data compatibility errors proliferate, IDE support is limited, and APIs are hard to comprehend. Recent work attempts to address those issues through either static type inference or probabilistic type prediction. Unfortunately, static type inference for dynamic languages is inherently limited, while probabilistic approaches suffer from imprecision. This paper presents TypeWriter, the first combination of probabilistic type prediction with search-based refinement of predicted types. TypeWriter's predictor learns to infer the return and argument types for functions from partially annotated code bases by combining the natural language properties of code with programming language-level information. To validate predicted types,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
