summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sgraf1337@gmail.com>2019-09-27 16:42:42 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-09-30 22:42:14 -0400
commit6f8550a3af45467c37367626dc99c911d3a3d4d1 (patch)
treea2b18316b7de09de4e72104a65cef3c6bd43cf7d
parent97811ef5e9e9922184fda5af894188e947a4c799 (diff)
downloadhaskell-6f8550a3af45467c37367626dc99c911d3a3d4d1.tar.gz
Move pattern match checker modules to GHC.HsToCore.PmCheck
-rw-r--r--compiler/GHC/HsToCore/PmCheck.hs (renamed from compiler/deSugar/Check.hs)20
-rw-r--r--compiler/GHC/HsToCore/PmCheck/Oracle.hs (renamed from compiler/deSugar/PmOracle.hs)4
-rw-r--r--compiler/GHC/HsToCore/PmCheck/Ppr.hs (renamed from compiler/deSugar/PmPpr.hs)6
-rw-r--r--compiler/GHC/HsToCore/PmCheck/Types.hs (renamed from compiler/deSugar/PmTypes.hs)6
-rw-r--r--compiler/GHC/HsToCore/PmCheck/Types.hs-boot (renamed from compiler/deSugar/PmTypes.hs-boot)2
-rw-r--r--compiler/deSugar/DsBinds.hs2
-rw-r--r--compiler/deSugar/DsExpr.hs2
-rw-r--r--compiler/deSugar/DsGRHSs.hs2
-rw-r--r--compiler/deSugar/DsMonad.hs2
-rw-r--r--compiler/deSugar/Match.hs2
-rw-r--r--compiler/ghc.cabal.in8
-rw-r--r--compiler/typecheck/TcRnTypes.hs2
-rw-r--r--testsuite/tests/pmcheck/should_compile/CyclicSubst.hs2
13 files changed, 30 insertions, 30 deletions
diff --git a/compiler/deSugar/Check.hs b/compiler/GHC/HsToCore/PmCheck.hs
index b86bb785c3..8cabe0cc8e 100644
--- a/compiler/deSugar/Check.hs
+++ b/compiler/GHC/HsToCore/PmCheck.hs
@@ -11,7 +11,7 @@ Pattern Matching Coverage Checking.
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE LambdaCase #-}
-module Check (
+module GHC.HsToCore.PmCheck (
-- Checking and printing
checkSingle, checkMatches, checkGuardMatches,
needToRunPmCheck, isMatchContextPmChecked,
@@ -24,9 +24,9 @@ module Check (
import GhcPrelude
-import PmTypes
-import PmOracle
-import PmPpr
+import GHC.HsToCore.PmCheck.Types
+import GHC.HsToCore.PmCheck.Oracle
+import GHC.HsToCore.PmCheck.Ppr
import BasicTypes (Origin, isGenerated)
import CoreSyn (CoreExpr, Expr(Var))
import CoreUtils (exprType)
@@ -331,7 +331,7 @@ checkMatches dflags ctxt vars matches = do
(vcat (map ppr matches)))
res <- case matches of
-- Check EmptyCase separately
- -- See Note [Checking EmptyCase Expressions] in PmOracle
+ -- See Note [Checking EmptyCase Expressions] in GHC.HsToCore.PmCheck.Oracle
[] | [var] <- vars -> checkEmptyCase' var
_normal_match -> checkMatches' vars matches
dsPmWarn dflags ctxt res
@@ -388,7 +388,7 @@ checkMatches' vars matches
-- | Check an empty case expression. Since there are no clauses to process, we
-- only compute the uncovered set. See Note [Checking EmptyCase Expressions]
--- in "PmOracle" for details.
+-- in "GHC.HsToCore.PmCheck.Oracle" for details.
checkEmptyCase' :: Id -> DsM PmResult
checkEmptyCase' x = do
delta <- getPmDelta
@@ -458,9 +458,9 @@ mkPmLitPattern :: PmLit -> PatVec
mkPmLitPattern lit@(PmLit _ val)
-- We translate String literals to list literals for better overlap reasoning.
-- It's a little unfortunate we do this here rather than in
- -- 'PmOracle.trySolve' and 'PmOracle.addRefutableAltCon', but it's so much
+ -- 'GHC.HsToCore.PmCheck.Oracle.trySolve' and 'GHC.HsToCore.PmCheck.Oracle.addRefutableAltCon', but it's so much
-- simpler here.
- -- See Note [Representation of Strings in TmState] in PmOracle
+ -- See Note [Representation of Strings in TmState] in GHC.HsToCore.PmCheck.Oracle
| PmLitString s <- val
, let mk_char_lit c = mkPmLitPattern (PmLit charTy (PmLitChar c))
= foldr (\c p -> mkListPatVec charTy (mk_char_lit c) p)
@@ -890,7 +890,7 @@ the paper. This Note serves as a reference for these new features.
variables. The information about the shape of a variable is encoded in
the oracle state 'Delta' instead.
* Handling of uninhabited fields like `!Void`.
- See Note [Strict argument type constraints] in PmOracle.
+ See Note [Strict argument type constraints] in GHC.HsToCore.PmCheck.Oracle.
* Efficient handling of literal splitting, large enumerations and accurate
redundancy warnings for `COMPLETE` groups through the oracle.
-}
@@ -1161,7 +1161,7 @@ pmcheck (_:_) _ [] _ _ = panic "pmcheck: cons-nil"
addPmConCts :: Delta -> Id -> PmAltCon -> [EvVar] -> PatVec -> DsM (Maybe (Delta, ValVec))
addPmConCts delta x con dicts field_pats = do
-- mk_id will re-use the variable name if possible. The x ~ x is easily
- -- discharged by the oracle at no overhead (see 'PmOracle.addVarVarCt').
+ -- discharged by the oracle at no overhead (see 'GHC.HsToCore.PmCheck.Oracle.addVarVarCt').
let mk_id (PmVar _ x) = pure (Just x)
mk_id p@PmCon{} = Just <$> mkPmId (pmPatType p)
mk_id PmGrd{} = pure Nothing -- PmGrds have arity 0, so just forget about them
diff --git a/compiler/deSugar/PmOracle.hs b/compiler/GHC/HsToCore/PmCheck/Oracle.hs
index e27adc9fcd..49b5a0cf8f 100644
--- a/compiler/deSugar/PmOracle.hs
+++ b/compiler/GHC/HsToCore/PmCheck/Oracle.hs
@@ -10,7 +10,7 @@ Authors: George Karachalias <george.karachalias@cs.kuleuven.be>
-- 'addTmCt', 'addVarCoreCt', 'addRefutableAltCon' and 'addTypeEvidence' for
-- adding facts to the oracle, and 'provideEvidenceForEquation' to turn a
-- 'Delta' into a concrete evidence for an equation.
-module PmOracle (
+module GHC.HsToCore.PmCheck.Oracle (
DsM, tracePm, mkPmId,
Delta, initDelta, canDiverge, lookupRefuts, lookupSolution,
@@ -28,7 +28,7 @@ module PmOracle (
import GhcPrelude
-import PmTypes
+import GHC.HsToCore.PmCheck.Types
import DynFlags
import Outputable
diff --git a/compiler/deSugar/PmPpr.hs b/compiler/GHC/HsToCore/PmCheck/Ppr.hs
index 5b49b2de55..6426251d20 100644
--- a/compiler/deSugar/PmPpr.hs
+++ b/compiler/GHC/HsToCore/PmCheck/Ppr.hs
@@ -2,7 +2,7 @@
-- | Provides factilities for pretty-printing 'Delta's in a way appropriate for
-- user facing pattern match warnings.
-module PmPpr (
+module GHC.HsToCore.PmCheck.Ppr (
pprUncovered
) where
@@ -23,8 +23,8 @@ import Util
import Maybes
import Data.List.NonEmpty (NonEmpty, nonEmpty, toList)
-import PmTypes
-import PmOracle
+import GHC.HsToCore.PmCheck.Types
+import GHC.HsToCore.PmCheck.Oracle
-- | Pretty-print the guts of an uncovered value vector abstraction, i.e., its
-- components and refutable shapes associated to any mentioned variables.
diff --git a/compiler/deSugar/PmTypes.hs b/compiler/GHC/HsToCore/PmCheck/Types.hs
index ddbaa01b4a..b2be6197d8 100644
--- a/compiler/deSugar/PmTypes.hs
+++ b/compiler/GHC/HsToCore/PmCheck/Types.hs
@@ -8,9 +8,9 @@ Author: George Karachalias <george.karachalias@cs.kuleuven.be>
{-# LANGUAGE TupleSections #-}
-- | Types used through-out pattern match checking. This module is mostly there
--- to be imported from "TcRnTypes". The exposed API is that of "PmOracle" and
--- "Check".
-module PmTypes (
+-- to be imported from "TcRnTypes". The exposed API is that of
+-- "GHC.HsToCore.PmCheck.Oracle" and "GHC.HsToCore.PmCheck".
+module GHC.HsToCore.PmCheck.Types (
-- * Representations for Literals and AltCons
PmLit(..), PmLitValue(..), PmAltCon(..), pmLitType, pmAltConType,
diff --git a/compiler/deSugar/PmTypes.hs-boot b/compiler/GHC/HsToCore/PmCheck/Types.hs-boot
index f6e3a7ec5b..beef421d46 100644
--- a/compiler/deSugar/PmTypes.hs-boot
+++ b/compiler/GHC/HsToCore/PmCheck/Types.hs-boot
@@ -1,4 +1,4 @@
-module PmTypes where
+module GHC.HsToCore.PmCheck.Types where
import GhcPrelude ()
diff --git a/compiler/deSugar/DsBinds.hs b/compiler/deSugar/DsBinds.hs
index 0d4c868d76..95c26b90e0 100644
--- a/compiler/deSugar/DsBinds.hs
+++ b/compiler/deSugar/DsBinds.hs
@@ -29,7 +29,7 @@ import {-# SOURCE #-} Match( matchWrapper )
import DsMonad
import DsGRHSs
import DsUtils
-import Check ( needToRunPmCheck, addTyCsDs, checkGuardMatches )
+import GHC.HsToCore.PmCheck ( needToRunPmCheck, addTyCsDs, checkGuardMatches )
import GHC.Hs -- lots of things
import CoreSyn -- lots of things
diff --git a/compiler/deSugar/DsExpr.hs b/compiler/deSugar/DsExpr.hs
index 1fa2dd8b99..f3b4ba5d6d 100644
--- a/compiler/deSugar/DsExpr.hs
+++ b/compiler/deSugar/DsExpr.hs
@@ -25,7 +25,7 @@ import DsListComp
import DsUtils
import DsArrows
import DsMonad
-import Check ( checkGuardMatches )
+import GHC.HsToCore.PmCheck ( checkGuardMatches )
import Name
import NameEnv
import FamInstEnv( topNormaliseType )
diff --git a/compiler/deSugar/DsGRHSs.hs b/compiler/deSugar/DsGRHSs.hs
index 6b7dac41b3..a6ef106c98 100644
--- a/compiler/deSugar/DsGRHSs.hs
+++ b/compiler/deSugar/DsGRHSs.hs
@@ -25,7 +25,7 @@ import CoreUtils (bindNonRec)
import BasicTypes (Origin(FromSource))
import DynFlags
-import Check (needToRunPmCheck, addTyCsDs, addPatTmCs, addScrutTmCs)
+import GHC.HsToCore.PmCheck (needToRunPmCheck, addTyCsDs, addPatTmCs, addScrutTmCs)
import DsMonad
import DsUtils
import Type ( Type )
diff --git a/compiler/deSugar/DsMonad.hs b/compiler/deSugar/DsMonad.hs
index 045647f27c..5090bc8d81 100644
--- a/compiler/deSugar/DsMonad.hs
+++ b/compiler/deSugar/DsMonad.hs
@@ -70,7 +70,7 @@ import BasicTypes ( Origin )
import DataCon
import ConLike
import TyCon
-import PmTypes
+import GHC.HsToCore.PmCheck.Types
import Id
import Module
import Outputable
diff --git a/compiler/deSugar/Match.hs b/compiler/deSugar/Match.hs
index 0049d00613..2e0aeb9877 100644
--- a/compiler/deSugar/Match.hs
+++ b/compiler/deSugar/Match.hs
@@ -25,7 +25,7 @@ import GHC.Hs
import TcHsSyn
import TcEvidence
import TcRnMonad
-import Check
+import GHC.HsToCore.PmCheck
import CoreSyn
import Literal
import CoreUtils
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index 037e7aa0b2..fdbe9d5df6 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -333,10 +333,10 @@ Library
CoreStats
MkCore
PprCore
- PmOracle
- PmPpr
- PmTypes
- Check
+ GHC.HsToCore.PmCheck.Oracle
+ GHC.HsToCore.PmCheck.Ppr
+ GHC.HsToCore.PmCheck.Types
+ GHC.HsToCore.PmCheck
Coverage
Desugar
DsArrows
diff --git a/compiler/typecheck/TcRnTypes.hs b/compiler/typecheck/TcRnTypes.hs
index 83616bdb82..a66143bf57 100644
--- a/compiler/typecheck/TcRnTypes.hs
+++ b/compiler/typecheck/TcRnTypes.hs
@@ -167,7 +167,7 @@ import TcType
import Annotations
import InstEnv
import FamInstEnv
-import {-# SOURCE #-} PmTypes (Delta)
+import {-# SOURCE #-} GHC.HsToCore.PmCheck.Types (Delta)
import IOEnv
import RdrName
import Name
diff --git a/testsuite/tests/pmcheck/should_compile/CyclicSubst.hs b/testsuite/tests/pmcheck/should_compile/CyclicSubst.hs
index 3f37b66b54..9fe0effe2c 100644
--- a/testsuite/tests/pmcheck/should_compile/CyclicSubst.hs
+++ b/testsuite/tests/pmcheck/should_compile/CyclicSubst.hs
@@ -1,5 +1,5 @@
-- | The following match demonstrates why we need to detect cyclic solutions
--- when extending 'PmOracle.tm_pos'.
+-- when extending 'GHC.HsToCore.PmCheck.Oracle.tm_pos'.
--
-- TLDR; solving @x :-> y@ where @x@ is the representative of @y@'s equivalence
-- class can easily lead to a cycle in the substitution.