diff options
author | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-01-25 23:32:17 -0500 |
---|---|---|
committer | Ryan Scott <ryan.gl.scott@gmail.com> | 2017-01-25 23:32:17 -0500 |
commit | e4ab8ba72af27cd23ecd3737b166b625190c34a5 (patch) | |
tree | c79ed4f727fcd49b5d272cb36e0989a4a3b5f35f | |
parent | c344005b2344800bee9fee1c5ca97867691b9c70 (diff) | |
download | haskell-e4ab8ba72af27cd23ecd3737b166b625190c34a5.tar.gz |
Add pragCompleteDName to templateHaskellNames
95dc6dc070deac733d4a4a63a93e606a2e772a67 forgot to add `pragCompleteDName`
to the list of `templateHaskellNames`, which caused a panic if you actually
tried to splice a `COMPLETE` pragma using Template Haskell. This applies the
easy fix and augments the regression test to check for this in the future.
-rw-r--r-- | compiler/prelude/THNames.hs | 2 | ||||
-rw-r--r-- | testsuite/tests/th/T13098.hs | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/compiler/prelude/THNames.hs b/compiler/prelude/THNames.hs index e051082c34..253a89b6e3 100644 --- a/compiler/prelude/THNames.hs +++ b/compiler/prelude/THNames.hs @@ -67,7 +67,7 @@ templateHaskellNames = [ classDName, instanceWithOverlapDName, standaloneDerivWithStrategyDName, sigDName, forImpDName, pragInlDName, pragSpecDName, pragSpecInlDName, pragSpecInstDName, - pragRuleDName, pragAnnDName, defaultSigDName, + pragRuleDName, pragCompleteDName, pragAnnDName, defaultSigDName, dataFamilyDName, openTypeFamilyDName, closedTypeFamilyDName, dataInstDName, newtypeInstDName, tySynInstDName, infixLDName, infixRDName, infixNDName, diff --git a/testsuite/tests/th/T13098.hs b/testsuite/tests/th/T13098.hs index 77e23f3d11..8df07d230d 100644 --- a/testsuite/tests/th/T13098.hs +++ b/testsuite/tests/th/T13098.hs @@ -1,4 +1,6 @@ +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE ViewPatterns #-} module T13098 where @@ -7,3 +9,19 @@ import Language.Haskell.TH $( sequence [ dataD (cxt []) (mkName "T") [PlainTV (mkName "a")] Nothing [normalC (mkName "T") []] [] , pragCompleteD [mkName "T"] Nothing ] ) + +$([d| class LL f where + go :: f a -> () + + instance LL [] where + go _ = () + + pattern T2 :: LL f => f a + pattern T2 <- (go -> ()) + + {-# COMPLETE T2 :: [] #-} + + -- No warning + foo :: [a] -> Int + foo T2 = 5 + |]) |