Andrea Vezzosi pushed to branch wip/romes/async-rpc at Glasgow Haskell Compiler / GHC
Commits:
-
b9d03135
by Andrea Vezzosi at 2026-11-13T10:41:57+01:00
23 changed files:
- libraries/ghc-internal/src/GHC/Internal/TH/Monad.hs
- libraries/template-haskell/Language/Haskell/TH/Syntax.hs
- libraries/template-haskell/template-haskell.cabal.in
- testsuite/tests/interface-stability/template-haskell-exports.stdout
- testsuite/tests/plugins/plugins10.stdout
- + testsuite/tests/th/T8987c.hs
- + testsuite/tests/th/T8987c.stderr
- + testsuite/tests/th/T8987d.hs
- + testsuite/tests/th/T8987d0.stderr
- + testsuite/tests/th/T8987d1.stderr
- + testsuite/tests/th/T8987d10.stderr
- + testsuite/tests/th/T8987d11.stderr
- + testsuite/tests/th/T8987d12.stderr
- + testsuite/tests/th/T8987d13.stderr
- + testsuite/tests/th/T8987d2.stderr
- + testsuite/tests/th/T8987d3.stderr
- + testsuite/tests/th/T8987d4.stderr
- + testsuite/tests/th/T8987d5.stderr
- + testsuite/tests/th/T8987d6.stderr
- + testsuite/tests/th/T8987d7.stderr
- + testsuite/tests/th/T8987d8.stderr
- + testsuite/tests/th/T8987d9.stderr
- testsuite/tests/th/all.T
Changes:
| ... | ... | @@ -46,6 +46,7 @@ import GHC.Internal.Control.Monad.IO.Class |
| 46 | 46 | import GHC.Internal.Control.Monad.Fail
|
| 47 | 47 | import GHC.Internal.Maybe (Maybe)
|
| 48 | 48 | import GHC.Internal.Num
|
| 49 | +import GHC.Internal.Prim (seq)
|
|
| 49 | 50 | import GHC.Internal.IO.Unsafe
|
| 50 | 51 | import qualified GHC.Internal.Types as Kind (Type)
|
| 51 | 52 | import qualified GHC.Internal.Data.Typeable.Internal as Rebindable
|
| ... | ... | @@ -298,7 +299,10 @@ class Monad m => Quote m where |
| 298 | 299 | newName :: String -> m Name
|
| 299 | 300 | |
| 300 | 301 | instance Quote Q where
|
| 301 | - newName s = Q $ \h -> mNewName h s
|
|
| 302 | + newName s = seqList s $ Q $ \h -> mNewName h s
|
|
| 303 | + where
|
|
| 304 | + seqList [] b = b
|
|
| 305 | + seqList (a:as) b = a `seq` seqList as b
|
|
| 302 | 306 | |
| 303 | 307 | -----------------------------------------------------
|
| 304 | 308 | --
|
| ... | ... | @@ -496,7 +500,10 @@ joinCode = flip bindCode id |
| 496 | 500 | -- | Report an error (True) or warning (False),
|
| 497 | 501 | -- but carry on; use 'fail' to stop.
|
| 498 | 502 | report :: Bool -> String -> Q ()
|
| 499 | -report b s = Q $ \h -> mReport h b s
|
|
| 503 | +report b s = seqList s $ Q $ \h -> mReport h b s
|
|
| 504 | + where
|
|
| 505 | + seqList [] x = x
|
|
| 506 | + seqList (a:as) x = a `seq` seqList as x
|
|
| 500 | 507 | |
| 501 | 508 | -- | Recover from errors raised by 'reportError' or 'fail'.
|
| 502 | 509 | recover :: Q a -- ^ handler to invoke on failure
|
| ... | ... | @@ -5,8 +5,9 @@ |
| 5 | 5 | {-# LANGUAGE TemplateHaskellQuotes #-}
|
| 6 | 6 | {-# LANGUAGE Trustworthy #-}
|
| 7 | 7 | {-# LANGUAGE UnboxedTuples #-}
|
| 8 | +{-# LANGUAGE StandaloneDeriving, DeriveAnyClass #-}
|
|
| 8 | 9 | -- Don't warn for using 'report' from ghc-internal
|
| 9 | -{-# OPTIONS_GHC -Wno-warnings-deprecations #-}
|
|
| 10 | +{-# OPTIONS_GHC -Wno-warnings-deprecations -Wno-orphans #-}
|
|
| 10 | 11 | |
| 11 | 12 | module Language.Haskell.TH.Syntax (
|
| 12 | 13 | Quote (..),
|
| ... | ... | @@ -212,6 +213,7 @@ import System.FilePath |
| 212 | 213 | import Data.Data hiding (Fixity(..))
|
| 213 | 214 | import Data.List.NonEmpty (NonEmpty(..))
|
| 214 | 215 | import GHC.Lexeme ( startsVarSym, startsVarId )
|
| 216 | +import Control.DeepSeq
|
|
| 215 | 217 | import Control.Monad.IO.Class (MonadIO, liftIO)
|
| 216 | 218 | import System.IO (hPutStrLn, stderr)
|
| 217 | 219 | |
| ... | ... | @@ -522,7 +524,7 @@ class (MonadIO m, MonadFail m) => Quasi m where |
| 522 | 524 | qRunQ :: Q a -> m a
|
| 523 | 525 | -- | Fresh names. See 'newName'.
|
| 524 | 526 | qNewName :: String -> m Name
|
| 525 | - qNewName = qRunQ . newName
|
|
| 527 | + qNewName s = deepseq s . qRunQ . newName $ s
|
|
| 526 | 528 | |
| 527 | 529 | ------- Error reporting and recovery -------
|
| 528 | 530 | -- | Report an error (True) or warning (False)
|
| ... | ... | @@ -530,7 +532,7 @@ class (MonadIO m, MonadFail m) => Quasi m where |
| 530 | 532 | qReport :: Bool -> String -> m ()
|
| 531 | 533 | -- 'msg' is forced to ensure exceptions don't escape,
|
| 532 | 534 | -- see Note [Exceptions in TH]
|
| 533 | - qReport b msg = seqList msg $ qRunQ $ Internal.report b msg
|
|
| 535 | + qReport b msg = deepseq b . deepseq msg $ qRunQ $ Internal.report b msg
|
|
| 534 | 536 | |
| 535 | 537 | -- | See 'recover'.
|
| 536 | 538 | qRecover :: m a -- ^ the error handler
|
| ... | ... | @@ -540,32 +542,32 @@ class (MonadIO m, MonadFail m) => Quasi m where |
| 540 | 542 | ------- Inspect the type-checker's environment -------
|
| 541 | 543 | -- | True <=> type namespace, False <=> value namespace. See 'lookupName'.
|
| 542 | 544 | qLookupName :: Bool -> String -> m (Maybe Name)
|
| 543 | - qLookupName ns s = qRunQ $ lookupName ns s
|
|
| 545 | + qLookupName ns s = deepseq s $ qRunQ $ lookupName ns s
|
|
| 544 | 546 | -- | See 'reify'.
|
| 545 | 547 | qReify :: Name -> m Info
|
| 546 | - qReify v = qRunQ $ reify v
|
|
| 548 | + qReify v = deepseq v . qRunQ $ reify v
|
|
| 547 | 549 | -- | See 'reifyFixity'.
|
| 548 | 550 | qReifyFixity :: Name -> m (Maybe Fixity)
|
| 549 | - qReifyFixity v = qRunQ $ reifyFixity v
|
|
| 551 | + qReifyFixity v = deepseq v . qRunQ $ reifyFixity v
|
|
| 550 | 552 | -- | See 'reifyType'.
|
| 551 | 553 | qReifyType :: Name -> m Type
|
| 552 | - qReifyType v = qRunQ $ reifyType v
|
|
| 554 | + qReifyType v = deepseq v . qRunQ $ reifyType v
|
|
| 553 | 555 | -- | Is (n tys) an instance? Returns list of matching instance Decs (with
|
| 554 | 556 | -- empty sub-Decs) Works for classes and type functions. See 'reifyInstances'.
|
| 555 | 557 | qReifyInstances :: Name -> [Type] -> m [Dec]
|
| 556 | - qReifyInstances cls tys = qRunQ $ reifyInstances cls tys
|
|
| 558 | + qReifyInstances cls tys = deepseq cls . deepseq tys . qRunQ $ reifyInstances cls tys
|
|
| 557 | 559 | -- | See 'reifyRoles'.
|
| 558 | 560 | qReifyRoles :: Name -> m [Role]
|
| 559 | - qReifyRoles nm = qRunQ $ reifyRoles nm
|
|
| 561 | + qReifyRoles nm = deepseq nm . qRunQ $ reifyRoles nm
|
|
| 560 | 562 | -- | See 'reifyAnnotations'.
|
| 561 | 563 | qReifyAnnotations :: Data a => AnnLookup -> m [a]
|
| 562 | - qReifyAnnotations an = qRunQ $ reifyAnnotations an
|
|
| 564 | + qReifyAnnotations an = deepseq an . qRunQ $ reifyAnnotations an
|
|
| 563 | 565 | -- | See 'reifyModule'.
|
| 564 | 566 | qReifyModule :: Module -> m ModuleInfo
|
| 565 | - qReifyModule m = qRunQ $ reifyModule m
|
|
| 567 | + qReifyModule m = deepseq m . qRunQ $ reifyModule m
|
|
| 566 | 568 | -- | See 'reifyConStrictness'.
|
| 567 | 569 | qReifyConStrictness :: Name -> m [DecidedStrictness]
|
| 568 | - qReifyConStrictness nm = qRunQ $ reifyConStrictness nm
|
|
| 570 | + qReifyConStrictness nm = deepseq nm . qRunQ $ reifyConStrictness nm
|
|
| 569 | 571 | |
| 570 | 572 | -- | See 'location'.
|
| 571 | 573 | qLocation :: m Loc
|
| ... | ... | @@ -573,38 +575,38 @@ class (MonadIO m, MonadFail m) => Quasi m where |
| 573 | 575 | |
| 574 | 576 | -- | Input/output (dangerous). See 'runIO'.
|
| 575 | 577 | qRunIO :: IO a -> m a
|
| 576 | - qRunIO = liftIO
|
|
| 578 | + qRunIO m = m `seq` liftIO m
|
|
| 577 | 579 | -- | See 'getPackageRoot'.
|
| 578 | 580 | qGetPackageRoot :: m FilePath
|
| 579 | 581 | qGetPackageRoot = qRunQ getPackageRoot
|
| 580 | 582 | |
| 581 | 583 | -- | See 'addDependentFile'.
|
| 582 | 584 | qAddDependentFile :: FilePath -> m ()
|
| 583 | - qAddDependentFile p = qRunQ $ addDependentFile p
|
|
| 585 | + qAddDependentFile p = deepseq p $ qRunQ $ addDependentFile p
|
|
| 584 | 586 | |
| 585 | 587 | -- | See 'addDependentDirectory'.
|
| 586 | 588 | qAddDependentDirectory :: FilePath -> m ()
|
| 587 | - qAddDependentDirectory p = qRunQ $ addDependentDirectory p
|
|
| 589 | + qAddDependentDirectory p = deepseq p $ qRunQ $ addDependentDirectory p
|
|
| 588 | 590 | |
| 589 | 591 | -- | See 'addTempFile'.
|
| 590 | 592 | qAddTempFile :: String -> m FilePath
|
| 591 | - qAddTempFile p = qRunQ $ addTempFile p
|
|
| 593 | + qAddTempFile p = deepseq p $ qRunQ $ addTempFile p
|
|
| 592 | 594 | |
| 593 | 595 | -- | See 'addTopDecls'.
|
| 594 | 596 | qAddTopDecls :: [Dec] -> m ()
|
| 595 | - qAddTopDecls decls = qRunQ $ addTopDecls decls
|
|
| 597 | + qAddTopDecls decls = deepseq decls $ qRunQ $ addTopDecls decls
|
|
| 596 | 598 | |
| 597 | 599 | -- | See 'addForeignFilePath'.
|
| 598 | 600 | qAddForeignFilePath :: ForeignSrcLang -> String -> m ()
|
| 599 | - qAddForeignFilePath lang fp = qRunQ $ addForeignFilePath lang fp
|
|
| 601 | + qAddForeignFilePath lang fp = deepseq lang . deepseq fp $ qRunQ $ addForeignFilePath lang fp
|
|
| 600 | 602 | |
| 601 | 603 | -- | See 'addModFinalizer'.
|
| 602 | 604 | qAddModFinalizer :: Q () -> m ()
|
| 603 | - qAddModFinalizer fin = qRunQ $ addModFinalizer fin
|
|
| 605 | + qAddModFinalizer fin = seq fin . qRunQ $ addModFinalizer fin
|
|
| 604 | 606 | |
| 605 | 607 | -- | See 'addCorePlugin'.
|
| 606 | 608 | qAddCorePlugin :: String -> m ()
|
| 607 | - qAddCorePlugin nm = qRunQ $ addCorePlugin nm
|
|
| 609 | + qAddCorePlugin nm = deepseq nm $ qRunQ $ addCorePlugin nm
|
|
| 608 | 610 | |
| 609 | 611 | -- | See 'getQ'.
|
| 610 | 612 | qGetQ :: Typeable a => m (Maybe a)
|
| ... | ... | @@ -612,21 +614,21 @@ class (MonadIO m, MonadFail m) => Quasi m where |
| 612 | 614 | |
| 613 | 615 | -- | See 'putQ'.
|
| 614 | 616 | qPutQ :: Typeable a => a -> m ()
|
| 615 | - qPutQ x = qRunQ $ putQ x
|
|
| 617 | + qPutQ x = seq x . qRunQ $ putQ x
|
|
| 616 | 618 | |
| 617 | 619 | -- | See 'isExtEnabled'.
|
| 618 | 620 | qIsExtEnabled :: Extension -> m Bool
|
| 619 | - qIsExtEnabled ext = qRunQ $ isExtEnabled ext
|
|
| 621 | + qIsExtEnabled ext = seq (fromEnum ext) . qRunQ $ isExtEnabled ext
|
|
| 620 | 622 | -- | See 'extsEnabled'.
|
| 621 | 623 | qExtsEnabled :: m [Extension]
|
| 622 | 624 | qExtsEnabled = qRunQ extsEnabled
|
| 623 | 625 | |
| 624 | 626 | -- | See 'putDoc'.
|
| 625 | 627 | qPutDoc :: DocLoc -> String -> m ()
|
| 626 | - qPutDoc l s = qRunQ $ putDoc l s
|
|
| 628 | + qPutDoc l s = deepseq l . deepseq s $ qRunQ $ putDoc l s
|
|
| 627 | 629 | -- | See 'getDoc'.
|
| 628 | 630 | qGetDoc :: DocLoc -> m (Maybe String)
|
| 629 | - qGetDoc l = qRunQ $ getDoc l
|
|
| 631 | + qGetDoc l = deepseq l . qRunQ $ getDoc l
|
|
| 630 | 632 | |
| 631 | 633 | -- | \"Runs\" the 'Q' monad. Normal users of Template Haskell
|
| 632 | 634 | -- should not need this function, as the splice brackets @$( ... )@
|
| ... | ... | @@ -678,7 +680,57 @@ reportError = qReport True |
| 678 | 680 | reportWarning :: String -> Q ()
|
| 679 | 681 | reportWarning = qReport False
|
| 680 | 682 | |
| 681 | --- | copied from GHC.Utils.Misc
|
|
| 682 | -seqList :: [a] -> b -> b
|
|
| 683 | -seqList [] b = b
|
|
| 684 | -seqList (x:xs) b = x `seq` seqList xs b |
|
| 683 | +instance NFData AnnLookup
|
|
| 684 | +instance NFData PkgName
|
|
| 685 | +instance NFData Name
|
|
| 686 | +instance NFData OccName
|
|
| 687 | +instance NFData Type
|
|
| 688 | +instance NFData DocLoc
|
|
| 689 | +instance NFData ForeignSrcLang
|
|
| 690 | +instance NFData Module
|
|
| 691 | +instance NFData ModName
|
|
| 692 | +instance NFData Dec
|
|
| 693 | +instance NFData a => NFData (TyVarBndr a)
|
|
| 694 | +instance NFData Clause
|
|
| 695 | +instance NFData Specificity
|
|
| 696 | +instance NFData NameFlavour
|
|
| 697 | +instance NFData Pat
|
|
| 698 | +instance NFData NameSpace
|
|
| 699 | +instance NFData Body
|
|
| 700 | +instance NFData Lit
|
|
| 701 | +instance NFData Guard
|
|
| 702 | +instance NFData Bytes where
|
|
| 703 | + rnf (Bytes a b c) = a `seq` rnf b `seq` rnf c
|
|
| 704 | +instance NFData Exp
|
|
| 705 | +instance NFData TyLit
|
|
| 706 | +instance NFData BndrVis
|
|
| 707 | +instance NFData Con
|
|
| 708 | +instance NFData Match
|
|
| 709 | +instance NFData Stmt
|
|
| 710 | +instance NFData Bang
|
|
| 711 | +instance NFData DerivClause
|
|
| 712 | +instance NFData DerivStrategy
|
|
| 713 | +instance NFData SourceUnpackedness
|
|
| 714 | +instance NFData Range
|
|
| 715 | +instance NFData FunDep
|
|
| 716 | +instance NFData Overlap
|
|
| 717 | +instance NFData SourceStrictness
|
|
| 718 | +instance NFData Foreign
|
|
| 719 | +instance NFData Fixity
|
|
| 720 | +instance NFData Callconv
|
|
| 721 | +instance NFData Safety
|
|
| 722 | +instance NFData FixityDirection
|
|
| 723 | +instance NFData NamespaceSpecifier
|
|
| 724 | +instance NFData Pragma
|
|
| 725 | +instance NFData TySynEqn
|
|
| 726 | +instance NFData Inline
|
|
| 727 | +instance NFData TypeFamilyHead
|
|
| 728 | +instance NFData RuleMatch
|
|
| 729 | +instance NFData Phases
|
|
| 730 | +instance NFData FamilyResultSig
|
|
| 731 | +instance NFData RuleBndr
|
|
| 732 | +instance NFData InjectivityAnn
|
|
| 733 | +instance NFData Role
|
|
| 734 | +instance NFData AnnTarget
|
|
| 735 | +instance NFData PatSynArgs
|
|
| 736 | +instance NFData PatSynDir |
| ... | ... | @@ -52,6 +52,8 @@ Library |
| 52 | 52 | |
| 53 | 53 | build-depends:
|
| 54 | 54 | base >= 4.11 && < 4.24,
|
| 55 | + deepseq >= 1.4 && < 1.7,
|
|
| 56 | + |
|
| 55 | 57 | -- We don't directly depend on any of the modules from `ghc-internal`
|
| 56 | 58 | -- But we need to depend on it to work around a hadrian bug.
|
| 57 | 59 | -- See: https://gitlab.haskell.org/ghc/ghc/-/issues/25705
|
| ... | ... | @@ -1898,6 +1898,59 @@ module Language.Haskell.TH.Syntax where |
| 1898 | 1898 | |
| 1899 | 1899 | |
| 1900 | 1900 | -- Instances:
|
| 1901 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.AnnLookup -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1902 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.AnnTarget -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1903 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Bang -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1904 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.BndrVis -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1905 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Body -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1906 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Bytes -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1907 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Callconv -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1908 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Clause -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1909 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Con -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1910 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Dec -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1911 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.DerivClause -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1912 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.DerivStrategy -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1913 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.DocLoc -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1914 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Exp -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1915 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.FamilyResultSig -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1916 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Fixity -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1917 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.FixityDirection -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1918 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Foreign -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1919 | +instance Control.DeepSeq.NFData GHC.Internal.ForeignSrcLang.ForeignSrcLang -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1920 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.FunDep -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1921 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Guard -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1922 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.InjectivityAnn -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1923 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Inline -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1924 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Lit -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1925 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Match -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1926 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.ModName -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1927 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Module -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1928 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Name -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1929 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.NameFlavour -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1930 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.NameSpace -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1931 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.NamespaceSpecifier -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1932 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.OccName -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1933 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Overlap -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1934 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Pat -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1935 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.PatSynArgs -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1936 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.PatSynDir -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1937 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Phases -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1938 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.PkgName -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1939 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Pragma -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1940 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Range -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1941 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Role -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1942 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.RuleBndr -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1943 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.RuleMatch -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1944 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Safety -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1945 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.SourceStrictness -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1946 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.SourceUnpackedness -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1947 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Specificity -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1948 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Stmt -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1949 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.TyLit -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1950 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.TySynEqn -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1951 | +instance forall a. Control.DeepSeq.NFData a => Control.DeepSeq.NFData (GHC.Internal.TH.Syntax.TyVarBndr a) -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1952 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.Type -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1953 | +instance Control.DeepSeq.NFData GHC.Internal.TH.Syntax.TypeFamilyHead -- Defined in ‘Language.Haskell.TH.Syntax’
|
|
| 1901 | 1954 | instance GHC.Boot.TH.Ppr.Ppr GHC.Internal.TH.Syntax.Bang -- Defined in ‘GHC.Boot.TH.Ppr’
|
| 1902 | 1955 | instance GHC.Boot.TH.Ppr.Ppr GHC.Internal.TH.Syntax.Clause -- Defined in ‘GHC.Boot.TH.Ppr’
|
| 1903 | 1956 | instance GHC.Boot.TH.Ppr.Ppr GHC.Internal.TH.Syntax.Con -- Defined in ‘GHC.Boot.TH.Ppr’
|
| ... | ... | @@ -9,6 +9,7 @@ interfacePlugin: GHC.Internal.Base |
| 9 | 9 | interfacePlugin: GHC.Internal.Data.NonEmpty
|
| 10 | 10 | interfacePlugin: GHC.Internal.Float
|
| 11 | 11 | interfacePlugin: GHC.Internal.Prim.Ext
|
| 12 | +interfacePlugin: Language.Haskell.TH.Syntax
|
|
| 12 | 13 | interfacePlugin: GHC.Internal.TH.Monad
|
| 13 | 14 | interfacePlugin: GHC.Internal.TH.Syntax
|
| 14 | 15 | typeCheckPlugin (rn)
|
| 1 | +{-# LANGUAGE TemplateHaskell #-}
|
|
| 2 | + |
|
| 3 | +module T8987c where
|
|
| 4 | +import Language.Haskell.TH
|
|
| 5 | +import System.IO.Error
|
|
| 6 | +import Control.Exception
|
|
| 7 | + |
|
| 8 | +$(fail ['1', throw (userError "IOError in fail")] >> return []) |
| 1 | +T8987c.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in fail)
|
|
| 4 | + Code: (fail ['1', throw (userError "IOError in fail")]
|
|
| 5 | + >> return [])
|
|
| 6 | + |
| 1 | +{-# LANGUAGE CPP, TemplateHaskell #-}
|
|
| 2 | + |
|
| 3 | +module T8987d where
|
|
| 4 | +import Language.Haskell.TH
|
|
| 5 | +import Language.Haskell.TH.Syntax
|
|
| 6 | +import System.IO.Error
|
|
| 7 | +import Control.Exception
|
|
| 8 | +import Data.List
|
|
| 9 | +import Control.Monad
|
|
| 10 | + |
|
| 11 | +#define TEST_0 void $ newName ['1', throw (userError "IOError in newName") ]
|
|
| 12 | +#define TEST_1 void $ qNewName ['1', throw (userError "IOError in qNewName") ]
|
|
| 13 | +#define TEST_2 void $ qLookupName True ['1', throw (userError "IOError in qLookupName") ]
|
|
| 14 | +#define TEST_3 void $ qAddDependentFile ['1', throw (userError "IOError in qAddDependentFile") ]
|
|
| 15 | +#define TEST_4 void $ qAddDependentDirectory ['1', throw (userError "IOError in qAddDependentDirectory") ]
|
|
| 16 | +#define TEST_5 void $ qAddTempFile ['1', throw (userError "IOError in qAddTempFile") ]
|
|
| 17 | +#define TEST_6 void $ qAddTopDecls [ throw (userError "IOError in qAddTopDecls") ]
|
|
| 18 | +#define TEST_7 void $ qAddForeignFilePath LangC ['1', throw (userError "IOError in qAddForeignFilePath") ]
|
|
| 19 | +#define TEST_8 void $ qAddForeignFilePath undefined "foo"
|
|
| 20 | +#define TEST_9 void $ qAddCorePlugin ['1', throw (userError "IOError in qAddCorePlugin") ]
|
|
| 21 | +#define TEST_10 void $ qPutDoc ModuleDoc ['1', throw (userError "IOError in qPutDoc") ]
|
|
| 22 | +#define TEST_11 void $ qPutDoc undefined "foo"
|
|
| 23 | +#define TEST_12 void $ qReport undefined "foo"
|
|
| 24 | +#define TEST_13 void $ qAddTopDecls [ FunD undefined []]
|
|
| 25 | + |
|
| 26 | +$(do
|
|
| 27 | + TEST_INDEX
|
|
| 28 | + pure []
|
|
| 29 | + ) |
| 1 | +T8987d0.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in newName)
|
|
| 4 | + Code: (do void $ newName [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d1.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qNewName)
|
|
| 4 | + Code: (do void $ qNewName [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d10.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qPutDoc)
|
|
| 4 | + Code: (do void $ qPutDoc ModuleDoc [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d11.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + Prelude.undefined
|
|
| 4 | + Code: (do void $ qPutDoc undefined "foo"
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d12.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + Prelude.undefined
|
|
| 4 | + Code: (do void $ qReport undefined "foo"
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d13.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + Prelude.undefined
|
|
| 4 | + Code: (do void $ qAddTopDecls [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d2.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qLookupName)
|
|
| 4 | + Code: (do void $ qLookupName True [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d3.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qAddDependentFile)
|
|
| 4 | + Code: (do void $ qAddDependentFile [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d4.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qAddDependentDirectory)
|
|
| 4 | + Code: (do void $ qAddDependentDirectory [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d5.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qAddTempFile)
|
|
| 4 | + Code: (do void $ qAddTempFile [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d6.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qAddTopDecls)
|
|
| 4 | + Code: (do void $ qAddTopDecls [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d7.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qAddForeignFilePath)
|
|
| 4 | + Code: (do void $ qAddForeignFilePath LangC [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d8.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + Prelude.undefined
|
|
| 4 | + Code: (do void $ qAddForeignFilePath undefined "foo"
|
|
| 5 | + pure [])
|
|
| 6 | + |
| 1 | +T8987d9.hs:1:1: error: [GHC-87897]
|
|
| 2 | + Exception when trying to run compile-time code:
|
|
| 3 | + user error (IOError in qAddCorePlugin)
|
|
| 4 | + Code: (do void $ qAddCorePlugin [...]
|
|
| 5 | + pure [])
|
|
| 6 | + |
| ... | ... | @@ -307,6 +307,15 @@ test('T8954', normal, compile, ['-v0']) |
| 307 | 307 | test('T8932', normal, compile_fail, ['-v0'])
|
| 308 | 308 | test('T8987', normal, compile_fail, ['-v0'])
|
| 309 | 309 | test('T8987b', normal, compile_fail, ['-v0'])
|
| 310 | +test('T8987c', normal, compile_fail, ['-v0'])
|
|
| 311 | + |
|
| 312 | +# All the T8987d<n> tests are compiled from T8987d.hs, which selects one Q
|
|
| 313 | +# primitive to test via the TEST_INDEX macro.
|
|
| 314 | +for n in range(14):
|
|
| 315 | + test(f"T8987d{n}",
|
|
| 316 | + [extra_files(['T8987d.hs']), pre_cmd(f"cp T8987d.hs T8987d{n}.hs")],
|
|
| 317 | + compile_fail, [f"-v0 -DTEST_INDEX=TEST_{n}"])
|
|
| 318 | + |
|
| 310 | 319 | test('T7241', normal, compile_fail, ['-v0'])
|
| 311 | 320 | test('T9262', normal, compile, ['-v0'])
|
| 312 | 321 | test('T9199', normal, compile, ['-v0'])
|