liquidhaskell icon indicating copy to clipboard operation
liquidhaskell copied to clipboard

Odd GHC panic `getFunName`

Open ranjitjhala opened this issue 5 years ago • 1 comments

GHC panic

When using LH in plugin mode with either voltron or disco we get this error (if we disable --compile-spec) on the Auth.hs module

https://github.com/binah-framework/voltron/tree/package

ghc: panic! (the 'impossible' happened)
  (GHC version 8.10.2:
	Uh oh.
    getFunName on 	Control.Monad.Time.$fMonadTimet
  @ (Control.Monad.Trans.Reader.ReaderT
       Database.Persist.Sql.Types.Internal.SqlBackend
       (Frankie.Config.ConfigT
          Controllers.Config
          (Frankie.Controller.ControllerT Binah.Infrastructure.TIO)))
  @ (Binah.Infrastructure.TaggedT
       (Database.Persist.Class.PersistEntity.Entity Model.User))
  $dMonadTime_atSa
  lq_anf$##7205759403792912202

Also when checking the Server.hs file we get this:

[13 of 13] Compiling Server
ghc: panic! (the 'impossible' happened)
  (GHC version 8.10.2:
	error-strictResolveSymUnknown type constructor `Update`
    ofBDataDecl-2
CallStack (from HasCallStack):
  error, called at src/Language/Fixpoint/Misc.hs:152:14 in liquid-fixpoint-0.8.10.2.1-2YB6ojANCz25qTCkqBw6u8:Language.Fixpoint.Misc

unless we add the bogus imports ...

import           Binah.SMTP             -- TODO: DUMMY RECURSIVE IMPORTS for LH
import           Binah.Updates          -- TODO: DUMMY RECURSIVE IMPORTS for LH 

ranjitjhala avatar Oct 05 '20 21:10 ranjitjhala

I've experienced a similar bug a couple of times recently, though it's very hard to reproduce and seems sometimes to relate to cached compilation files. Here are the situations that I've found the error and how I worked around it.


First example:

<no source information>:1:1: error:
    • Unknown type constructor `Data.Map.Internal.Map`
    matchTyCon: Data.Map.Internal.Map
    •
  • This error occurs (I think) in a module A which defines a newtype. Its possible that the bug is actually triggered in another module which imports A. It's not clear.
  • I've worked-around this error by adding a noop data refinement in module A to the newtype in question. I don't know why this resolves the issue.
    • {-# LANGUAGE QuasiQuotes #-}
    • import LiquidHaskell (lq)
    • [lq| newtype Foo = Foo (Map UUID ...) |]

Second example:

<no source information>:1:1: error:
    • Unknown type constructor `Data.UUID.Types.Internal.UUID`
    matchTyCon: Data.UUID.Types.Internal.UUID
    •
  • This error occurs (I think) in module B which imports the module A above.
  • I've worked-around this error by adding import Data.UUID (UUID) to module B as recommended by @ranjitjhala.

plredmond avatar Oct 23 '20 18:10 plredmond