Skip to content

Make dsWhenNoErrs return an error of the correct type instead of unitExpr

sheaf requested to merge sheaf/ghc:T18149 into master

This fixes #18149 (closed) & #14765 (closed) by passing the type of the resulting Core expression as an extra argument to dsWhenNoErrs, and use it when there is a representation-polymorphism error to return an error expression of the correct type, instead of () (which has the wrong type and thus could cause a cascade of errors downstream).

The note [Desugaring representation-polymorphic applications] in GHC.HsToCore.Utils explains the mechanism in more detail.

Edited by sheaf

Merge request reports