summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorShayan-Najd <sh.najd@gmail.com>2018-11-22 01:23:29 +0000
committerAlan Zimmerman <alan.zimm@gmail.com>2018-11-24 12:30:21 +0200
commit509d5be69c7507ba5d0a5f39ffd1613a59e73eea (patch)
treeb3db08f371014cbf235525843a312f67dea77354 /testsuite/tests
parentad2d7612dbdf0e928318394ec0606da3b85a8837 (diff)
downloadhaskell-509d5be69c7507ba5d0a5f39ffd1613a59e73eea.tar.gz
[TTG: Handling Source Locations] Foundation and Pat
This patch removes the ping-pong style from HsPat (only, for now), using the plan laid out at https://ghc.haskell.org/trac/ghc/wiki/ImplementingTreesThatGrow/HandlingSourceLocations (solution A). - the class `HasSrcSpan`, and its functions (e.g., `cL` and `dL`), are introduced - some instances of `HasSrcSpan` are introduced - some constructors `L` are replaced with `cL` - some patterns `L` are replaced with `dL->L` view pattern - some type annotation are necessarily updated (e.g., `Pat p` --> `Pat (GhcPass p)`) Phab diff: D5036 Trac Issues #15495 Updates haddock submodule
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/ghc-api/T6145.hs13
-rw-r--r--testsuite/tests/parser/should_compile/KindSigs.stderr12
2 files changed, 14 insertions, 11 deletions
diff --git a/testsuite/tests/ghc-api/T6145.hs b/testsuite/tests/ghc-api/T6145.hs
index 3f4afc449e..184070c630 100644
--- a/testsuite/tests/ghc-api/T6145.hs
+++ b/testsuite/tests/ghc-api/T6145.hs
@@ -1,4 +1,7 @@
{-# LANGUAGE PatternGuards #-}
+{-# LANGUAGE ViewPatterns #-}
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE TypeFamilies #-}
module Main where
import System.IO
@@ -32,12 +35,12 @@ main = do
removeFile "Test.hs"
print ok
where
- isDataCon (L _ (AbsBinds { abs_binds = bs }))
+ isDataCon (dL->L _ (AbsBinds { abs_binds = bs }))
= not (isEmptyBag (filterBag isDataCon bs))
- isDataCon (L l (f@FunBind {}))
- | (MG _ (L _ (m:_)) _) <- fun_matches f,
- (L _ (c@ConPatOut{}):_)<-hsLMatchPats m,
- (L l _)<-pat_con c
+ isDataCon (dL->L l (f@FunBind {}))
+ | (MG _ (dL->L _ (m:_)) _) <- fun_matches f,
+ ((dL->L _ (c@ConPatOut{})):_)<-hsLMatchPats m,
+ (dL->L l _)<-pat_con c
= isGoodSrcSpan l -- Check that the source location is a good one
isDataCon _
= False
diff --git a/testsuite/tests/parser/should_compile/KindSigs.stderr b/testsuite/tests/parser/should_compile/KindSigs.stderr
index ebbec08ad5..125e88084a 100644
--- a/testsuite/tests/parser/should_compile/KindSigs.stderr
+++ b/testsuite/tests/parser/should_compile/KindSigs.stderr
@@ -338,12 +338,14 @@
{OccName: qux}))
(Prefix)
(NoSrcStrict))
- [({ KindSigs.hs:23:5 }
+ [(XPat
+ ({ KindSigs.hs:23:5 }
(WildPat
- (NoExt)))
- ,({ KindSigs.hs:23:7 }
+ (NoExt))))
+ ,(XPat
+ ({ KindSigs.hs:23:7 }
(WildPat
- (NoExt)))]
+ (NoExt))))]
(GRHSs
(NoExt)
[({ KindSigs.hs:23:9-12 }
@@ -605,5 +607,3 @@
[])))]
(Nothing)
(Nothing)))
-
-