summaryrefslogtreecommitdiff
path: root/testsuite/tests/typecheck/should_fail
diff options
context:
space:
mode:
authorDavid Kraeutmann <kane@kane.cx>2015-10-07 20:28:46 -0500
committerAustin Seipp <austin@well-typed.com>2015-10-07 20:30:20 -0500
commit7b443bb1df8f7f0a6b3124537590aa655a9300cd (patch)
tree9a15aeb8de755743b236f83129ad63fa4ec93304 /testsuite/tests/typecheck/should_fail
parentea4df12f7f3fc4d1d2af335804b8ec893f45550c (diff)
downloadhaskell-7b443bb1df8f7f0a6b3124537590aa655a9300cd.tar.gz
Improve error messages for ambiguous type variables
Improved error messages are only printed when the old message would be "No instance for...", since they're not as helpful for "Could not deduce..." No special test case as error messages are tested by other tests already. Signed-off-by: David Kraeutmann <kane@kane.cx> Reviewed By: austin, goldfire Differential Revision: https://phabricator.haskell.org/D1182 GHC Trac Issues: #10733
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
-rw-r--r--testsuite/tests/typecheck/should_fail/T4921.stderr14
-rw-r--r--testsuite/tests/typecheck/should_fail/T5858.stderr9
-rw-r--r--testsuite/tests/typecheck/should_fail/T7857.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail008.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail040.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail043.stderr14
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail072.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail128.stderr9
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail133.stderr7
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail181.stderr2
10 files changed, 41 insertions, 32 deletions
diff --git a/testsuite/tests/typecheck/should_fail/T4921.stderr b/testsuite/tests/typecheck/should_fail/T4921.stderr
index 091d461328..42d5a8a363 100644
--- a/testsuite/tests/typecheck/should_fail/T4921.stderr
+++ b/testsuite/tests/typecheck/should_fail/T4921.stderr
@@ -1,18 +1,20 @@
T4921.hs:10:9: error:
- No instance for (C a0 b1) arising from a use of ‘f’
- The type variables ‘b1’, ‘a0’ are ambiguous
+ Ambiguous type variables ‘b1’, ‘a0’ arising from a use of ‘f’
+ prevents the constraint ‘(C a0 b1)’ from being solved.
Relevant bindings include x :: a0 (bound at T4921.hs:10:1)
- Potential instances:
+ Probable fix: use a type annotation to specify what ‘b1’, ‘a0’ should be.
+ These potential instance exist:
instance C Int Char -- Defined at T4921.hs:7:10
In the first argument of ‘fst’, namely ‘f’
In the expression: fst f
In an equation for ‘x’: x = fst f
T4921.hs:12:9: error:
- No instance for (C Int b0) arising from a use of ‘f’
- The type variable ‘b0’ is ambiguous
- Potential instances:
+ Ambiguous type variable ‘b0’ arising from a use of ‘f’
+ prevents the constraint ‘(C Int b0)’ from being solved.
+ Probable fix: use a type annotation to specify what ‘b0’ should be.
+ These potential instance exist:
instance C Int Char -- Defined at T4921.hs:7:10
In the first argument of ‘fst’, namely ‘f’
In the expression: fst f :: Int
diff --git a/testsuite/tests/typecheck/should_fail/T5858.stderr b/testsuite/tests/typecheck/should_fail/T5858.stderr
index 9c381d9bf6..7d974d88b7 100644
--- a/testsuite/tests/typecheck/should_fail/T5858.stderr
+++ b/testsuite/tests/typecheck/should_fail/T5858.stderr
@@ -1,9 +1,10 @@
T5858.hs:11:7: error:
- No instance for (InferOverloaded ([t0], [t1]))
- arising from a use of ‘infer’
- The type variables ‘t0’, ‘t1’ are ambiguous
- Potential instances:
+ Ambiguous type variables ‘t0’, ‘t1’ arising from a use of ‘infer’
+ prevents the constraint ‘(InferOverloaded
+ ([t0], [t1]))’ from being solved.
+ Probable fix: use a type annotation to specify what ‘t0’, ‘t1’ should be.
+ These potential instance exist:
instance (t1 ~ String) => InferOverloaded (t1, t1)
-- Defined at T5858.hs:8:10
In the expression: infer ([], [])
diff --git a/testsuite/tests/typecheck/should_fail/T7857.stderr b/testsuite/tests/typecheck/should_fail/T7857.stderr
index f413eb50f2..e923a02472 100644
--- a/testsuite/tests/typecheck/should_fail/T7857.stderr
+++ b/testsuite/tests/typecheck/should_fail/T7857.stderr
@@ -5,7 +5,7 @@ T7857.hs:8:11: error:
bound by the inferred type of g :: PrintfArg t => t -> b
at T7857.hs:8:1-21
The type variable ‘r0’ is ambiguous
- Potential instances:
+ These potential instances exist:
instance [safe] (a ~ ()) => PrintfType (IO a)
-- Defined in ‘Text.Printf’
instance [safe] (PrintfArg a, PrintfType r) => PrintfType (a -> r)
diff --git a/testsuite/tests/typecheck/should_fail/tcfail008.stderr b/testsuite/tests/typecheck/should_fail/tcfail008.stderr
index db70a632f4..d84c3b90e3 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail008.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail008.stderr
@@ -1,9 +1,10 @@
tcfail008.hs:3:5: error:
- No instance for (Num a0) arising from the literal ‘1’
- The type variable ‘a0’ is ambiguous
+ Ambiguous type variable ‘a0’ arising from the literal ‘1’
+ prevents the constraint ‘(Num a0)’ from being solved.
Relevant bindings include o :: [a0] (bound at tcfail008.hs:3:1)
- Potential instances:
+ Probable fix: use a type annotation to specify what ‘a0’ should be.
+ These potential instances exist:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
diff --git a/testsuite/tests/typecheck/should_fail/tcfail040.stderr b/testsuite/tests/typecheck/should_fail/tcfail040.stderr
index 68e958ecab..6e0da922c5 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail040.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail040.stderr
@@ -1,8 +1,9 @@
tcfail040.hs:19:5: error:
- No instance for (ORD a0) arising from a use of ‘<<’
- The type variable ‘a0’ is ambiguous
- Potential instances:
+ Ambiguous type variable ‘a0’ arising from a use of ‘<<’
+ prevents the constraint ‘(ORD a0)’ from being solved.
+ Probable fix: use a type annotation to specify what ‘a0’ should be.
+ These potential instance exist:
instance ORD (a -> b) -- Defined at tcfail040.hs:17:10
In the first argument of ‘(===)’, namely ‘(<<)’
In the expression: (<<) === (<<)
diff --git a/testsuite/tests/typecheck/should_fail/tcfail043.stderr b/testsuite/tests/typecheck/should_fail/tcfail043.stderr
index fe24adc4e4..c30b5bf854 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail043.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail043.stderr
@@ -1,12 +1,13 @@
tcfail043.hs:38:17: error:
- No instance for (Ord_ a0) arising from a use of ‘gt’
- The type variable ‘a0’ is ambiguous
+ Ambiguous type variable ‘a0’ arising from a use of ‘gt’
+ prevents the constraint ‘(Ord_ a0)’ from being solved.
Relevant bindings include
bs :: [a0] (bound at tcfail043.hs:38:8)
a :: a0 (bound at tcfail043.hs:38:6)
search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1)
- Potential instances:
+ Probable fix: use a type annotation to specify what ‘a0’ should be.
+ These potential instance exist:
instance Ord_ Int -- Defined at tcfail043.hs:34:10
In the expression: gt (hd bs) a
In the expression:
@@ -22,13 +23,14 @@ tcfail043.hs:38:17: error:
if eq a (hd bs) then True else search a (tl bs)
tcfail043.hs:40:25: error:
- No instance for (Eq_ a0) arising from a use of ‘eq’
- The type variable ‘a0’ is ambiguous
+ Ambiguous type variable ‘a0’ arising from a use of ‘eq’
+ prevents the constraint ‘(Eq_ a0)’ from being solved.
Relevant bindings include
bs :: [a0] (bound at tcfail043.hs:38:8)
a :: a0 (bound at tcfail043.hs:38:6)
search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1)
- Potential instances:
+ Probable fix: use a type annotation to specify what ‘a0’ should be.
+ These potential instances exist:
instance Eq_ Int -- Defined at tcfail043.hs:20:10
instance Eq_ a => Eq_ [a] -- Defined at tcfail043.hs:23:10
In the expression: eq a (hd bs)
diff --git a/testsuite/tests/typecheck/should_fail/tcfail072.stderr b/testsuite/tests/typecheck/should_fail/tcfail072.stderr
index 3f40718428..65b157332d 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail072.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail072.stderr
@@ -6,7 +6,7 @@ tcfail072.hs:23:13: error:
g :: (Ord p, Ord q) => AB p q -> Bool
at tcfail072.hs:22:6-38
The type variable ‘p0’ is ambiguous
- Potential instances:
+ These potential instances exist:
instance Ord Ordering -- Defined in ‘GHC.Classes’
instance Ord Integer
-- Defined in ‘integer-gmp-1.0.0.0:GHC.Integer.Type’
diff --git a/testsuite/tests/typecheck/should_fail/tcfail128.stderr b/testsuite/tests/typecheck/should_fail/tcfail128.stderr
index 4ad7273c0b..1aab117592 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail128.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail128.stderr
@@ -1,9 +1,10 @@
tcfail128.hs:18:16: error:
- No instance for (Data.Array.Base.MArray b0 FlatVector IO)
- arising from a use of ‘thaw’
- The type variable ‘b0’ is ambiguous
- Potential instances:
+ Ambiguous type variable ‘b0’ arising from a use of ‘thaw’
+ prevents the constraint ‘(Data.Array.Base.MArray
+ b0 FlatVector IO)’ from being solved.
+ Probable fix: use a type annotation to specify what ‘b0’ should be.
+ These potential instance exist:
instance Data.Array.Base.MArray IOArray e IO
-- Defined in ‘Data.Array.Base’
In a stmt of a 'do' block: v <- thaw tmp
diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
index bba5889603..f61320f4c1 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
@@ -3,9 +3,10 @@ tcfail133.hs:2:61: warning:
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
tcfail133.hs:68:7: error:
- No instance for (Show r0) arising from a use of ‘show’
- The type variable ‘r0’ is ambiguous
- Potential instances:
+ Ambiguous type variable ‘r0’ arising from a use of ‘show’
+ prevents the constraint ‘(Show r0)’ from being solved.
+ Probable fix: use a type annotation to specify what ‘r0’ should be.
+ These potential instances exist:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Integer -- Defined in ‘GHC.Show’
instance (Show a, Show b, Number a, Digit b) => Show (a :@ b)
diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr
index 70dbbd5508..47aeccc586 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr
@@ -6,7 +6,7 @@ tcfail181.hs:17:9: error:
wog :: Monad m => t -> Something (m Bool) e
at tcfail181.hs:17:1-30
The type variable ‘m0’ is ambiguous
- Potential instances:
+ These potential instances exist:
instance Monad IO -- Defined in ‘GHC.Base’
instance Monad Maybe -- Defined in ‘GHC.Base’
instance Monad ((->) r) -- Defined in ‘GHC.Base’