diff options
author | sheaf <sam.derbyshire@gmail.com> | 2021-11-19 10:19:19 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-11-20 18:13:23 -0500 |
commit | 742d8b6049c30f3b0cd1704d7a34d865bef41712 (patch) | |
tree | b22ad862ca4db2e9004d8b4ab4aafbc11bcde0a9 /testsuite/tests/typecheck/should_fail | |
parent | bc7e9f038112496c45aeb81d1504e57acb3722c7 (diff) | |
download | haskell-742d8b6049c30f3b0cd1704d7a34d865bef41712.tar.gz |
Include "not more specific" info in overlap msg
When instances overlap, we now include additional information
about why we weren't able to select an instance: perhaps
one instance overlapped another but was not strictly more specific,
so we aren't able to directly choose it.
Fixes #20542
Diffstat (limited to 'testsuite/tests/typecheck/should_fail')
28 files changed, 113 insertions, 98 deletions
diff --git a/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr b/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr index 651aad6c57..57d5ceb9e8 100644 --- a/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr +++ b/testsuite/tests/typecheck/should_fail/FailDueToGivenOverlapping.stderr @@ -6,7 +6,7 @@ FailDueToGivenOverlapping.hs:27:9: error: bound by the type signature for: bar :: E [Int] => () -> () at FailDueToGivenOverlapping.hs:26:1-26 - Matching instances: + Matching instance: instance E [a] -- Defined at FailDueToGivenOverlapping.hs:21:10 (The choice depends on the instantiation of ‘a0’) • In the expression: eop [undefined] diff --git a/testsuite/tests/typecheck/should_fail/T10971b.stderr b/testsuite/tests/typecheck/should_fail/T10971b.stderr index 1a6104d501..b527f8d07c 100644 --- a/testsuite/tests/typecheck/should_fail/T10971b.stderr +++ b/testsuite/tests/typecheck/should_fail/T10971b.stderr @@ -6,12 +6,11 @@ T10971b.hs:4:11: error: x :: t2 a (bound at T10971b.hs:4:6) f :: t2 a -> Int (bound at T10971b.hs:4:1) Probable fix: use a type annotation to specify what ‘t2’ should be. - These potential instances exist: + Potentially matching instances: instance Foldable (Either a) -- Defined in ‘Data.Foldable’ instance Foldable Maybe -- Defined in ‘Data.Foldable’ - instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus three others + ...plus 29 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: length x In the expression: \ x -> length x @@ -24,12 +23,11 @@ T10971b.hs:5:13: error: x :: t1 a (bound at T10971b.hs:5:8) g :: (a -> b) -> t1 a -> t1 b (bound at T10971b.hs:5:1) Probable fix: use a type annotation to specify what ‘t1’ should be. - These potential instances exist: + Potentially matching instances: instance Traversable (Either a) -- Defined in ‘Data.Traversable’ instance Traversable Maybe -- Defined in ‘Data.Traversable’ - instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus three others + ...plus 29 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: fmapDefault f x In the expression: \ f x -> fmapDefault f x @@ -42,12 +40,11 @@ T10971b.hs:6:14: error: x :: t0 a (bound at T10971b.hs:6:8) h :: (a -> b) -> t0 a -> (t0 b, Int) (bound at T10971b.hs:6:1) Probable fix: use a type annotation to specify what ‘t0’ should be. - These potential instances exist: + Potentially matching instances: instance Traversable (Either a) -- Defined in ‘Data.Traversable’ instance Traversable Maybe -- Defined in ‘Data.Traversable’ - instance Traversable ((,) a) -- Defined in ‘Data.Traversable’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus three others + ...plus 29 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: fmapDefault f x In the expression: (fmapDefault f x, length x) @@ -60,12 +57,11 @@ T10971b.hs:6:31: error: x :: t0 a (bound at T10971b.hs:6:8) h :: (a -> b) -> t0 a -> (t0 b, Int) (bound at T10971b.hs:6:1) Probable fix: use a type annotation to specify what ‘t0’ should be. - These potential instances exist: + Potentially matching instances: instance Foldable (Either a) -- Defined in ‘Data.Foldable’ instance Foldable Maybe -- Defined in ‘Data.Foldable’ - instance Foldable ((,) a) -- Defined in ‘Data.Foldable’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus three others + ...plus 29 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: length x In the expression: (fmapDefault f x, length x) diff --git a/testsuite/tests/typecheck/should_fail/T12921.stderr b/testsuite/tests/typecheck/should_fail/T12921.stderr index b3de93e2f4..8b1e638d27 100644 --- a/testsuite/tests/typecheck/should_fail/T12921.stderr +++ b/testsuite/tests/typecheck/should_fail/T12921.stderr @@ -3,15 +3,13 @@ T12921.hs:4:1: error: • Ambiguous type variable ‘a0’ arising from an annotation prevents the constraint ‘(Data.Data.Data a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Either a b) -- Defined in ‘Data.Data’ instance Data.Data.Data Ordering -- Defined in ‘Data.Data’ - instance Data.Data.Data a => Data.Data.Data (Maybe a) - -- Defined in ‘Data.Data’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus 17 others + ...plus 50 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the annotation: {-# ANN module "HLint: ignore Reduce duplication" #-} @@ -21,10 +19,10 @@ T12921.hs:4:16: error: prevents the constraint ‘(Data.String.IsString a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instance: instance (a ~ Char) => Data.String.IsString [a] -- Defined in ‘Data.String’ - ...plus N instances involving out-of-scope types + ...plus two instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the annotation: {-# ANN module "HLint: ignore Reduce duplication" #-} diff --git a/testsuite/tests/typecheck/should_fail/T13292.stderr b/testsuite/tests/typecheck/should_fail/T13292.stderr index 2cc7bb41c3..9d0d3fe7ee 100644 --- a/testsuite/tests/typecheck/should_fail/T13292.stderr +++ b/testsuite/tests/typecheck/should_fail/T13292.stderr @@ -5,11 +5,10 @@ T13292a.hs:4:12: warning: [-Wdeferred-type-errors (in -Wdefault)] Relevant bindings include someFunc :: m0 () (bound at T13292a.hs:4:1) Probable fix: use a type annotation to specify what ‘m0’ should be. - These potential instances exist: + Potentially matching instances: instance Monad IO -- Defined in ‘GHC.Base’ instance Monad Maybe -- Defined in ‘GHC.Base’ - instance Monad ((->) r) -- Defined in ‘GHC.Base’ - ...plus N others + ...plus six others ...plus one instance involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: return () diff --git a/testsuite/tests/typecheck/should_fail/T14884.stderr b/testsuite/tests/typecheck/should_fail/T14884.stderr index e28ad780bf..d949df2ec6 100644 --- a/testsuite/tests/typecheck/should_fail/T14884.stderr +++ b/testsuite/tests/typecheck/should_fail/T14884.stderr @@ -35,13 +35,12 @@ T14884.hs:4:7: error: • Ambiguous type variable ‘a0’ arising from a use of ‘print’ prevents the constraint ‘(Show a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: instance (Show a, Show b) => Show (Either a b) -- Defined in ‘Data.Either’ instance Show Ordering -- Defined in ‘GHC.Show’ - instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus 26 others + ...plus 28 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the first argument of ‘_’, namely ‘print’ In the expression: _ print "abc" diff --git a/testsuite/tests/typecheck/should_fail/T15883b.stderr b/testsuite/tests/typecheck/should_fail/T15883b.stderr index 4da31915ac..0e03d99a37 100644 --- a/testsuite/tests/typecheck/should_fail/T15883b.stderr +++ b/testsuite/tests/typecheck/should_fail/T15883b.stderr @@ -3,11 +3,10 @@ T15883b.hs:14:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘==’ prevents the constraint ‘(Eq a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: instance Eq SpecConstrAnnotation -- Defined in ‘GHC.Exts’ instance Eq Ordering -- Defined in ‘GHC.Classes’ - instance Eq (Foo LiftedRep) -- Defined at T15883b.hs:14:1 - ...plus 24 others + ...plus 25 others ...plus four instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: a1 == b1 diff --git a/testsuite/tests/typecheck/should_fail/T15883c.stderr b/testsuite/tests/typecheck/should_fail/T15883c.stderr index 07451af880..c55a688ed9 100644 --- a/testsuite/tests/typecheck/should_fail/T15883c.stderr +++ b/testsuite/tests/typecheck/should_fail/T15883c.stderr @@ -8,11 +8,10 @@ T15883c.hs:14:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘compare’ prevents the constraint ‘(Ord a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: instance Ord Ordering -- Defined in ‘GHC.Classes’ instance Ord (Foo LiftedRep) -- Defined at T15883c.hs:14:1 - instance Ord Integer -- Defined in ‘GHC.Num.Integer’ - ...plus 23 others + ...plus 24 others ...plus two instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: a1 `compare` b1 @@ -26,11 +25,10 @@ T15883c.hs:14:1: error: • Ambiguous type variable ‘a1’ arising from a use of ‘<’ prevents the constraint ‘(Ord a1)’ from being solved. Probable fix: use a type annotation to specify what ‘a1’ should be. - These potential instances exist: + Potentially matching instances: instance Ord Ordering -- Defined in ‘GHC.Classes’ instance Ord (Foo LiftedRep) -- Defined at T15883c.hs:14:1 - instance Ord Integer -- Defined in ‘GHC.Num.Integer’ - ...plus 23 others + ...plus 24 others ...plus two instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: a1 < b1 diff --git a/testsuite/tests/typecheck/should_fail/T15883d.stderr b/testsuite/tests/typecheck/should_fail/T15883d.stderr index ba5618628d..eea1ccac2d 100644 --- a/testsuite/tests/typecheck/should_fail/T15883d.stderr +++ b/testsuite/tests/typecheck/should_fail/T15883d.stderr @@ -3,11 +3,10 @@ T15883d.hs:14:1: error: • Ambiguous type variable ‘a0’ arising from a use of ‘showsPrec’ prevents the constraint ‘(Show a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: instance Show Ordering -- Defined in ‘GHC.Show’ instance Show (Foo LiftedRep) -- Defined at T15883d.hs:14:1 - instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ - ...plus 28 others + ...plus 29 others ...plus 9 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the second argument of ‘(.)’, namely ‘(showsPrec 11 b1)’ diff --git a/testsuite/tests/typecheck/should_fail/T15883e.stderr b/testsuite/tests/typecheck/should_fail/T15883e.stderr index 81b6d8172a..947e45270f 100644 --- a/testsuite/tests/typecheck/should_fail/T15883e.stderr +++ b/testsuite/tests/typecheck/should_fail/T15883e.stderr @@ -3,12 +3,11 @@ T15883e.hs:16:1: error: • Ambiguous type variable ‘d0’ arising from a use of ‘k’ prevents the constraint ‘(Data d0)’ from being solved. Probable fix: use a type annotation to specify what ‘d0’ should be. - These potential instances exist: + Potentially matching instances: instance (Data a, Data b) => Data (Either a b) -- Defined in ‘Data.Data’ instance Data a => Data (Down a) -- Defined in ‘Data.Data’ - instance Data SpecConstrAnnotation -- Defined in ‘GHC.Exts’ - ...plus 20 others + ...plus 21 others ...plus 48 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: z (\ a1 -> MkFoo a1) `k` a1 @@ -38,12 +37,11 @@ T15883e.hs:16:1: error: • Ambiguous type variable ‘b0’ arising from a use of ‘k’ prevents the constraint ‘(Data b0)’ from being solved. Probable fix: use a type annotation to specify what ‘b0’ should be. - These potential instances exist: + Potentially matching instances: instance (Data a, Data b) => Data (Either a b) -- Defined in ‘Data.Data’ instance Data a => Data (Down a) -- Defined in ‘Data.Data’ - instance Data SpecConstrAnnotation -- Defined in ‘GHC.Exts’ - ...plus 20 others + ...plus 21 others ...plus 48 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: k (z (\ a1 -> MkFoo a1)) diff --git a/testsuite/tests/typecheck/should_fail/T16414.stderr b/testsuite/tests/typecheck/should_fail/T16414.stderr index 601f4097db..57a31ffd4b 100644 --- a/testsuite/tests/typecheck/should_fail/T16414.stderr +++ b/testsuite/tests/typecheck/should_fail/T16414.stderr @@ -6,7 +6,7 @@ T16414.hs:15:6: error: bound by the type signature for: f1 :: forall x. (All x, AllZip2 I) => x -> () at T16414.hs:14:1-35 - Matching instances: + Matching instance: instance AllZip2 f -- Defined at T16414.hs:12:10 (The choice depends on the instantiation of ‘f0’) • In the expression: f2 diff --git a/testsuite/tests/typecheck/should_fail/T20122.stderr b/testsuite/tests/typecheck/should_fail/T20122.stderr index f3e987ee23..d810d1433f 100644 --- a/testsuite/tests/typecheck/should_fail/T20122.stderr +++ b/testsuite/tests/typecheck/should_fail/T20122.stderr @@ -5,8 +5,7 @@ T20122.hs:11:7: error: Relevant bindings include foo :: a0 -> Bool (bound at T20122.hs:11:1) Probable fix: use a type annotation to specify what ‘a0’ should be. - This potential instance exists: - instance Testable A - -- Defined at T20122.hs:8:10 + Potentially matching instance: + instance Testable A -- Defined at T20122.hs:8:10 • In the expression: test In an equation for ‘foo’: foo = test diff --git a/testsuite/tests/typecheck/should_fail/T20542.hs b/testsuite/tests/typecheck/should_fail/T20542.hs new file mode 100644 index 0000000000..20c068dd59 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T20542.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE TypeSynonymInstances #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} + +module T20542 where + +class Foo a b where + foo :: a -> b + +instance {-# OVERLAPPABLE #-} Show a => Foo a String where + foo = show + +instance {-# OVERLAPPING #-} Read b => Foo String b where + foo = read + +bar :: String -> String +bar = foo diff --git a/testsuite/tests/typecheck/should_fail/T20542.stderr b/testsuite/tests/typecheck/should_fail/T20542.stderr new file mode 100644 index 0000000000..14fb60848c --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T20542.stderr @@ -0,0 +1,15 @@ + +T20542.hs:17:7: error: + • Overlapping instances for Foo String String + arising from a use of ‘foo’ + Matching instances: + instance [overlappable] Show a => Foo a String + -- Defined at T20542.hs:10:31 + instance [overlapping] Read b => Foo String b + -- Defined at T20542.hs:13:30 + An overlapping instance can only be chosen when it is strictly more specific. + The first instance that follows overlaps the second, but is not more specific than it: + instance [overlapping] Read b => Foo String b + instance [overlappable] Show a => Foo a String + • In the expression: foo + In an equation for ‘bar’: bar = foo diff --git a/testsuite/tests/typecheck/should_fail/T4921.stderr b/testsuite/tests/typecheck/should_fail/T4921.stderr index c4510cbb08..392928b7eb 100644 --- a/testsuite/tests/typecheck/should_fail/T4921.stderr +++ b/testsuite/tests/typecheck/should_fail/T4921.stderr @@ -5,7 +5,7 @@ T4921.hs:10:9: error: Relevant bindings include x :: a0 (bound at T4921.hs:10:1) Probable fix: use a type annotation to specify what ‘a0’, ‘b1’ should be. - This potential instance exists: + Potentially matching instance: instance C Int Char -- Defined at T4921.hs:7:10 • In the first argument of ‘fst’, namely ‘f’ In the expression: fst f @@ -15,7 +15,7 @@ T4921.hs:12:9: error: • 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. - This potential instance exists: + Potentially matching instance: 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/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr index 3641d18f34..27784f8250 100644 --- a/testsuite/tests/typecheck/should_fail/T5095.stderr +++ b/testsuite/tests/typecheck/should_fail/T5095.stderr @@ -1,12 +1,13 @@ T5095.hs:9:11: error: • Overlapping instances for Eq a arising from a use of ‘==’ - Matching instances: + Matching instance: instance [overlappable] Show a => Eq a -- Defined at T5095.hs:5:31 + Potentially matching instances: instance Eq Ordering -- Defined in ‘GHC.Classes’ instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Maybe’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus 24 others + ...plus six instances involving out-of-scope types (use -fprint-potential-instances to see them all) (The choice depends on the instantiation of ‘a’ To pick the first instance above, use IncoherentInstances diff --git a/testsuite/tests/typecheck/should_fail/T5858.stderr b/testsuite/tests/typecheck/should_fail/T5858.stderr index d5474da8a4..5679c6a995 100644 --- a/testsuite/tests/typecheck/should_fail/T5858.stderr +++ b/testsuite/tests/typecheck/should_fail/T5858.stderr @@ -5,7 +5,7 @@ T5858.hs:11:7: error: ([a0], [a1]))’ from being solved. Probable fix: use a type annotation to specify what ‘a0’, ‘a1’ should be. - This potential instance exists: + Potentially matching instance: 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 2596efb51f..44bdc1a7da 100644 --- a/testsuite/tests/typecheck/should_fail/T7857.stderr +++ b/testsuite/tests/typecheck/should_fail/T7857.stderr @@ -5,13 +5,13 @@ 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 ‘a0’ is ambiguous - These potential instances exist: + Potentially matching instances: instance [safe] (a ~ ()) => PrintfType (IO a) -- Defined in ‘Text.Printf’ instance [safe] (PrintfArg a, PrintfType r) => PrintfType (a -> r) -- Defined in ‘Text.Printf’ - instance [safe] IsChar c => PrintfType [c] - -- Defined in ‘Text.Printf’ + ...plus one other + (use -fprint-potential-instances to see them all) • In the second argument of ‘($)’, namely ‘printf "" i’ In the expression: f $ printf "" i In an equation for ‘g’: g i = f $ printf "" i diff --git a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr index e316f78fc6..f400dd63ae 100644 --- a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr +++ b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr @@ -20,12 +20,11 @@ TyAppPat_PatternBindingExistential.hs:13:3: error: • Ambiguous type variable ‘a0’ arising from a use of ‘print’ prevents the constraint ‘(Show a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: instance Show Ordering -- Defined in ‘GHC.Show’ instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’ - instance Show Integer -- Defined in ‘GHC.Show’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus 25 others + ...plus 12 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In a stmt of a 'do' block: print (x :: a) In the expression: do print (x :: a) diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index 4dba37c780..bba77ee675 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -624,4 +624,5 @@ test('T20122', normal, compile_fail, ['']) test('T20241b', normal, compile_fail, ['']) test('T20260', normal, compile_fail, ['']) test('OrdErr', normal, compile_fail, ['']) +test('T20542', normal, compile_fail, ['']) test('T20588', [extra_files(['T20588.hs', 'T20588.hs-boot', 'T20588_aux.hs'])], multimod_compile_fail, ['T20588_aux.hs', '-v0']) diff --git a/testsuite/tests/typecheck/should_fail/tcfail008.stderr b/testsuite/tests/typecheck/should_fail/tcfail008.stderr index 974eccb485..ba3afc1b67 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail008.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail008.stderr @@ -4,11 +4,10 @@ tcfail008.hs:3:5: error: prevents the constraint ‘(Num a0)’ from being solved. Relevant bindings include o :: [a0] (bound at tcfail008.hs:3:1) Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: instance Num Integer -- Defined in ‘GHC.Num’ instance Num Double -- Defined in ‘GHC.Float’ - instance Num Float -- Defined in ‘GHC.Float’ - ...plus N others + ...plus three others ...plus one instance involving out-of-scope types (use -fprint-potential-instances to see them all) • In the first argument of ‘(:)’, namely ‘1’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail040.stderr b/testsuite/tests/typecheck/should_fail/tcfail040.stderr index 46e0b86577..b920c9dc96 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail040.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail040.stderr @@ -3,7 +3,7 @@ tcfail040.hs:19:5: error: • 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. - This potential instance exists: + Potentially matching instance: 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 03aef3db67..e30b7c6aaa 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail043.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail043.stderr @@ -7,7 +7,7 @@ tcfail043.hs:38:17: error: a :: a0 (bound at tcfail043.hs:38:6) search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1) Probable fix: use a type annotation to specify what ‘a0’ should be. - This potential instance exists: + Potentially matching instance: instance Ord_ Int -- Defined at tcfail043.hs:34:10 • In the expression: gt (hd bs) a In the expression: @@ -30,7 +30,7 @@ tcfail043.hs:40:25: error: a :: a0 (bound at tcfail043.hs:38:6) search :: a0 -> [a0] -> Bool (bound at tcfail043.hs:37:1) Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: 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 c916c92df1..3c544083e8 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail072.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail072.stderr @@ -6,12 +6,11 @@ tcfail072.hs:23:13: error: g :: forall p q. (Ord p, Ord q) => AB p q -> Bool at tcfail072.hs:22:1-38 The type variable ‘p0’ is ambiguous - These potential instances exist: + Potentially matching instances: instance Ord Ordering -- Defined in ‘GHC.Classes’ instance Ord Integer -- Defined in ‘GHC.Num.Integer’ - instance Ord () -- Defined in ‘GHC.Classes’ - ...plus N others - ...plus N instances involving out-of-scope types + ...plus 23 others + ...plus two instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: g A In an equation for ‘g’: g (B _ _) = g A diff --git a/testsuite/tests/typecheck/should_fail/tcfail121.stderr b/testsuite/tests/typecheck/should_fail/tcfail121.stderr index dc0679edca..179729586f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail121.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail121.stderr @@ -1,12 +1,13 @@ -tcfail121.hs:13:9: - Overlapping instances for Foo [a] arising from a use of ‘op’ - Matching instances: - instance [overlappable] Foo a => Foo [a] - -- Defined at tcfail121.hs:9:31 - instance [overlapping] Foo [Int] -- Defined at tcfail121.hs:10:30 - (The choice depends on the instantiation of ‘a’ - To pick the first instance above, use IncoherentInstances - when compiling the other instance declarations) - In the expression: op x - In an equation for ‘foo’: foo x = op x +tcfail121.hs:13:9: error: + • Overlapping instances for Foo [a] arising from a use of ‘op’ + Matching instance: + instance [overlappable] Foo a => Foo [a] + -- Defined at tcfail121.hs:9:31 + Potentially matching instance: + instance [overlapping] Foo [Int] -- Defined at tcfail121.hs:10:30 + (The choice depends on the instantiation of ‘a’ + To pick the first instance above, use IncoherentInstances + when compiling the other instance declarations) + • In the expression: op x + In an equation for ‘foo’: foo x = op x diff --git a/testsuite/tests/typecheck/should_fail/tcfail128.stderr b/testsuite/tests/typecheck/should_fail/tcfail128.stderr index a63f290418..42bd22b6c9 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail128.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail128.stderr @@ -4,9 +4,8 @@ tcfail128.hs:18:16: error: 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. - This potential instance exists: - one instance involving out-of-scope types - (use -fprint-potential-instances to see them all) + one instance involving out-of-scope types + (use -fprint-potential-instances to see them all) • In a stmt of a 'do' block: v <- thaw tmp In the expression: do let sL = ... diff --git a/testsuite/tests/typecheck/should_fail/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr index 004c06a288..d88b8db0ec 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr @@ -6,13 +6,12 @@ tcfail133.hs:68:7: error: • Ambiguous type variable ‘a0’ arising from a use of ‘show’ prevents the constraint ‘(Show a0)’ from being solved. Probable fix: use a type annotation to specify what ‘a0’ should be. - These potential instances exist: + Potentially matching instances: instance Show Ordering -- Defined in ‘GHC.Show’ instance (Number a, Digit b, Show a, Show b) => Show (a :@ b) -- Defined at tcfail133.hs:11:54 - instance Show One -- Defined at tcfail133.hs:9:28 - ...plus N others - ...plus N instances involving out-of-scope types + ...plus 28 others + ...plus 12 instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In the first argument of ‘($)’, namely ‘show’ In the expression: show $ add (One :@ Zero) (One :@ One) diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr index f878123949..887c65f574 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr @@ -6,11 +6,10 @@ tcfail181.hs:17:9: error: wog :: Monad m => p -> Something (m Bool) e at tcfail181.hs:17:1-30 The type variable ‘m0’ is ambiguous - These potential instances exist: + Potentially matching instances: instance Monad IO -- Defined in ‘GHC.Base’ instance Monad Maybe -- Defined in ‘GHC.Base’ - instance Monad ((->) r) -- Defined in ‘GHC.Base’ - ...plus N others + ...plus six others ...plus one instance involving out-of-scope types (use -fprint-potential-instances to see them all) • In the expression: foo diff --git a/testsuite/tests/typecheck/should_fail/tcfail218.stderr b/testsuite/tests/typecheck/should_fail/tcfail218.stderr index f591b09b2a..2435fe3070 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail218.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail218.stderr @@ -1,8 +1,9 @@ tcfail218.hs:16:5: error: • Overlapping instances for C [a] Bool arising from a use of ‘foo’ - Matching instances: + Matching instance: instance C [a] b -- Defined at tcfail218.hs:8:29 + Potentially matching instance: instance C [Int] Bool -- Defined at tcfail218.hs:7:29 (The choice depends on the instantiation of ‘a’ To pick the first instance above, use IncoherentInstances |