The CNF Converter is a gem.
https://github.com/scala/scala/blob/v2.13.5/src/compiler/sca...
I don't know anything about the Scala compiler. A few years ago I needed a CNF Converter and I ripped their Logic Module.
(performant CNF Converter are harder to find than SAT Solver)
Fabrice Le Fessant, Luc Maranget, Optimizing Pattern-Matching ICFP'2001 http://pauillac.inria.fr/~maranget/papers/opat/