Improving the Debug Output Of The Type Inference Algorithm
- Mentors
- Pavel Yaskevich
- Organization
- Swift
- Technologies
- c++, swift, compilers
- Topics
- compilers, debugging, Swift
Swift’s type inference algorithm allows us to write source code without explicit type notations. It is implemented using a type checker that breaks up the source code into subexpressions and generates their abstract type variables and type relationships to create a constraint system that maps out all of these components of the subexpressions of the source code and helps the compiler deduce the missing concrete type information from this context. These type variables, their interrelationships, and the final type-checked expressions can be printed as debug information to help compiler developers understand this process. However, the current debug output is hard to understand, wordy and repetitive, with a format that is difficult to follow. This proposal will reorganize and rewrite the debug output of the type inference algorithm to make it more human-friendly and improve the debugging experience for new and experienced Swift compiler developers.