[GHC] #15423: Ungrammatical error message involving a pattern binding
GHC
ghc-devs at haskell.org
Fri Jul 20 09:52:08 UTC 2018
#15423: Ungrammatical error message involving a pattern binding
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.4.3
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Take a look at this error message from GHC's `Typeable1` test case:
{{{
Typeable1.hs:22:5: error: [-Winaccessible-code (in -Wdefault), -Werror
=inaccessible-code]
• Couldn't match type ‘ComposeK’ with ‘a3 b3’
Inaccessible code in
a pattern with pattern synonym:
App :: forall k2 (t :: k2).
() =>
forall k1 (a :: k1 -> k2) (b :: k1).
(t ~ a b) =>
TypeRep a -> TypeRep b -> TypeRep t,
in a pattern binding in
'do' block
}}}
In particular, note the "in a pattern binding in 'do' block" part. I think
that should be "in **a** 'do' block".
I believe fixing this is a simple matter of applying this patch:
{{{#!diff
diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs
index 96d86c8..a5c65fb 100644
--- a/compiler/hsSyn/HsExpr.hs
+++ b/compiler/hsSyn/HsExpr.hs
@@ -2804,7 +2804,7 @@ pprMatchContextNoun PatBindGuards = text "pattern
binding guards"
pprMatchContextNoun LambdaExpr = text "lambda abstraction"
pprMatchContextNoun ProcExpr = text "arrow abstraction"
pprMatchContextNoun (StmtCtxt ctxt) = text "pattern binding in"
- $$ pprStmtContext ctxt
+ $$ pprAStmtContext ctxt
pprMatchContextNoun PatSyn = text "pattern synonym declaration"
-----------------
}}}
Patch incoming.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15423>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list