Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • changelog.d/T27359
    1
    +section: compiler
    
    2
    +issues: #27359
    
    3
    +mrs: !16142
    
    4
    +synopsis:
    
    5
    +  Fix ``Data.Data`` instance of ``HsCtxt`` to avoid a crash
    
    6
    +description:
    
    7
    +  The ``toConstr`` method of the ``Data.Data`` instance of ``HsCtxt`` now
    
    8
    +  uses ``abstractConstr`` instead of ``error``, which avoids it triggering
    
    9
    +  runtime crashes (e.g. when using ``-ddump-tc-ast``).

  • compiler/GHC/Hs/Instances.hs
    ... ... @@ -46,6 +46,7 @@ import GHC.Hs.ImpExp
    46 46
     import GHC.Parser.Annotation
    
    47 47
     import GHC.Types.Name.Reader (WithUserRdr(..))
    
    48 48
     import GHC.Types.InlinePragma (ActivationGhc)
    
    49
    +import GHC.Utils.Misc (abstractConstr)
    
    49 50
     import GHC.Data.BooleanFormula (BooleanFormula(..))
    
    50 51
     import Language.Haskell.Syntax.Decls
    
    51 52
     import Language.Haskell.Syntax.Decls.Foreign (CType(..), Header(..))
    
    ... ... @@ -673,7 +674,7 @@ deriving instance Eq (IE GhcTc)
    673 674
     instance Data HsCtxt where
    
    674 675
       gunfold _ _ _ = error "no gunfold for HsCtxt"
    
    675 676
       gfoldl _ k z = k z
    
    676
    -  toConstr = error "no toConstr for HsCtxt"
    
    677
    +  toConstr _ = abstractConstr "HsCtxt"
    
    677 678
       dataTypeOf = error "no dataTypeOf for HsCtxt"
    
    678 679
     
    
    679 680
     deriving instance Data XXExprGhcRn