Skip to content

Fix #16427 by including dataConOrigArgTys in an error message

Ryan Scott requested to merge RyanGlScott/ghc:wip/T16427 into master

The fix for #12087 (closed) wasn't quite robust enough to give a sensible error message for this program (from #16427 (closed)):

Prelude> data D where C :: Int -> forall b . b -> D

<interactive>:14:14: error:
    • GADT constructor type signature cannot contain nested ‘forall’s or contexts
      Suggestion: instead use this type signature: C :: forall b. b -> D
    • In the definition of data constructor ‘C’
      In the data type declaration for ‘D’

Oops! This happens because the suggestion in that error message only uses dataConOrigResTy, which very well may not have all of the arguments in the constructor's type. To ensure that we do have all of the arguments, we grab them from dataConOrigArgTys.

Merge request reports