diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-08-20 15:54:14 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-08-20 15:54:14 +0100 |
commit | ecc0ddf65b1e2700f83f643fffdd41e966013332 (patch) | |
tree | fba58889e4f8d908858e8ac2cbc0c82fd870cad9 /testsuite | |
parent | a08b285f74cd49196feb0f819d70ad0508689da3 (diff) | |
download | haskell-ecc0ddf65b1e2700f83f643fffdd41e966013332.tar.gz |
Initialise cec_suppress properly
In TcErrors, cec_suppress is used to suppress low-priority
errors in favour of truly insoluble ones.
But I was failing to initialise it correcly at top level, which
resulted in Trac #15539. Easy to fix.
A few regression tests have fewer errors reported, but that seems to
be an improvement.
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/ghci/scripts/Defer02.stderr | 31 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T15539.hs | 17 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/T15539.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/rename/should_fail/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr | 30 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_fail/tcfail078.stderr | 13 |
6 files changed, 22 insertions, 74 deletions
diff --git a/testsuite/tests/ghci/scripts/Defer02.stderr b/testsuite/tests/ghci/scripts/Defer02.stderr index e76727efa5..63dbc9b042 100644 --- a/testsuite/tests/ghci/scripts/Defer02.stderr +++ b/testsuite/tests/ghci/scripts/Defer02.stderr @@ -12,11 +12,6 @@ Defer01.hs:14:5: warning: [-Wdeferred-type-errors (in -Wdefault)] • In the expression: 'p' In an equation for ‘a’: a = 'p' -Defer01.hs:18:7: warning: [-Wdeferred-type-errors (in -Wdefault)] - • No instance for (Eq B) arising from a use of ‘==’ - • In the expression: x == x - In an equation for ‘b’: b x = x == x - Defer01.hs:25:1: warning: [-Woverlapping-patterns (in -Wdefault)] Pattern match has inaccessible right hand side In an equation for ‘c’: c (C2 x) = ... @@ -29,12 +24,6 @@ Defer01.hs:25:4: warning: [-Winaccessible-code (in -Wdefault)] • In the pattern: C2 x In an equation for ‘c’: c (C2 x) = True -Defer01.hs:28:5: warning: [-Wdeferred-type-errors (in -Wdefault)] - • No instance for (Num (a -> a)) arising from the literal ‘1’ - (maybe you haven't applied a function to enough arguments?) - • In the expression: 1 - In an equation for ‘d’: d = 1 - Defer01.hs:31:5: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type ‘Char -> t’ with actual type ‘Char’ • The function ‘e’ is applied to one argument, @@ -65,26 +54,6 @@ Defer01.hs:39:17: warning: [-Wdeferred-type-errors (in -Wdefault)] a :: a (bound at Defer01.hs:39:3) i :: a -> () (bound at Defer01.hs:39:1) -Defer01.hs:43:5: warning: [-Wdeferred-type-errors (in -Wdefault)] - • No instance for (MyClass a1) arising from a use of ‘myOp’ - • In the expression: myOp 23 - In an equation for ‘j’: j = myOp 23 - -Defer01.hs:43:10: warning: [-Wdeferred-type-errors (in -Wdefault)] - • Ambiguous type variable ‘a1’ arising from the literal ‘23’ - prevents the constraint ‘(Num a1)’ from being solved. - Probable fix: use a type annotation to specify what ‘a1’ 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’ - ...plus two others - ...plus one instance involving out-of-scope types - (use -fprint-potential-instances to see them all) - • In the first argument of ‘myOp’, namely ‘23’ - In the expression: myOp 23 - In an equation for ‘j’: j = myOp 23 - Defer01.hs:47:7: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match expected type ‘Bool’ with actual type ‘Int’ • In the expression: x diff --git a/testsuite/tests/rename/should_fail/T15539.hs b/testsuite/tests/rename/should_fail/T15539.hs new file mode 100644 index 0000000000..d1b5a37e7b --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15539.hs @@ -0,0 +1,17 @@ +{-# LANGUAGE RankNTypes #-} +module T15539 where + +foo :: String +foo = show a + where a = baz + +-- We get top level constraints +-- Show a +-- forall . <not in scope baz> +-- We want the insoluble non-in-scope error to suppress +-- the Show a, just as it does if the whole things is nested + +bar :: Int +bar = 1 + +bam = putStrLn foo diff --git a/testsuite/tests/rename/should_fail/T15539.stderr b/testsuite/tests/rename/should_fail/T15539.stderr new file mode 100644 index 0000000000..c3de7780d4 --- /dev/null +++ b/testsuite/tests/rename/should_fail/T15539.stderr @@ -0,0 +1,4 @@ + +T15539.hs:6:13: error: + • Variable not in scope: baz + • Perhaps you meant one of these: ‘bar’ (line 15), ‘bam’ (line 17) diff --git a/testsuite/tests/rename/should_fail/all.T b/testsuite/tests/rename/should_fail/all.T index f2bf30ea3f..2eef29f1cc 100644 --- a/testsuite/tests/rename/should_fail/all.T +++ b/testsuite/tests/rename/should_fail/all.T @@ -132,3 +132,4 @@ test('T13847', normal, multimod_compile_fail, ['T13847','-v0']) test('T14307', normal, compile_fail, ['']) test('T14591', normal, compile_fail, ['']) test('T15214', normal, compile_fail, ['']) +test('T15539', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr index 6dde6ea5cf..93de053f54 100644 --- a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr @@ -88,21 +88,6 @@ valid_hole_fits.hs:27:5: warning: [-Wtyped-holes (in -Wdefault)] (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 (and originally defined in ‘GHC.Base’)) -valid_hole_fits.hs:30:5: warning: [-Wdeferred-type-errors (in -Wdefault)] - • Ambiguous type variable ‘a1’ arising from a use of ‘show’ - prevents the constraint ‘(Show a1)’ from being solved. - Probable fix: use a type annotation to specify what ‘a1’ should be. - These potential instances exist: - instance (Show a, Show b) => Show (Either a b) - -- Defined in ‘Data.Either’ - instance Show Ordering -- Defined in ‘GHC.Show’ - instance Show Integer -- Defined in ‘GHC.Show’ - ...plus 23 others - ...plus 70 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 _ - valid_hole_fits.hs:30:10: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: a1 Where: ‘a1’ is an ambiguous type variable @@ -138,21 +123,6 @@ valid_hole_fits.hs:30:10: warning: [-Wtyped-holes (in -Wdefault)] (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 (and originally defined in ‘GHC.Float’)) -valid_hole_fits.hs:34:5: warning: [-Wdeferred-type-errors (in -Wdefault)] - • 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: - instance (Show a, Show b) => Show (Either a b) - -- Defined in ‘Data.Either’ - instance Show Ordering -- Defined in ‘GHC.Show’ - instance Show Integer -- Defined in ‘GHC.Show’ - ...plus 23 others - ...plus 70 instances involving out-of-scope types - (use -fprint-potential-instances to see them all) - • In the expression: show (_ (_ :: Bool)) - In an equation for ‘h’: h = show (_ (_ :: Bool)) - valid_hole_fits.hs:34:11: warning: [-Wtyped-holes (in -Wdefault)] • Found hole: _ :: Bool -> a0 Where: ‘a0’ is an ambiguous type variable diff --git a/testsuite/tests/typecheck/should_fail/tcfail078.stderr b/testsuite/tests/typecheck/should_fail/tcfail078.stderr index a0816a746c..014d589bf6 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail078.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail078.stderr @@ -2,16 +2,3 @@ tcfail078.hs:5:6: error: • Expected kind ‘* -> Constraint’, but ‘Integer’ has kind ‘*’ • In the type signature: f :: Integer i => i - -tcfail078.hs:6:19: error: - • Could not deduce (Num i) arising from the literal ‘0’ - from the context: Integer i - bound by the type signature for: - f :: forall i. Integer i => i - at tcfail078.hs:5:1-19 - Possible fix: - add (Num i) to the context of - the type signature for: - f :: forall i. Integer i => i - • In the expression: 0 - In an equation for ‘f’: f = 0 |