Catch and report errors during hole fitting

Authored by mgsloan on Jun 29 2018, 4:44 AM.



The purpose of this is to still show the informative error message, even if an
error is encountered while hole fitting. The following trac tickets are all
examples of cases where the output would benefit from this change:

For example, a repro similar to 15007 now has the following output:

<interactive>:5:5: error:

• Found hole: _ :: a
  Where: ‘a’ is a rigid type variable bound by
           the inferred type of it :: Num a => a
           at <interactive>:5:1-5
• In the second argument of ‘(+)’, namely ‘_’
  In the expression: 1 + _
  In an equation for ‘it’: it = 1 + _
• Relevant bindings include it :: a (bound at <interactive>:5:1)
  Constraints include Num a (from <interactive>:5:1-5)
  Unexpected error(s) during hole fitting
    <interactive>:1:1: error:
        GHC internal error: ‘’ is not in scope during type checking, but it passed the renamer
        tcl_env of environment: []
    Please report this as a GHC bug:
Test Plan

Manually tested

mgsloan created this revision.Jun 29 2018, 4:44 AM
mgsloan abandoned this revision.Jun 29 2018, 5:22 AM

I'm abandoning this revision for now, because I think that putting some fine-grained catching within findValidHoleFits would be better. Here's some discussion on trac for context: