FYI panic "flatten_args wandered into deeper water than usual"

Nicolas Frisby nicolas.frisby at gmail.com
Sun Jan 6 04:46:18 UTC 2019


While developing a typechecker plugin, I experienced this error message.

> ghc: panic! (the 'impossible' happened)
>   (GHC version 8.6.2 for x86_64-unknown-linux):
> flatten_args wandered into deeper water than usual
>   Call stack:
>       CallStack (from HasCallStack):
>         callStackDoc, called at compiler/utils/Outputable.hs:1160:37 in
ghc:Outputable
>         pprPanic, called at compiler/typecheck/TcFlatten.hs:1331:24 in
ghc:TcFlatten
>
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

I'm sending this email just in case a dev is curious how this panic arises
or if another plugin developer sees the same thing -- the error message is
not very informative, and the corresponding GHC source code is a bit obtuse.

Based on the relevant GHC source code and my recent plugin edits, I was
able to guess correctly that this was due to me generating an extra sort
argument to a promoted datacon. Specifically, I was incorrectly using

> mkTyConApp (promoteDataCon _) [typeKind k,k,...]

instead of just

> mkTyConApp (promoteDataCon _) [k,...]

Thanks! HTH. -Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20190105/7dc045c1/attachment.html>


More information about the ghc-devs mailing list