summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser
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 /testsuite/tests/parser
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
Diffstat (limited to 'testsuite/tests/parser')
-rw-r--r--testsuite/tests/parser/should_fail/RecordDotSyntaxFail11.stderr15
-rw-r--r--testsuite/tests/parser/should_fail/RecordDotSyntaxFail8.stderr15
2 files changed, 16 insertions, 14 deletions
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 = ...