Type Inference for Static Compilation of JavaScript (Extended Version)
Satish Chandra, Colin S. Gordon, Jean-Baptiste Jeannin, Cole, Schlesinger, Manu Sridharan, Frank Tip, Youngil Choi

TL;DR
This paper introduces a novel type inference system for a rich subset of JavaScript, enabling static compilation and optimization by inferring types even in complex code with prototype inheritance.
Contribution
It presents a new type system and inference algorithm that handle JavaScript's dynamic features, supporting recursive and abstract objects, and proving soundness.
Findings
Successfully inferred types for standard benchmarks
Enabled effective static compilation without manual annotations
Handled code with prototype inheritance and uninvoked functions
Abstract
We present a type system and inference algorithm for a rich subset of JavaScript equipped with objects, structural subtyping, prototype inheritance, and first-class methods. The type system supports abstract and recursive objects, and is expressive enough to accommodate several standard benchmarks with only minor workarounds. The invariants enforced by the types enable an ahead-of-time compiler to carry out optimizations typically beyond the reach of static compilers for dynamic languages. Unlike previous inference techniques for prototype inheritance, our algorithm uses a combination of lower and upper bound propagation to infer types and discover type errors in all code, including uninvoked functions. The inference is expressed in a simple constraint language, designed to leverage off-the-shelf fixed point solvers. We prove soundness for both the type system and inference algorithm.…
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.
Taxonomy
TopicsLogic, programming, and type systems · Software Engineering Research · Parallel Computing and Optimization Techniques
