Commit ecc0ddf6 authored by Simon Peyton Jones's avatar Simon Peyton Jones

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.
parent a08b285f
......@@ -212,7 +212,12 @@ report_unsolved mb_binds_var type_errors expr_holes
, cec_expr_holes = expr_holes
, cec_type_holes = type_holes
, cec_out_of_scope_holes = out_of_scope_holes
, cec_suppress = False -- See Note [Suppressing error messages]
, cec_suppress = insolubleWC wanted
-- See Note [Suppressing error messages]
-- Suppress low-priority errors if there
-- are insolule errors anywhere;
-- See Trac #15539 and c.f. setting ic_status
-- in TcSimplify.setImplicationStatus
, cec_warn_redundant = warn_redundant
, cec_binds = mb_binds_var }
......
......@@ -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
......
{-# 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
T15539.hs:6:13: error:
• Variable not in scope: baz
• Perhaps you meant one of these: ‘bar’ (line 15), ‘bam’ (line 17)
......@@ -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, [''])
......@@ -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
......
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment