DEV Community

Cover image for Fixing a bug in the F# compiler

Fixing a bug in the F# compiler

asik profile image André Slupik Updated on ・2 min read

A couple weeks ago, a PR of mine was merged into the F# compiler repo, fixing an issue that bothered me with unused open statement detection. Even just a few years ago, this would have seemed like a daunting task to me, so this felt like a real achievement.

A great motivator for me was to watch this relaxed, slow-moving presentation from Don Syme (the man himself), fixing a bug in the compiler live. It is filled with useful nuggets of information about the structure of the codebase and coding conventions, and that definitely helped me get around and understand what I was looking at.

I then read the available documentation, which is high quality: the README, the DEVGUIDE, and the Compiler Guide. I really appreciate that all this documentation is right there in the repo, it makes it easy to access, consume and update.

Having worked with Github daily for about a year, I had become familiar with the PR process. Nonetheless, one mistake I made was to clone the actual dotnet/fsharp repo instead of forking it and then cloning my fork; once I had the fix commited, I was unable to push it as, of course, I don't have the rights on dotnet/fsharp. If that happens to you, it's easy to retarget your local repo to your fork with

git remote set-url origin

Now you'll be able to git push your changes as they'll go to your fork.

I made the mistake of trying to debug the F# tools on the currently released Visual Studio. Currently, this requires Visual Studio Preview, which can be installed side-by-side.

I also got a mysterious error trying to run the tests but you can always run the tests directly on the compiled dll with dotnet test <your test dll>. I also added --verbosity detailed to get the result of each test printed to the console.

Overall, I'm surprised the process was so straightforward for what is a large codebase with a long history. The F# tools definitely need some love, so I hope this helps someone out there trying to improve them.


Editor guide
sirseanofloxley profile image
Sean Allin Newell

Glad to hear it, I might give this a go and tackle some issues if I can find some time knowing it's so well documented.