Skip to content

Assertion in reportWanteds is too strict

There's an assertion in reportWanteds that checks that we aren't suppressing all the errors.

       -- This check makes sure that we aren't suppressing the only error that will
       -- actually stop compilation
       ; massert $
           null simples ||                  -- no errors to report here
           any ignoreConstraint simples ||  -- one error is ignorable (is reported elsewhere)
           not (all ei_suppress tidy_items) -- not all errors are suppressed

This is in the context of "Wanteds rewrite Wanteds", where we should always have one non-rewritten Wanted to report to the user.

This makes sense, but it doesn't seem to take into account implications. For instance, we could have an implication:

[W] hole{co1}
  ===>
[W] hole{co2} {{co1}} :: alpha ~# (beta |> co)

When we call reportWanteds on this implication, we have the unsolved unrewritten [W] hole{co1} to report. Fine. Then we recurse into the implication, and we have a single constraint [W] hole{co2} to report, which has been rewritten by [W] hole{co1}. This trips up the assertion (we only have rewritten Wanteds to report), even though at an outer level we reported an unrewritten Wanted.

@rae, do you agree that the assertion is wrong?

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information