summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-04-25 16:16:04 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-04-28 17:28:08 +0100
commita2abcf6e9c91532311235b8fece1d187e3980c72 (patch)
tree39134cd4c95ffe33ea82efc54e2368370eb602e6
parentaf6dced902ba158f0b05b224ff4afb5a3f9c9e5a (diff)
downloadhaskell-a2abcf6e9c91532311235b8fece1d187e3980c72.tar.gz
Minor improvement to error message
"One fewer arguments to ..." rather than "One fewer argument to ..."
-rw-r--r--compiler/typecheck/TcErrors.hs13
-rw-r--r--testsuite/tests/deriving/should_fail/drvfail005.stderr2
-rw-r--r--testsuite/tests/polykinds/T6039.stderr2
-rw-r--r--testsuite/tests/th/T3177a.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/T11356.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T2994.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T4875.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/T7778.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail070.stderr10
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail078.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail113.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail132.stderr22
12 files changed, 31 insertions, 34 deletions
diff --git a/compiler/typecheck/TcErrors.hs b/compiler/typecheck/TcErrors.hs
index f23a75b940..b51a267499 100644
--- a/compiler/typecheck/TcErrors.hs
+++ b/compiler/typecheck/TcErrors.hs
@@ -1695,23 +1695,20 @@ mkExpectedActualMsg ty1 ty2 (TypeEqOrigin { uo_actual = act
Just num_act_args -> num_act_args >= -n
-- don't report to strip off args that aren't there
-> Just $ text "Expecting" <+> speakN (abs n) <+>
- more_or_fewer <+> plural_n (abs n) (text "argument")
- <+> text "to" <+> quotes (ppr thing)
+ more_or_fewer <+> quotes (ppr thing)
where
- more_or_fewer | n < 0 = text "fewer"
- | otherwise = text "more"
+ more_or_fewer
+ | n < 0 = text "fewer arguments to"
+ | n == 1 = text "more argument to"
+ | otherwise = text "more arguments to" -- n > 1
_ -> Nothing
-
maybe_num_args_msg = case num_args_msg of
Nothing -> empty
Just m -> m
count_args ty = count isVisibleBinder $ fst $ splitPiTys ty
- plural_n 1 doc = doc
- plural_n _ doc = doc <> char 's'
-
expandedTys =
ppUnless (expTy1 `pickyEqType` exp && expTy2 `pickyEqType` act) $ vcat
[ text "Type synonyms expanded:"
diff --git a/testsuite/tests/deriving/should_fail/drvfail005.stderr b/testsuite/tests/deriving/should_fail/drvfail005.stderr
index 552b3b0291..4805c14538 100644
--- a/testsuite/tests/deriving/should_fail/drvfail005.stderr
+++ b/testsuite/tests/deriving/should_fail/drvfail005.stderr
@@ -1,6 +1,6 @@
drvfail005.hs:4:13: error:
- • Expecting one fewer argument to ‘Show a’
+ • Expecting one fewer arguments to ‘Show a’
Expected kind ‘k0 -> Constraint’,
but ‘Show a’ has kind ‘Constraint’
• In the data declaration for ‘Test’
diff --git a/testsuite/tests/polykinds/T6039.stderr b/testsuite/tests/polykinds/T6039.stderr
index 2ad2935e9b..4c31bb4aa4 100644
--- a/testsuite/tests/polykinds/T6039.stderr
+++ b/testsuite/tests/polykinds/T6039.stderr
@@ -1,5 +1,5 @@
T6039.hs:5:14: error:
- • Expecting one fewer argument to ‘j’
+ • Expecting one fewer arguments to ‘j’
Expected kind ‘* -> *’, but ‘j’ has kind ‘*’
• In the kind ‘j k’
diff --git a/testsuite/tests/th/T3177a.stderr b/testsuite/tests/th/T3177a.stderr
index fa80d0e864..0b540a8bf2 100644
--- a/testsuite/tests/th/T3177a.stderr
+++ b/testsuite/tests/th/T3177a.stderr
@@ -1,12 +1,12 @@
T3177a.hs:8:8: error:
- • Expecting one fewer argument to ‘Int’
+ • Expecting one fewer arguments to ‘Int’
Expected kind ‘* -> *’, but ‘Int’ has kind ‘*’
• In the type signature:
f :: Int Int
T3177a.hs:11:6: error:
- • Expecting one fewer argument to ‘Int’
+ • Expecting one fewer arguments to ‘Int’
Expected kind ‘* -> *’, but ‘Int’ has kind ‘*’
• In the type signature:
g :: Int Int
diff --git a/testsuite/tests/typecheck/should_fail/T11356.stderr b/testsuite/tests/typecheck/should_fail/T11356.stderr
index 803dcabf95..aa1db97c62 100644
--- a/testsuite/tests/typecheck/should_fail/T11356.stderr
+++ b/testsuite/tests/typecheck/should_fail/T11356.stderr
@@ -1,5 +1,5 @@
T11356.hs:3:7: error:
- • Expecting one fewer argument to ‘T p’
+ • Expecting one fewer arguments to ‘T p’
Expected kind ‘k0 -> Constraint’, but ‘T p’ has kind ‘Constraint’
• In the class declaration for ‘C’
diff --git a/testsuite/tests/typecheck/should_fail/T2994.stderr b/testsuite/tests/typecheck/should_fail/T2994.stderr
index 86aaf08423..d4e07e4597 100644
--- a/testsuite/tests/typecheck/should_fail/T2994.stderr
+++ b/testsuite/tests/typecheck/should_fail/T2994.stderr
@@ -18,7 +18,7 @@ T2994.hs:13:23: error:
In the instance declaration for ‘MonadReader (Reader' r)’
T2994.hs:15:10: error:
- • Expecting one fewer argument to ‘MonadReader r r’
+ • Expecting one fewer arguments to ‘MonadReader r r’
Expected kind ‘(* -> *) -> Constraint’,
but ‘MonadReader r r’ has kind ‘Constraint’
• In the instance declaration for ‘MonadReader r r (Reader' r)’
diff --git a/testsuite/tests/typecheck/should_fail/T4875.stderr b/testsuite/tests/typecheck/should_fail/T4875.stderr
index 80e1e0e99d..782b0969d5 100644
--- a/testsuite/tests/typecheck/should_fail/T4875.stderr
+++ b/testsuite/tests/typecheck/should_fail/T4875.stderr
@@ -1,6 +1,6 @@
T4875.hs:27:24: error:
- • Expecting one fewer argument to ‘r’
+ • Expecting one fewer arguments to ‘r’
Expected kind ‘* -> *’, but ‘r’ has kind ‘*’
• In the type signature:
multiplicities :: r c -> [c]
diff --git a/testsuite/tests/typecheck/should_fail/T7778.stderr b/testsuite/tests/typecheck/should_fail/T7778.stderr
index 545d885129..2db22e95ff 100644
--- a/testsuite/tests/typecheck/should_fail/T7778.stderr
+++ b/testsuite/tests/typecheck/should_fail/T7778.stderr
@@ -1,6 +1,6 @@
T7778.hs:3:7: error:
- • Expecting one fewer argument to ‘Num Int => Num’
+ • Expecting one fewer arguments to ‘Num Int => Num’
Expected kind ‘* -> Constraint’, but ‘Num Int => Num’ has kind ‘*’
• In the type signature:
v :: ((Num Int => Num) ()) => ()
diff --git a/testsuite/tests/typecheck/should_fail/tcfail070.stderr b/testsuite/tests/typecheck/should_fail/tcfail070.stderr
index 6236947709..aa20e5d45f 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail070.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail070.stderr
@@ -1,6 +1,6 @@
-tcfail070.hs:15:15:
- Expecting one fewer argument to ‘[Int]’
- Expected kind ‘* -> k0’, but ‘[Int]’ has kind ‘*’
- In the type ‘[Int] Bool’
- In the type declaration for ‘State’
+tcfail070.hs:15:15: error:
+ • Expecting one fewer arguments to ‘[Int]’
+ Expected kind ‘* -> k0’, but ‘[Int]’ has kind ‘*’
+ • In the type ‘[Int] Bool’
+ In the type declaration for ‘State’
diff --git a/testsuite/tests/typecheck/should_fail/tcfail078.stderr b/testsuite/tests/typecheck/should_fail/tcfail078.stderr
index f68b142340..8a94f7c4e4 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail078.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail078.stderr
@@ -1,6 +1,6 @@
tcfail078.hs:5:6: error:
- • Expecting one fewer argument to ‘Integer’
+ • Expecting one fewer arguments to ‘Integer’
Expected kind ‘* -> Constraint’, but ‘Integer’ has kind ‘*’
• In the type signature:
f :: Integer i => i
diff --git a/testsuite/tests/typecheck/should_fail/tcfail113.stderr b/testsuite/tests/typecheck/should_fail/tcfail113.stderr
index b84151ac73..410ce3daac 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail113.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail113.stderr
@@ -12,7 +12,7 @@ tcfail113.hs:15:8: error:
g :: T Int
tcfail113.hs:18:6: error:
- • Expecting one fewer argument to ‘Int’
+ • Expecting one fewer arguments to ‘Int’
Expected kind ‘* -> *’, but ‘Int’ has kind ‘*’
• In the type signature:
h :: Int Int
diff --git a/testsuite/tests/typecheck/should_fail/tcfail132.stderr b/testsuite/tests/typecheck/should_fail/tcfail132.stderr
index 9ec35d7d9f..78209d2bc4 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail132.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail132.stderr
@@ -1,15 +1,15 @@
tcfail132.hs:17:37: error:
- Expecting one fewer argument to ‘Object f' f t’
- Expected kind ‘* -> * -> * -> *’,
- but ‘Object f' f t’ has kind ‘* -> * -> *’
- In the first argument of ‘T’, namely ‘Object f' f t’
- In the type ‘T (Object f' f t) (DUnit t)’
- In the type declaration for ‘LiftObject’
+ • Expecting one fewer arguments to ‘Object f' f t’
+ Expected kind ‘* -> * -> * -> *’,
+ but ‘Object f' f t’ has kind ‘* -> * -> *’
+ • In the first argument of ‘T’, namely ‘Object f' f t’
+ In the type ‘T (Object f' f t) (DUnit t)’
+ In the type declaration for ‘LiftObject’
tcfail132.hs:17:53: error:
- Expected kind ‘* -> * -> * -> *’,
- but ‘DUnit t’ has kind ‘* -> * -> *’
- In the second argument of ‘T’, namely ‘DUnit t’
- In the type ‘T (Object f' f t) (DUnit t)’
- In the type declaration for ‘LiftObject’
+ • Expected kind ‘* -> * -> * -> *’,
+ but ‘DUnit t’ has kind ‘* -> * -> *’
+ • In the second argument of ‘T’, namely ‘DUnit t’
+ In the type ‘T (Object f' f t) (DUnit t)’
+ In the type declaration for ‘LiftObject’