GHC API users can easily hit bottoming BreakArray
Recently I encountered a GHC crash exposed by ghcide, which loads modules via the GHC API and calls the desugarer with hscTarget == HscNothing
. In this case the Coverage.addTicksToBinds
can return emptyModBreaks
, which contains a bottom, as the module's ModBreaks
. Eventually if the client then calls the bytecode generator and tries to load the bytecode that results (e.g. due to the need to evaluate a Template Haskell splice) it will hit this bottom and crash.
In the case that hscTarget
is HscNothing
we really shouldn't even be returning any ModBreaks
(N.B. this is possible as mg_modbreaks
is a Maybe ModBreaks
). This would avoid this entire failure mode.
See also: https://github.com/digital-asset/ghcide/issues/537