[commit: ghc] master: Kill off irrefutable pattern errors (492e604)
git at git.haskell.org
git at git.haskell.org
Mon Jan 15 19:22:42 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/492e6044577519b59f390008362de98e9517e04d/ghc
>---------------------------------------------------------------
commit 492e6044577519b59f390008362de98e9517e04d
Author: David Feuer <david.feuer at gmail.com>
Date: Mon Jan 15 12:38:29 2018 -0500
Kill off irrefutable pattern errors
Distinguishing between "refutable" and "irrefutable" patterns
(as described by the Haskell Report) in incomplete pattern errors
was more confusing than helpful. Remove references to irrefutable
patterns.
Reviewers: hvr, bgamari, simonpj
Reviewed By: simonpj
Subscribers: simonpj, rwbarton, thomie, carter
GHC Trac Issues: #14569
Differential Revision: https://phabricator.haskell.org/D4261
>---------------------------------------------------------------
492e6044577519b59f390008362de98e9517e04d
compiler/coreSyn/MkCore.hs | 9 +++------
compiler/deSugar/DsUtils.hs | 2 +-
compiler/prelude/PrelNames.hs | 3 +--
libraries/base/Control/Exception/Base.hs | 5 ++---
testsuite/tests/deSugar/should_fail/DsStrictFail.stderr | 2 +-
testsuite/tests/deSugar/should_run/dsrun008.stderr | 2 +-
testsuite/tests/safeHaskell/safeLanguage/SafeLang15.stderr | 2 +-
7 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/compiler/coreSyn/MkCore.hs b/compiler/coreSyn/MkCore.hs
index 72b6abf..3e5d8cd 100644
--- a/compiler/coreSyn/MkCore.hs
+++ b/compiler/coreSyn/MkCore.hs
@@ -43,7 +43,7 @@ module MkCore (
-- * Error Ids
mkRuntimeErrorApp, mkImpossibleExpr, mkAbsentErrorApp, errorIds,
- rEC_CON_ERROR_ID, iRREFUT_PAT_ERROR_ID, rUNTIME_ERROR_ID,
+ rEC_CON_ERROR_ID, rUNTIME_ERROR_ID,
nON_EXHAUSTIVE_GUARDS_ERROR_ID, nO_METHOD_BINDING_ERROR_ID,
pAT_ERROR_ID, rEC_SEL_ERROR_ID, aBSENT_ERROR_ID,
tYPE_ERROR_ID,
@@ -695,7 +695,6 @@ templates, but we don't ever expect to generate code for it.
errorIds :: [Id]
errorIds
= [ rUNTIME_ERROR_ID,
- iRREFUT_PAT_ERROR_ID,
nON_EXHAUSTIVE_GUARDS_ERROR_ID,
nO_METHOD_BINDING_ERROR_ID,
pAT_ERROR_ID,
@@ -706,14 +705,13 @@ errorIds
]
recSelErrorName, runtimeErrorName, absentErrorName :: Name
-irrefutPatErrorName, recConErrorName, patErrorName :: Name
+recConErrorName, patErrorName :: Name
nonExhaustiveGuardsErrorName, noMethodBindingErrorName :: Name
typeErrorName :: Name
recSelErrorName = err_nm "recSelError" recSelErrorIdKey rEC_SEL_ERROR_ID
absentErrorName = err_nm "absentError" absentErrorIdKey aBSENT_ERROR_ID
runtimeErrorName = err_nm "runtimeError" runtimeErrorIdKey rUNTIME_ERROR_ID
-irrefutPatErrorName = err_nm "irrefutPatError" irrefutPatErrorIdKey iRREFUT_PAT_ERROR_ID
recConErrorName = err_nm "recConError" recConErrorIdKey rEC_CON_ERROR_ID
patErrorName = err_nm "patError" patErrorIdKey pAT_ERROR_ID
typeErrorName = err_nm "typeError" typeErrorIdKey tYPE_ERROR_ID
@@ -726,12 +724,11 @@ nonExhaustiveGuardsErrorName = err_nm "nonExhaustiveGuardsError"
err_nm :: String -> Unique -> Id -> Name
err_nm str uniq id = mkWiredInIdName cONTROL_EXCEPTION_BASE (fsLit str) uniq id
-rEC_SEL_ERROR_ID, rUNTIME_ERROR_ID, iRREFUT_PAT_ERROR_ID, rEC_CON_ERROR_ID :: Id
+rEC_SEL_ERROR_ID, rUNTIME_ERROR_ID, rEC_CON_ERROR_ID :: Id
pAT_ERROR_ID, nO_METHOD_BINDING_ERROR_ID, nON_EXHAUSTIVE_GUARDS_ERROR_ID :: Id
tYPE_ERROR_ID, aBSENT_ERROR_ID :: Id
rEC_SEL_ERROR_ID = mkRuntimeErrorId recSelErrorName
rUNTIME_ERROR_ID = mkRuntimeErrorId runtimeErrorName
-iRREFUT_PAT_ERROR_ID = mkRuntimeErrorId irrefutPatErrorName
rEC_CON_ERROR_ID = mkRuntimeErrorId recConErrorName
pAT_ERROR_ID = mkRuntimeErrorId patErrorName
nO_METHOD_BINDING_ERROR_ID = mkRuntimeErrorId noMethodBindingErrorName
diff --git a/compiler/deSugar/DsUtils.hs b/compiler/deSugar/DsUtils.hs
index 3748193..f4d669c 100644
--- a/compiler/deSugar/DsUtils.hs
+++ b/compiler/deSugar/DsUtils.hs
@@ -760,7 +760,7 @@ mkSelectorBinds ticks pat val_expr
| otherwise -- General case (C)
= do { tuple_var <- newSysLocalDs tuple_ty
- ; error_expr <- mkErrorAppDs iRREFUT_PAT_ERROR_ID tuple_ty (ppr pat')
+ ; error_expr <- mkErrorAppDs pAT_ERROR_ID tuple_ty (ppr pat')
; tuple_expr <- matchSimply val_expr PatBindRhs pat
local_tuple error_expr
; let mk_tup_bind tick binder
diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs
index d5fc5b3..df13eaa 100644
--- a/compiler/prelude/PrelNames.hs
+++ b/compiler/prelude/PrelNames.hs
@@ -2073,7 +2073,7 @@ typeLitNatDataConKey = mkPreludeDataConUnique 108
wildCardKey, absentErrorIdKey, augmentIdKey, appendIdKey,
buildIdKey, errorIdKey, foldrIdKey, recSelErrorIdKey,
- seqIdKey, irrefutPatErrorIdKey, eqStringIdKey,
+ seqIdKey, eqStringIdKey,
noMethodBindingErrorIdKey, nonExhaustiveGuardsErrorIdKey,
runtimeErrorIdKey, patErrorIdKey, voidPrimIdKey,
realWorldPrimIdKey, recConErrorIdKey,
@@ -2090,7 +2090,6 @@ errorIdKey = mkPreludeMiscIdUnique 5
foldrIdKey = mkPreludeMiscIdUnique 6
recSelErrorIdKey = mkPreludeMiscIdUnique 7
seqIdKey = mkPreludeMiscIdUnique 8
-irrefutPatErrorIdKey = mkPreludeMiscIdUnique 9
eqStringIdKey = mkPreludeMiscIdUnique 10
noMethodBindingErrorIdKey = mkPreludeMiscIdUnique 11
nonExhaustiveGuardsErrorIdKey = mkPreludeMiscIdUnique 12
diff --git a/libraries/base/Control/Exception/Base.hs b/libraries/base/Control/Exception/Base.hs
index d443159..e675e0c 100644
--- a/libraries/base/Control/Exception/Base.hs
+++ b/libraries/base/Control/Exception/Base.hs
@@ -93,7 +93,7 @@ module Control.Exception.Base (
finally,
-- * Calls for GHC runtime
- recSelError, recConError, irrefutPatError, runtimeError,
+ recSelError, recConError, runtimeError,
nonExhaustiveGuardsError, patError, noMethodBindingError,
absentError, typeError,
nonTermination, nestedAtomically,
@@ -375,7 +375,7 @@ instance Exception NestedAtomically
-----
-recSelError, recConError, irrefutPatError, runtimeError,
+recSelError, recConError, runtimeError,
nonExhaustiveGuardsError, patError, noMethodBindingError,
absentError, typeError
:: Addr# -> a -- All take a UTF8-encoded C string
@@ -386,7 +386,6 @@ runtimeError s = errorWithoutStackTrace (unpackCStringUtf8# s)
absentError s = errorWithoutStackTrace ("Oops! Entered absent arg " ++ unpackCStringUtf8# s)
nonExhaustiveGuardsError s = throw (PatternMatchFail (untangle s "Non-exhaustive guards in"))
-irrefutPatError s = throw (PatternMatchFail (untangle s "Irrefutable pattern failed for pattern"))
recConError s = throw (RecConError (untangle s "Missing field in record construction"))
noMethodBindingError s = throw (NoMethodError (untangle s "No instance nor default method for class operation"))
patError s = throw (PatternMatchFail (untangle s "Non-exhaustive patterns in"))
diff --git a/testsuite/tests/deSugar/should_fail/DsStrictFail.stderr b/testsuite/tests/deSugar/should_fail/DsStrictFail.stderr
index c7135b2..a863168 100644
--- a/testsuite/tests/deSugar/should_fail/DsStrictFail.stderr
+++ b/testsuite/tests/deSugar/should_fail/DsStrictFail.stderr
@@ -1,2 +1,2 @@
-DsStrictFail: DsStrictFail.hs:4:12-23: Irrefutable pattern failed for pattern False
+DsStrictFail: DsStrictFail.hs:4:12-23: Non-exhaustive patterns in False
diff --git a/testsuite/tests/deSugar/should_run/dsrun008.stderr b/testsuite/tests/deSugar/should_run/dsrun008.stderr
index ff7de05..cef2458 100644
--- a/testsuite/tests/deSugar/should_run/dsrun008.stderr
+++ b/testsuite/tests/deSugar/should_run/dsrun008.stderr
@@ -1,2 +1,2 @@
-dsrun008: dsrun008.hs:2:15-42: Irrefutable pattern failed for pattern (2, x)
+dsrun008: dsrun008.hs:2:15-42: Non-exhaustive patterns in (2, x)
diff --git a/testsuite/tests/safeHaskell/safeLanguage/SafeLang15.stderr b/testsuite/tests/safeHaskell/safeLanguage/SafeLang15.stderr
index 5aed2c5..9434e29 100644
--- a/testsuite/tests/safeHaskell/safeLanguage/SafeLang15.stderr
+++ b/testsuite/tests/safeHaskell/safeLanguage/SafeLang15.stderr
@@ -1,2 +1,2 @@
-SafeLang15: SafeLang15.hs:22:9-37: Irrefutable pattern failed for pattern Just p'
+SafeLang15: SafeLang15.hs:22:9-37: Non-exhaustive patterns in Just p'
More information about the ghc-commits
mailing list