Swift Mentorship Program - My journey

This summer through Swift Mentorship Program, I worked with my mentor @anthonylatsis on contributing to the Swift Programming Language compiler. Here, I will share my journey and what I've learned!


Currently, I'm a junior at Reed College (Portland, OR) working towards my Computer Science degree. I decided to learn Swift for fun around 2 years ago, but have actually been doing iOS development for around 1.5 years. Since my school's CS curriculum is theory-heavy, iOS development was always a hobby for me. I also love Swift as a programming language, since it's strongly typed, easy to read and code with, and has a nice standard library. All of that led to my interest in the Swift Mentorship Program. I was previously aware that Swift was open-source, but I felt like I wouldn't be able to make meaningful contributions due to my lack of expertise in compilers. However, I really wanted to contribute to my favorite language, so the program seemed like the best option for me.

:dart:The Goals

At the time of the mentorship program, even though I was working full-time as a summer intern (doing iOS development, of course!), I still wanted to get the most out of it. I was excited to look into ins and outs of Swift! Therefore, my main goals were to understand how Swift Compiler works and to make at least one contribution.

:rocket:The Journey

When I started the program, I spent the entirety of the first week trying to build the compiler on my machine and make sense of where everything was located. The code base is huge and it's easy to get lost at first.
I didn't know where to start, so my mentor @anthonylatsis found my first bug to look at. Essentially, it was dealing with the compiler failing to correctly parse an expression with a bit-shifting operator and instead thinking of it as a start of the generic arguments list. Long story short, it turned into this PR. Due to this behavior being a well-known disambiguation problem, and a huge discussion on whether we should merge this, we decided not to. As a solution, I made this issue requesting better diagnostics in that case.
The second bug we solved was a simple code completion improvement for for ... in loops. Now, the in keyword will be an option for code completion. I really wanted to know how code completion works in Swift, so working on this bug was really interesting!
The other bug we solved was dealing with a semantic analysis issue in a case with collection literals with defaulted types. Now, users will get exhaustive diagnostics for collection literals with no specified element type.
And one other bug we solved was a compiler crash when resolving extension with unbound generic type.

:thought_balloon:My Thoughts & Reflection

When I started, I was really overwhelmed by the codebase and had to consult with my mentor on every step I've taken, because I was very worried about taking the wrong step. Basically, for the first couple of weeks, I was really lost. However, as time went on, I became more and more familiar with the codebase, the guidelines for formatting the code, and correctly writing commits and pull requests. I also became more confident in my ability to correctly decipher the C++ code and identify the source of the bug I was working on.

I learned a lot from this program, and I cannot thank enough the Swift Community for this initiative. It is especially meaningful for me, as a minority in CS. I got to know how exactly the Swift compiler works, became a pro in Git, and made my first-ever contribution to open-source! And most importantly, I learned that everyone can do it! It looks very scary at first, but every open-source project like Swift has bugs that you don't need to be a pro in the codebase to be able to solve.

:ringer_planet:Future Plans

The program has come to an end, and I'm finishing it with increased confidence in myself, and happiness that I've improved my favorite language! I hope to contribute to Swift even more in the future, and apply my gained knowledge in my CS education.

Thank you for this opportunity!