F# Compiler Messages
Well 2020, it’s time for my annual (F#) blog post.
I wrote my first FsAdvent post in 2018.
And then I followed up with another post in 2019.
So, what’s happened in my F# world since then? For one, I joined the amazing Quicken Loans so I could do F# full time. It’s been awesome! I also signed up for the most recent round of the F# Software Foundation’s Mentorship Program again — this time as both a mentor and mentee. I think I’ll do one or the other next time!
This year, I’d like to share a small contribution I made to F# documentation and invite you to participate.
Backstory
I was reviewing some code at work recently and I noticed that one of our F# project files was ignoring a few warnings, but I didn’t know what they were. It looked something like this:
Now imagine we had a code file like this:
The F# compiler normally yields a warning when it finds an incomplete pattern (not all cases are covered). However, because of the <NoWarn>0025</NoWarn>
node in the project file, the build output does not include the warning:
Build succeeded.
0 Warning(s)
0 Error(s)
Without the <NoWarn>
node, the build output is:
/somepath/FsAdvent2020.fs(8,11): warning FS0025: Incomplete pattern matches on this expression. For example, the value 'Hot' may indicate a case not covered by the pattern(s). [/somepath/FsAdvent2020.fsproj]
1 Warning(s)
0 Error(s)
Now, how would an F# developer know what FS0025
is? Well, they’re in luck …sort of. If they visit the F# compiler messages page, they’ll see a list of compiler messages. However, it’s far from complete. At the time of this writing, the table of contents looks like this:
How I Contributed
I didn’t know about the F# compiler messages page I mentioned above. I did a web search for a few F# specific errors and landed on a GitHub issue from December 2019, Documentation pages for F# compiler errors like C#. Perfect! Chet Husk did all of the hard work in January 2020. Then, with a little encouragement and guidance, I made some enhancements to the helper script and added message 0025
on incomplete pattern matching:
How You Can Contribute
- Use https://github.com/dotnet/docs/pull/21424 as a guide.
- See https://github.com/dotnet/docs/issues/16177#issuecomment-724426546 for tips on where to find the error numbers.
Good luck, and thank you for contributing to making F# better each and every year!
This post is part of #FsAdvent 2020 organized by Sergey Tihon.
For a listing of all posts, see the F# Advent Calendar in English 2020.
Thanks, Sergey!