summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsheaf <sam.derbyshire@gmail.com>2021-10-05 18:16:27 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-10-06 10:58:03 -0400
commita466b02492f73a43c6cb9ce69491fc85234b9559 (patch)
tree6d4f7c1d0ad4609fa1878d44f0e1e20b8c4501ef
parent9af29e7fa81a8696a2d829a0ecbebcbc8be5badd (diff)
downloadhaskell-a466b02492f73a43c6cb9ce69491fc85234b9559.tar.gz
Improve overlap error for polykinded constraints
There were two problems around `mkDictErr`: 1. An outdated call to `flattenTys` meant that we missed out on some instances. As we no longer flatten type-family applications, the logic is obsolete and can be removed. 2. We reported "out of scope" errors in a poly-kinded situation because `BoxedRep` and `Lifted` were considered out of scope. We fix this by using `pretendNameIsInScope`. fixes #20465
-rw-r--r--compiler/GHC/Builtin/Names.hs36
-rw-r--r--compiler/GHC/Runtime/Eval.hs4
-rw-r--r--compiler/GHC/Tc/Errors.hs25
-rw-r--r--testsuite/driver/testlib.py4
-rw-r--r--testsuite/tests/ado/T13242a.stderr4
-rw-r--r--testsuite/tests/annotations/should_fail/annfail10.stderr8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/break006.stderr8
-rw-r--r--testsuite/tests/ghci.debugger/scripts/print019.stderr4
-rw-r--r--testsuite/tests/ghci/scripts/T10963.stderr4
-rw-r--r--testsuite/tests/ghci/scripts/T15325.stderr2
-rw-r--r--testsuite/tests/indexed-types/should_fail/T12522a.stderr4
-rw-r--r--testsuite/tests/indexed-types/should_fail/T20465.hs17
-rw-r--r--testsuite/tests/indexed-types/should_fail/T20465.stderr8
-rw-r--r--testsuite/tests/indexed-types/should_fail/all.T1
-rw-r--r--testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr8
-rw-r--r--testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr15
-rw-r--r--testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr15
-rw-r--r--testsuite/tests/partial-sigs/should_fail/T10999.stderr4
-rw-r--r--testsuite/tests/polykinds/T13393.stderr4
-rw-r--r--testsuite/tests/typecheck/should_compile/T14273.stderr8
-rw-r--r--testsuite/tests/typecheck/should_compile/holes2.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/T10971b.stderr16
-rw-r--r--testsuite/tests/typecheck/should_fail/T12921.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/T13292.stderr6
-rw-r--r--testsuite/tests/typecheck/should_fail/T14884.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/T5095.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail008.stderr2
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail072.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail133.stderr4
-rw-r--r--testsuite/tests/typecheck/should_fail/tcfail181.stderr6
31 files changed, 141 insertions, 102 deletions
diff --git a/compiler/GHC/Builtin/Names.hs b/compiler/GHC/Builtin/Names.hs
index b7f54060b9..364d7a913d 100644
--- a/compiler/GHC/Builtin/Names.hs
+++ b/compiler/GHC/Builtin/Names.hs
@@ -2794,17 +2794,41 @@ interactiveClassKeys = map getUnique interactiveClassNames
* *
************************************************************************
-GHCi's :info command will usually filter out instances mentioning types whose
-names are not in scope. GHCi makes an exception for some commonly used names,
-such as Data.Kind.Type, which may not actually be in scope but should be
-treated as though they were in scope. The list in the definition of
-pretendNameIsInScope below contains these commonly used names.
+Note [pretendNameIsInScope]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+In general, we filter out instances that mention types whose names are
+not in scope. However, in the situations listed below, we make an exception
+for some commonly used names, such as Data.Kind.Type, which may not actually
+be in scope but should be treated as though they were in scope.
+This includes built-in names, as well as a few extra names such as
+'Type', 'TYPE', 'BoxedRep', etc.
+Situations in which we apply this special logic:
+
+ - GHCi's :info command, see GHC.Runtime.Eval.getInfo.
+ This fixes #1581.
+
+ - When reporting instance overlap errors. Not doing so could mean
+ that we would omit instances for typeclasses like
+
+ type Cls :: k -> Constraint
+ class Cls a
+
+ because BoxedRep/Lifted were not in scope.
+ See GHC.Tc.Errors.pprPotentials.
+ This fixes one of the issues reported in #20465.
-}
+-- | Should this name be considered in-scope, even though it technically isn't?
+--
+-- This ensures that we don't filter out information because, e.g.,
+-- Data.Kind.Type isn't imported.
+--
+-- See Note [pretendNameIsInScope].
pretendNameIsInScope :: Name -> Bool
pretendNameIsInScope n
- = any (n `hasKey`)
+ = isBuiltInSyntax n
+ || any (n `hasKey`)
[ liftedTypeKindTyConKey, unliftedTypeKindTyConKey
, liftedDataConKey, unliftedDataConKey
, tYPETyConKey
diff --git a/compiler/GHC/Runtime/Eval.hs b/compiler/GHC/Runtime/Eval.hs
index e28b2daeba..bceb9a4159 100644
--- a/compiler/GHC/Runtime/Eval.hs
+++ b/compiler/GHC/Runtime/Eval.hs
@@ -81,7 +81,6 @@ import GHC.Tc.Types.Constraint
import GHC.Tc.Types.Origin
import GHC.Builtin.Names ( toDynName, pretendNameIsInScope )
-import GHC.Builtin.Types ( isCTupleTyConName )
import GHC.Data.Maybe
import GHC.Data.FastString
@@ -873,8 +872,7 @@ getInfo allInfo name
ok n | n == name = True
-- The one we looked for in the first place!
| pretendNameIsInScope n = True
- | isBuiltInSyntax n = True
- | isCTupleTyConName n = True
+ -- See Note [pretendNameIsInScope] in GHC.Builtin.Names
| isExternalName n = isJust (lookupGRE_Name rdr_env n)
| otherwise = True
diff --git a/compiler/GHC/Tc/Errors.hs b/compiler/GHC/Tc/Errors.hs
index 51ab0fca2a..e420bd1c23 100644
--- a/compiler/GHC/Tc/Errors.hs
+++ b/compiler/GHC/Tc/Errors.hs
@@ -50,7 +50,7 @@ import GHC.Types.Error
import GHC.Rename.Unbound ( unknownNameSuggestions, WhatLooking(..) )
import GHC.Unit.Module
import GHC.Hs.Binds ( PatSynBind(..) )
-import GHC.Builtin.Names ( typeableClassName )
+import GHC.Builtin.Names ( typeableClassName, pretendNameIsInScope )
import qualified GHC.LanguageExtensions as LangExt
import GHC.Core.Predicate
@@ -58,7 +58,7 @@ import GHC.Core.Type
import GHC.Core.Coercion
import GHC.Core.TyCo.Rep
import GHC.Core.TyCo.Ppr ( pprTyVars, pprWithExplicitKindsWhen, pprSourceTyCon, pprWithTYPE )
-import GHC.Core.Unify ( tcMatchTys, flattenTys )
+import GHC.Core.Unify ( tcMatchTys )
import GHC.Core.InstEnv
import GHC.Core.TyCon
import GHC.Core.Class
@@ -2420,8 +2420,7 @@ mkDictErr ctxt cts
&& (null unifiers || all (not . isAmbiguousTyVar) (tyCoVarsOfCtList ct))
lookup_cls_inst inst_envs ct
- -- Note [Flattening in error message generation]
- = (ct, lookupInstEnv True inst_envs clas (flattenTys emptyInScopeSet tys))
+ = (ct, lookupInstEnv True inst_envs clas tys)
where
(clas, tys) = getClassPredTys (ctPred ct)
@@ -2862,8 +2861,8 @@ pprPotentials (PrintPotentialInstances show_potentials) sty herald insts
orphNamesOfTypes (is_tys cls_inst)
name_in_scope name
- | isBuiltInSyntax name
- = True -- E.g. (->)
+ | pretendNameIsInScope name
+ = True -- E.g. (->); see Note [pretendNameIsInScope] in GHC.Builtin.Names
| Just mod <- nameModule_maybe name
= qual_in_scope (qualName sty mod (nameOccName name))
| otherwise
@@ -2897,7 +2896,7 @@ we want to give it a bit of structure. Here's the plan
These are the ones most likely to be useful to the programmer.
* Show at most n_show in-scope instances,
- and summarise the rest ("plus 3 others")
+ and summarise the rest ("plus N others")
* Summarise the not-in-scope instances ("plus 4 not in scope")
@@ -2906,18 +2905,6 @@ we want to give it a bit of structure. Here's the plan
-}
{-
-Note [Flattening in error message generation]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Consider (C (Maybe (F x))), where F is a type function, and we have
-instances
- C (Maybe Int) and C (Maybe a)
-Since (F x) might turn into Int, this is an overlap situation, and
-indeed the main solver will have refrained
-from solving. But by the time we get to error message generation, we've
-un-flattened the constraint. So we must *re*-flatten it before looking
-up in the instance environment, lest we only report one matching
-instance when in fact there are two.
-
Note [Kind arguments in error messages]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It can be terribly confusing to get an error message like (#9171)
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index fba69533e0..7a1fafbbd7 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -2232,9 +2232,11 @@ def normalise_errmsg(s: str) -> str:
# Error messages sometimes contain ghc-bignum implementation package
s = re.sub('ghc-bignum-[0-9.]+', 'ghc-bignum-<VERSION>', s)
- # Error messages sometimes contain this blurb which can vary
+ # Error messages sometimes contain these blurbs which can vary
# spuriously depending upon build configuration (e.g. based on bignum
# backend)
+ s = re.sub('...plus ([a-z]+|[0-9]+) others',
+ '...plus N others', s)
s = re.sub('...plus ([a-z]+|[0-9]+) instances involving out-of-scope types',
'...plus N instances involving out-of-scope types', s)
diff --git a/testsuite/tests/ado/T13242a.stderr b/testsuite/tests/ado/T13242a.stderr
index f5dce341ac..4ada4ecaed 100644
--- a/testsuite/tests/ado/T13242a.stderr
+++ b/testsuite/tests/ado/T13242a.stderr
@@ -29,8 +29,8 @@ T13242a.hs:13:13: error:
instance Eq Ordering -- Defined in ‘GHC.Classes’
instance Eq Integer -- Defined in ‘GHC.Num.Integer’
instance Eq () -- Defined in ‘GHC.Classes’
- ...plus 22 others
- ...plus five instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of a 'do' block: return (x == x)
In the expression:
diff --git a/testsuite/tests/annotations/should_fail/annfail10.stderr b/testsuite/tests/annotations/should_fail/annfail10.stderr
index a6e767f9e5..bd28fb4b17 100644
--- a/testsuite/tests/annotations/should_fail/annfail10.stderr
+++ b/testsuite/tests/annotations/should_fail/annfail10.stderr
@@ -10,8 +10,8 @@ annfail10.hs:9:1: error:
instance Data.Data.Data Ordering -- Defined in ‘Data.Data’
instance Data.Data.Data a => Data.Data.Data (Maybe a)
-- Defined in ‘Data.Data’
- ...plus 16 others
- ...plus 50 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation: {-# ANN f 1 #-}
@@ -23,7 +23,7 @@ annfail10.hs:9:11: error:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
- ...plus two others
- ...plus 19 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation: {-# ANN f 1 #-}
diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr
index 1b97299d92..198bc0df49 100644
--- a/testsuite/tests/ghci.debugger/scripts/break006.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr
@@ -8,8 +8,8 @@
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 23 others
- ...plus 12 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
@@ -22,7 +22,7 @@
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 23 others
- ...plus 12 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci.debugger/scripts/print019.stderr b/testsuite/tests/ghci.debugger/scripts/print019.stderr
index bac95541f4..09b1bfbd8c 100644
--- a/testsuite/tests/ghci.debugger/scripts/print019.stderr
+++ b/testsuite/tests/ghci.debugger/scripts/print019.stderr
@@ -8,7 +8,7 @@
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show TyCon -- Defined in ‘GHC.Show’
instance Show a => Show (List1 a) -- Defined at Test.hs:11:12
- ...plus 30 others
- ...plus 13 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of an interactive GHCi command: print it
diff --git a/testsuite/tests/ghci/scripts/T10963.stderr b/testsuite/tests/ghci/scripts/T10963.stderr
index aa081391c4..7082d6e6cf 100644
--- a/testsuite/tests/ghci/scripts/T10963.stderr
+++ b/testsuite/tests/ghci/scripts/T10963.stderr
@@ -7,7 +7,7 @@
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
- ...plus two others
- ...plus 8 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: foo
diff --git a/testsuite/tests/ghci/scripts/T15325.stderr b/testsuite/tests/ghci/scripts/T15325.stderr
index c767528e2c..99efb5585e 100644
--- a/testsuite/tests/ghci/scripts/T15325.stderr
+++ b/testsuite/tests/ghci/scripts/T15325.stderr
@@ -12,7 +12,7 @@ T15325.hs:11:9: warning: [-Wdeferred-type-errors (in -Wdefault)]
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
- ...plus two others
+ ...plus N others
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘f’, namely ‘0’
diff --git a/testsuite/tests/indexed-types/should_fail/T12522a.stderr b/testsuite/tests/indexed-types/should_fail/T12522a.stderr
index a91c31c764..7fc4787a5c 100644
--- a/testsuite/tests/indexed-types/should_fail/T12522a.stderr
+++ b/testsuite/tests/indexed-types/should_fail/T12522a.stderr
@@ -10,8 +10,8 @@ T12522a.hs:23:26: error:
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 23 others
- ...plus 12 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘(++)’, namely ‘show n’
In the second argument of ‘($)’, namely ‘show n ++ s’
diff --git a/testsuite/tests/indexed-types/should_fail/T20465.hs b/testsuite/tests/indexed-types/should_fail/T20465.hs
new file mode 100644
index 0000000000..8ec790b619
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T20465.hs
@@ -0,0 +1,17 @@
+{-# LANGUAGE FlexibleContexts #-}
+{-# LANGUAGE FlexibleInstances #-}
+{-# LANGUAGE PolyKinds #-}
+{-# LANGUAGE TypeFamilies #-}
+
+module T20465 where
+
+import Data.Kind
+import Data.Proxy
+
+class Cls (a :: (Type -> Constraint) -> Type)
+instance Cls a
+instance Cls Proxy
+foo :: Cls Proxy => Int
+foo = 42
+bar :: Int
+bar = foo
diff --git a/testsuite/tests/indexed-types/should_fail/T20465.stderr b/testsuite/tests/indexed-types/should_fail/T20465.stderr
new file mode 100644
index 0000000000..90e90c9f57
--- /dev/null
+++ b/testsuite/tests/indexed-types/should_fail/T20465.stderr
@@ -0,0 +1,8 @@
+
+T20465.hs:17:7: error:
+ • Overlapping instances for Cls Proxy arising from a use of ‘foo’
+ Matching instances:
+ instance Cls a -- Defined at T20465.hs:12:10
+ instance Cls Proxy -- Defined at T20465.hs:13:10
+ • In the expression: foo
+ In an equation for ‘bar’: bar = foo
diff --git a/testsuite/tests/indexed-types/should_fail/all.T b/testsuite/tests/indexed-types/should_fail/all.T
index 9d2c68f095..c97c8c56e4 100644
--- a/testsuite/tests/indexed-types/should_fail/all.T
+++ b/testsuite/tests/indexed-types/should_fail/all.T
@@ -164,3 +164,4 @@ test('T13571', normal, compile_fail, [''])
test('T13571a', normal, compile_fail, [''])
test('T18648', normal, compile_fail, [''])
test('ExpandTFs', normal, compile_fail, [''])
+test('T20465', normal, compile_fail, [''])
diff --git a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr
index 6e759d7f2a..5d391c4d9e 100644
--- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr
+++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail01.stderr
@@ -7,8 +7,8 @@ overloadedlistsfail01.hs:5:8: error:
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 23 others
- ...plus 14 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: print [1]
In an equation for ‘main’: main = print [1]
@@ -19,7 +19,7 @@ overloadedlistsfail01.hs:5:14: error:
Probable fix: use a type annotation to specify what ‘a0’ should be.
These potential instances exist:
instance GHC.Exts.IsList [a] -- Defined in ‘GHC.Exts’
- ...plus four instances involving out-of-scope types
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘print’, namely ‘[1]’
In the expression: print [1]
@@ -34,7 +34,7 @@ overloadedlistsfail01.hs:5:15: error:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
- ...plus two others
+ ...plus N others
...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: 1
diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr
index 2378585a6a..4c26d77b10 100644
--- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr
+++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr
@@ -1,24 +1,25 @@
-RecordDotSyntaxFail11.hs:8:3:
- Ambiguous type variable ‘a0’ arising from a use of ‘print’
+
+RecordDotSyntaxFail11.hs:8: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:
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 23 others
+ ...plus N others
...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
- In the first argument of ‘($)’, namely ‘print’
+ • In the first argument of ‘($)’, namely ‘print’
In a stmt of a 'do' block: print $ (.foo.bar.baz) a
In the expression:
do let a = ...
print $ (.foo.bar.baz) a
-RecordDotSyntaxFail11.hs:8:11:
- No instance for (GHC.Records.HasField "baz" Int a0)
+RecordDotSyntaxFail11.hs:8:11: error:
+ • No instance for (GHC.Records.HasField "baz" Int a0)
arising from a use of ‘GHC.Records.getField’
- In the second argument of ‘($)’, namely ‘(.foo.bar.baz) a’
+ • In the second argument of ‘($)’, namely ‘(.foo.bar.baz) a’
In a stmt of a 'do' block: print $ (.foo.bar.baz) a
In the expression:
do let a = ...
diff --git a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
index 8bf921b79f..e66a9dfb28 100644
--- a/testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
+++ b/testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr
@@ -1,24 +1,25 @@
-RecordDotSyntaxFail8.hs:37:3:
- Ambiguous type variable ‘a0’ arising from a use of ‘print’
+
+RecordDotSyntaxFail8.hs:37: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:
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show Bar -- Defined at RecordDotSyntaxFail8.hs:22:41
instance Show Baz -- Defined at RecordDotSyntaxFail8.hs:27:42
- ...plus 27 others
+ ...plus N others
...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
- In the first argument of ‘($)’, namely ‘print’
+ • In the first argument of ‘($)’, namely ‘print’
In a stmt of a 'do' block: print $ ....baz.quux
In the expression:
do let a = ...
print $ ....quux
-RecordDotSyntaxFail8.hs:37:11:
- No instance for (HasField "quux" Quux a0)
+RecordDotSyntaxFail8.hs:37:11: error:
+ • No instance for (HasField "quux" Quux a0)
arising from selecting the field ‘quux’
- In the second argument of ‘($)’, namely ‘....baz.quux’
+ • In the second argument of ‘($)’, namely ‘....baz.quux’
In a stmt of a 'do' block: print $ ....baz.quux
In the expression:
do let a = ...
diff --git a/testsuite/tests/partial-sigs/should_fail/T10999.stderr b/testsuite/tests/partial-sigs/should_fail/T10999.stderr
index 71bab83508..22df588742 100644
--- a/testsuite/tests/partial-sigs/should_fail/T10999.stderr
+++ b/testsuite/tests/partial-sigs/should_fail/T10999.stderr
@@ -25,8 +25,8 @@ T10999.hs:8:28: error:
instance Ord a => Ord (Set.Set a) -- Defined in ‘Data.Set.Internal’
instance Ord Ordering -- Defined in ‘GHC.Classes’
instance Ord Integer -- Defined in ‘GHC.Num.Integer’
- ...plus 23 others
- ...plus two instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the second argument of ‘($)’, namely ‘f ()’
In the second argument of ‘($)’, namely ‘Set.toList $ f ()’
diff --git a/testsuite/tests/polykinds/T13393.stderr b/testsuite/tests/polykinds/T13393.stderr
index a06aecff70..759f3408b0 100644
--- a/testsuite/tests/polykinds/T13393.stderr
+++ b/testsuite/tests/polykinds/T13393.stderr
@@ -7,8 +7,8 @@ T13393.hs:61:3: error:
instance Traversable (Either a) -- Defined in ‘Data.Traversable’
instance Traversable Identity -- Defined in ‘Data.Traversable’
instance Traversable Maybe -- Defined in ‘Data.Traversable’
- ...plus three others
- ...plus 28 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In a stmt of a 'do' block:
mapM putBackLeftOverInputAndReturnOutput undefined
diff --git a/testsuite/tests/typecheck/should_compile/T14273.stderr b/testsuite/tests/typecheck/should_compile/T14273.stderr
index daff685704..7aa78d56a9 100644
--- a/testsuite/tests/typecheck/should_compile/T14273.stderr
+++ b/testsuite/tests/typecheck/should_compile/T14273.stderr
@@ -11,8 +11,8 @@ T14273.hs:7:27: warning: [-Wdeferred-type-errors (in -Wdefault)]
-- Defined in ‘Data.Either’
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus 24 others
- ...plus 70 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the first argument of ‘Just’, namely ‘(show _a)’
In the expression: Just (show _a)
@@ -65,8 +65,8 @@ T14273.hs:13:10: warning: [-Wdeferred-type-errors (in -Wdefault)]
-- Defined in ‘Data.Either’
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus 24 others
- ...plus 70 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: show (_h ++ [])
In an equation for ‘foo’: foo xs = show (_h ++ [])
diff --git a/testsuite/tests/typecheck/should_compile/holes2.stderr b/testsuite/tests/typecheck/should_compile/holes2.stderr
index 1e30e87882..a88ea524e0 100644
--- a/testsuite/tests/typecheck/should_compile/holes2.stderr
+++ b/testsuite/tests/typecheck/should_compile/holes2.stderr
@@ -8,8 +8,8 @@ holes2.hs:3:5: warning: [-Wdeferred-type-errors (in -Wdefault)]
-- Defined in ‘Data.Either’
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus 24 others
- ...plus 70 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: show _
In an equation for ‘f’: f = show _
diff --git a/testsuite/tests/typecheck/should_fail/T10971b.stderr b/testsuite/tests/typecheck/should_fail/T10971b.stderr
index 0947ab1b6f..1a6104d501 100644
--- a/testsuite/tests/typecheck/should_fail/T10971b.stderr
+++ b/testsuite/tests/typecheck/should_fail/T10971b.stderr
@@ -10,8 +10,8 @@ T10971b.hs:4:11: error:
instance Foldable (Either a) -- Defined in ‘Data.Foldable’
instance Foldable Maybe -- Defined in ‘Data.Foldable’
instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
- ...plus two others
- ...plus 29 instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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
@@ -28,8 +28,8 @@ T10971b.hs:5:13: error:
instance Traversable (Either a) -- Defined in ‘Data.Traversable’
instance Traversable Maybe -- Defined in ‘Data.Traversable’
instance Traversable ((,) a) -- Defined in ‘Data.Traversable’
- ...plus two others
- ...plus 29 instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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
@@ -46,8 +46,8 @@ T10971b.hs:6:14: error:
instance Traversable (Either a) -- Defined in ‘Data.Traversable’
instance Traversable Maybe -- Defined in ‘Data.Traversable’
instance Traversable ((,) a) -- Defined in ‘Data.Traversable’
- ...plus two others
- ...plus 29 instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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)
@@ -64,8 +64,8 @@ T10971b.hs:6:31: error:
instance Foldable (Either a) -- Defined in ‘Data.Foldable’
instance Foldable Maybe -- Defined in ‘Data.Foldable’
instance Foldable ((,) a) -- Defined in ‘Data.Foldable’
- ...plus two others
- ...plus 29 instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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 478d2f03c8..b3de93e2f4 100644
--- a/testsuite/tests/typecheck/should_fail/T12921.stderr
+++ b/testsuite/tests/typecheck/should_fail/T12921.stderr
@@ -10,8 +10,8 @@ T12921.hs:4:1: error:
instance Data.Data.Data Ordering -- Defined in ‘Data.Data’
instance Data.Data.Data a => Data.Data.Data (Maybe a)
-- Defined in ‘Data.Data’
- ...plus 16 others
- ...plus 50 instances involving out-of-scope types
+ ...plus N others
+ ...plus N instances involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the annotation:
{-# ANN module "HLint: ignore Reduce duplication" #-}
@@ -24,7 +24,7 @@ T12921.hs:4:16: error:
These potential instances exist:
instance (a ~ Char) => Data.String.IsString [a]
-- Defined in ‘Data.String’
- ...plus two instances involving out-of-scope types
+ ...plus N 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 a3a7ba3bae..2cc7bb41c3 100644
--- a/testsuite/tests/typecheck/should_fail/T13292.stderr
+++ b/testsuite/tests/typecheck/should_fail/T13292.stderr
@@ -8,9 +8,9 @@ T13292a.hs:4:12: warning: [-Wdeferred-type-errors (in -Wdefault)]
These potential instances exist:
instance Monad IO -- Defined in ‘GHC.Base’
instance Monad Maybe -- Defined in ‘GHC.Base’
- instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’
- ...plus four others
- ...plus two instances involving out-of-scope types
+ instance Monad ((->) r) -- Defined in ‘GHC.Base’
+ ...plus N others
+ ...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: return ()
In an equation for ‘someFunc’: someFunc = return ()
diff --git a/testsuite/tests/typecheck/should_fail/T14884.stderr b/testsuite/tests/typecheck/should_fail/T14884.stderr
index 2c5abc33f0..e28ad780bf 100644
--- a/testsuite/tests/typecheck/should_fail/T14884.stderr
+++ b/testsuite/tests/typecheck/should_fail/T14884.stderr
@@ -40,8 +40,8 @@ T14884.hs:4:7: error:
-- Defined in ‘Data.Either’
instance Show Ordering -- Defined in ‘GHC.Show’
instance Show a => Show (Maybe a) -- Defined in ‘GHC.Show’
- ...plus 24 others
- ...plus 67 instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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/T5095.stderr b/testsuite/tests/typecheck/should_fail/T5095.stderr
index e30898f74f..3641d18f34 100644
--- a/testsuite/tests/typecheck/should_fail/T5095.stderr
+++ b/testsuite/tests/typecheck/should_fail/T5095.stderr
@@ -5,8 +5,8 @@ T5095.hs:9:11: error:
instance [overlappable] Show a => Eq a -- Defined at T5095.hs:5:31
instance Eq Ordering -- Defined in ‘GHC.Classes’
instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Maybe’
- ...plus 24 others
- ...plus six instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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/TyAppPat_PatternBindingExistential.stderr b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
index a05806e7be..e316f78fc6 100644
--- a/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
+++ b/testsuite/tests/typecheck/should_fail/TyAppPat_PatternBindingExistential.stderr
@@ -24,8 +24,8 @@ TyAppPat_PatternBindingExistential.hs:13:3: error:
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 23 others
- ...plus 12 instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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/tcfail008.stderr b/testsuite/tests/typecheck/should_fail/tcfail008.stderr
index 1e7bc19585..974eccb485 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail008.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail008.stderr
@@ -8,7 +8,7 @@ tcfail008.hs:3:5: error:
instance Num Integer -- Defined in ‘GHC.Num’
instance Num Double -- Defined in ‘GHC.Float’
instance Num Float -- Defined in ‘GHC.Float’
- ...plus two others
+ ...plus N 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/tcfail072.stderr b/testsuite/tests/typecheck/should_fail/tcfail072.stderr
index b91f96bf37..c916c92df1 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail072.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail072.stderr
@@ -10,8 +10,8 @@ tcfail072.hs:23:13: error:
instance Ord Ordering -- Defined in ‘GHC.Classes’
instance Ord Integer -- Defined in ‘GHC.Num.Integer’
instance Ord () -- Defined in ‘GHC.Classes’
- ...plus 22 others
- ...plus two instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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/tcfail133.stderr b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
index f5e2309a81..004c06a288 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail133.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail133.stderr
@@ -11,8 +11,8 @@ tcfail133.hs:68:7: error:
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 26 others
- ...plus 12 instances involving out-of-scope types
+ ...plus N others
+ ...plus N 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 c21214a689..f878123949 100644
--- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr
+++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr
@@ -9,9 +9,9 @@ tcfail181.hs:17:9: error:
These potential instances exist:
instance Monad IO -- Defined in ‘GHC.Base’
instance Monad Maybe -- Defined in ‘GHC.Base’
- instance Monoid a => Monad ((,) a) -- Defined in ‘GHC.Base’
- ...plus four others
- ...plus two instances involving out-of-scope types
+ instance Monad ((->) r) -- Defined in ‘GHC.Base’
+ ...plus N others
+ ...plus one instance involving out-of-scope types
(use -fprint-potential-instances to see them all)
• In the expression: foo
In the expression: foo {bar = return True}