Write a Blog >>
Thu 12 Nov 2020 08:09 - 08:10 at Virtual room 1 - Analysis 3

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, TypeWriter invokes a gradual type checker with different combinations of the predicted types, while navigating the space of possible type combinations in a feedback-directed manner. We implement the TypeWriter approach for Python and evaluate it on two code corpora: a multi-million line code base at Facebook and a collection of 1,137 popular open-source projects. We show that TypeWriter’s type predictor achieves an F1 score of 0.64 (0.79) in the top-1 (top-5) predictions for return types, and 0.57 (0.80) for argument types, which clearly outperforms prior type prediction models. By combining predictions with search-based validation, TypeWriter can fully annotate between 14% to 44% of the files in a randomly selected corpus, while ensuring type correctness. A comparison with a static type inference tool shows that TypeWriter adds many more non-trivial types. TypeWriter currently suggests types to developers at Facebook and several thousands of types have already been accepted with minimal changes.

Thu 12 Nov

Displayed time zone: (UTC) Coordinated Universal Time change

08:00 - 08:30
08:00
2m
Talk
Flexeme: Untangling Commits Using Lexical Flows
Research Papers
Profir-Petru Pârțachi University College London, UK, Santanu Dash University of Surrey, UK, Miltiadis Allamanis Microsoft Research, UK, Earl T. Barr University College London, UK
DOI Pre-print Media Attached File Attached
08:03
1m
Talk
FREPA: An Automated and Formal Approach to Requirement Modeling and Analysis in Aircraft Control Domain
Industry Papers
Jincao Feng East China Normal University, Weikai Miao East China Normal University, China, Hanyue Zheng East China Normal University, Yihao Huang East China Normal University, Jianwen Li East China Normal University, China, Zheng Wang Beijing Sunwise Information Technology, China, Ting Su East China Normal University, China, Bin Gu Beijing Institute of Control Engineering, China, Geguang Pu Shanghai Trusted Industrial Control Platform, China, Mengfei Yang China Academy of Space Technology, China, Jifeng He Shanghai Key Lab of Trustworthy Computing, China
DOI
08:05
1m
Talk
Mining Assumptions for Software Components using Machine Learning
Research Papers
Khouloud Gaaloul University of Luxembourg, Luxembourg, Claudio Menghi University of Luxembourg, Luxembourg, Shiva Nejati University of Ottawa, Canada / University of Luxembourg, Luxembourg, Lionel Briand University of Ottawa, Canada / University of Luxembourg, Luxembourg, David Wolfe QRA, Canada
DOI
08:07
1m
Talk
Mining Input Grammars from Dynamic Control Flow
Research Papers
Rahul Gopinath CISPA, Germany, Björn Mathis CISPA, Germany, Andreas Zeller CISPA, Germany
DOI
08:09
1m
Talk
TypeWriter: Neural Type Prediction with Search-Based Validation
Research Papers
Michael Pradel University of Stuttgart, Germany, Georgios Gousios Facebook & Delft University of Technology, Jason Liu Facebook, USA, Satish Chandra Facebook, USA
DOI Pre-print Media Attached
08:11
19m
Talk
Conversations on Analysis 3
Paper Presentations
Khouloud Gaaloul University of Luxembourg, Luxembourg, Michael Pradel University of Stuttgart, Germany, Profir-Petru Pârțachi University College London, UK, Rahul Gopinath CISPA, Germany, M: Dan Hao Peking University, China