Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gesh
GHC
Commits
fff59517
Commit
fff59517
authored
27 years ago
by
Juan J. Quintela
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-12-02 18:50:36 by quintela]
Deleted old Warning staff and added new ones
parent
d1d40285
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/deSugar/DsMonad.lhs
+10
-51
10 additions, 51 deletions
ghc/compiler/deSugar/DsMonad.lhs
with
10 additions
and
51 deletions
ghc/compiler/deSugar/DsMonad.lhs
+
10
−
51
View file @
fff59517
...
@@ -19,10 +19,9 @@ module DsMonad (
...
@@ -19,10 +19,9 @@ module DsMonad (
extendEnvDs, lookupEnvDs,
extendEnvDs, lookupEnvDs,
SYN_IE(DsIdEnv),
SYN_IE(DsIdEnv),
ds
ShadowWarn, dsIncomplete
Warn,
dsWarn,
SYN_IE(DsWarnings),
SYN_IE(DsWarnings),
DsMatchContext(..), DsMatchKind(..), pprDsWarnings,
DsMatchContext(..), DsMatchKind(..), pprDsWarnings
DsWarnFlavour -- Nuke with 1.4
) where
) where
...
@@ -33,6 +32,7 @@ import BasicTypes ( SYN_IE(Module) )
...
@@ -33,6 +32,7 @@ import BasicTypes ( SYN_IE(Module) )
import CmdLineOpts ( opt_PprUserLength )
import CmdLineOpts ( opt_PprUserLength )
import CoreSyn ( SYN_IE(CoreExpr) )
import CoreSyn ( SYN_IE(CoreExpr) )
import CoreUtils ( substCoreExpr )
import CoreUtils ( substCoreExpr )
import ErrUtils ( SYN_IE(Warning) )
import HsSyn ( OutPat )
import HsSyn ( OutPat )
import Id ( mkSysLocal, mkIdWithNewUniq,
import Id ( mkSysLocal, mkIdWithNewUniq,
lookupIdEnv, growIdEnvList, GenId, SYN_IE(IdEnv),
lookupIdEnv, growIdEnvList, GenId, SYN_IE(IdEnv),
...
@@ -66,8 +66,7 @@ type DsM result =
...
@@ -66,8 +66,7 @@ type DsM result =
-> DsWarnings
-> DsWarnings
-> (result, DsWarnings)
-> (result, DsWarnings)
type DsWarnings = Bag (DsWarnFlavour, DsMatchContext)
type DsWarnings = Bag Warning -- The desugarer reports matches which are
-- The desugarer reports matches which are
-- completely shadowed or incomplete patterns
-- completely shadowed or incomplete patterns
type Group = FAST_STRING
type Group = FAST_STRING
...
@@ -186,13 +185,9 @@ putSrcLocDs :: SrcLoc -> DsM a -> DsM a
...
@@ -186,13 +185,9 @@ putSrcLocDs :: SrcLoc -> DsM a -> DsM a
putSrcLocDs new_loc expr us old_loc mod_and_grp env warns
putSrcLocDs new_loc expr us old_loc mod_and_grp env warns
= expr us new_loc mod_and_grp env warns
= expr us new_loc mod_and_grp env warns
dsShadowWarn :: DsMatchContext -> DsM ()
dsWarn :: Warning -> DsM ()
dsShadowWarn cxt us loc mod_and_grp env warns
dsWarn warn us loc mod_and_grp env warns = ((), warns `snocBag` warn)
= ((), warns `snocBag` (Shadowed, cxt))
dsIncompleteWarn :: DsMatchContext -> DsM ()
dsIncompleteWarn cxt us loc mod_and_grp env warns
= ((), warns `snocBag` (Incomplete, cxt))
\end{code}
\end{code}
\begin{code}
\begin{code}
...
@@ -224,8 +219,6 @@ lookupEnvDs id us loc mod_and_grp env warns
...
@@ -224,8 +219,6 @@ lookupEnvDs id us loc mod_and_grp env warns
%************************************************************************
%************************************************************************
\begin{code}
\begin{code}
data DsWarnFlavour = Shadowed | Incomplete deriving ()
data DsMatchContext
data DsMatchContext
= DsMatchContext DsMatchKind [TypecheckedPat] SrcLoc
= DsMatchContext DsMatchKind [TypecheckedPat] SrcLoc
| NoMatchContext
| NoMatchContext
...
@@ -237,45 +230,11 @@ data DsMatchKind
...
@@ -237,45 +230,11 @@ data DsMatchKind
| LambdaMatch
| LambdaMatch
| PatBindMatch
| PatBindMatch
| DoBindMatch
| DoBindMatch
| ListCompMatch
| LetMatch
deriving ()
deriving ()
pprDsWarnings :: PprStyle -> DsWarnings -> Doc
pprDsWarnings :: PprStyle -> DsWarnings -> Doc
pprDsWarnings sty warns
pprDsWarnings sty warns = vcat [ warn sty | warn <- (bagToList warns)]
= vcat (map pp_warn (bagToList warns))
where
pp_warn (flavour, NoMatchContext) = sep [ptext SLIT("Warning: Some match is"),
case flavour of
Shadowed -> ptext SLIT("shadowed")
Incomplete -> ptext SLIT("possibly incomplete")]
pp_warn (flavour, DsMatchContext kind pats loc)
= hang (hcat [ppr (PprForUser opt_PprUserLength) loc, ptext SLIT(": ")])
4 (hang msg
4 (pp_match kind pats))
where
msg = case flavour of
Shadowed -> ptext SLIT("Warning: Pattern match(es) completely overlapped")
Incomplete -> ptext SLIT("Warning: Possibly incomplete patterns")
pp_match (FunMatch fun) pats
= hsep [ptext SLIT("in the definition of function"), ppr sty fun]
pp_match CaseMatch pats
= hang (ptext SLIT("in a group of case alternatives beginning:"))
4 (ppr_pats pats)
pp_match PatBindMatch pats
= hang (ptext SLIT("in a pattern binding:"))
4 (ppr_pats pats)
pp_match LambdaMatch pats
= hang (ptext SLIT("in a lambda abstraction:"))
4 (ppr_pats pats)
pp_match DoBindMatch pats
= hang (ptext SLIT("in a `do' pattern binding:"))
4 (ppr_pats pats)
ppr_pats pats = pprQuote sty $ \ sty ->
sep [sep (map (ppr sty) pats), ptext SLIT("-> ...")]
\end{code}
\end{code}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment