diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-02-02 18:23:11 +0000 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2020-06-05 09:27:50 -0400 |
commit | 2b792facab46f7cdd09d12e79499f4e0dcd4293f (patch) | |
tree | f3bf2dffdd3c46744d3c1b0638948a1dfbd1b8f6 /testsuite/tests/typecheck | |
parent | af5e3a885ddd09dd5f550552c535af3661ff3dbf (diff) | |
download | haskell-2b792facab46f7cdd09d12e79499f4e0dcd4293f.tar.gz |
Simple subsumptionwip/T17775
This patch simplifies GHC to use simple subsumption.
Ticket #17775
Implements GHC proposal #287
https://github.com/ghc-proposals/ghc-proposals/blob/master/
proposals/0287-simplify-subsumption.rst
All the motivation is described there; I will not repeat it here.
The implementation payload:
* tcSubType and friends become noticably simpler, because it no
longer uses eta-expansion when checking subsumption.
* No deeplyInstantiate or deeplySkolemise
That in turn means that some tests fail, by design; they can all
be fixed by eta expansion. There is a list of such changes below.
Implementing the patch led me into a variety of sticky corners, so
the patch includes several othe changes, some quite significant:
* I made String wired-in, so that
"foo" :: String rather than
"foo" :: [Char]
This improves error messages, and fixes #15679
* The pattern match checker relies on knowing about in-scope equality
constraints, andd adds them to the desugarer's environment using
addTyCsDs. But the co_fn in a FunBind was missed, and for some reason
simple-subsumption ends up with dictionaries there. So I added a
call to addTyCsDs. This is really part of #18049.
* I moved the ic_telescope field out of Implication and into
ForAllSkol instead. This is a nice win; just expresses the code
much better.
* There was a bug in GHC.Tc.TyCl.Instance.tcDataFamInstHeader.
We called checkDataKindSig inside tc_kind_sig, /before/
solveEqualities and zonking. Obviously wrong, easily fixed.
* solveLocalEqualitiesX: there was a whole mess in here, around
failing fast enough. I discovered a bad latent bug where we
could successfully kind-check a type signature, and use it,
but have unsolved constraints that could fill in coercion
holes in that signature -- aargh.
It's all explained in Note [Failure in local type signatures]
in GHC.Tc.Solver. Much better now.
* I fixed a serious bug in anonymous type holes. IN
f :: Int -> (forall a. a -> _) -> Int
that "_" should be a unification variable at the /outer/
level; it cannot be instantiated to 'a'. This was plain
wrong. New fields mode_lvl and mode_holes in TcTyMode,
and auxiliary data type GHC.Tc.Gen.HsType.HoleMode.
This fixes #16292, but makes no progress towards the more
ambitious #16082
* I got sucked into an enormous refactoring of the reporting of
equality errors in GHC.Tc.Errors, especially in
mkEqErr1
mkTyVarEqErr
misMatchMsg
misMatchMsgOrCND
In particular, the very tricky mkExpectedActualMsg function
is gone.
It took me a full day. But the result is far easier to understand.
(Still not easy!) This led to various minor improvements in error
output, and an enormous number of test-case error wibbles.
One particular point: for occurs-check errors I now just say
Can't match 'a' against '[a]'
rather than using the intimidating language of "occurs check".
* Pretty-printing AbsBinds
Tests review
* Eta expansions
T11305: one eta expansion
T12082: one eta expansion (undefined)
T13585a: one eta expansion
T3102: one eta expansion
T3692: two eta expansions (tricky)
T2239: two eta expansions
T16473: one eta
determ004: two eta expansions (undefined)
annfail06: two eta (undefined)
T17923: four eta expansions (a strange program indeed!)
tcrun035: one eta expansion
* Ambiguity check at higher rank. Now that we have simple
subsumption, a type like
f :: (forall a. Eq a => Int) -> Int
is no longer ambiguous, because we could write
g :: (forall a. Eq a => Int) -> Int
g = f
and it'd typecheck just fine. But f's type is a bit
suspicious, and we might want to consider making the
ambiguity check do a check on each sub-term. Meanwhile,
these tests are accepted, whereas they were previously
rejected as ambiguous:
T7220a
T15438
T10503
T9222
* Some more interesting error message wibbles
T13381: Fine: one error (Int ~ Exp Int)
rather than two (Int ~ Exp Int, Exp Int ~ Int)
T9834: Small change in error (improvement)
T10619: Improved
T2414: Small change, due to order of unification, fine
T2534: A very simple case in which a change of unification order
means we get tow unsolved constraints instead of one
tc211: bizarre impredicative tests; just accept this for now
Updates Cabal and haddock submodules.
Metric Increase:
T12150
T12234
T5837
haddock.base
Metric Decrease:
haddock.compiler
haddock.Cabal
haddock.base
Merge note: This appears to break the
`UnliftedNewtypesDifficultUnification` test. It has been marked as
broken in the interest of merging.
(cherry picked from commit 66b7b195cb3dce93ed5078b80bf568efae904cc5)
Diffstat (limited to 'testsuite/tests/typecheck')
183 files changed, 971 insertions, 733 deletions
diff --git a/testsuite/tests/typecheck/bug1465/bug1465.stderr b/testsuite/tests/typecheck/bug1465/bug1465.stderr index 4e31c7f195..e4f5b10732 100644 --- a/testsuite/tests/typecheck/bug1465/bug1465.stderr +++ b/testsuite/tests/typecheck/bug1465/bug1465.stderr @@ -1,9 +1,9 @@ C.hs:6:11: error: - Couldn't match expected type ‘bug1465-1.0:A.T’ - with actual type ‘A.T’ - NB: ‘A.T’ is defined in ‘A’ in package ‘bug1465-2.0’ - ‘bug1465-1.0:A.T’ is defined in ‘A’ in package ‘bug1465-1.0’ - In the expression: B2.f - In the expression: [B1.f, B2.f] - In an equation for ‘x’: x = [B1.f, B2.f] + • Couldn't match expected type ‘bug1465-1.0:A.T’ + with actual type ‘A.T’ + NB: ‘bug1465-1.0:A.T’ is defined in ‘A’ in package ‘bug1465-1.0’ + ‘A.T’ is defined in ‘A’ in package ‘bug1465-2.0’ + • In the expression: B2.f + In the expression: [B1.f, B2.f] + In an equation for ‘x’: x = [B1.f, B2.f] diff --git a/testsuite/tests/typecheck/should_compile/FD3.stderr b/testsuite/tests/typecheck/should_compile/FD3.stderr index 85728da0a6..d7ac728b6c 100644 --- a/testsuite/tests/typecheck/should_compile/FD3.stderr +++ b/testsuite/tests/typecheck/should_compile/FD3.stderr @@ -1,9 +1,13 @@ FD3.hs:15:15: error: - • Occurs check: cannot construct the infinite type: a ~ (String, a) + • Couldn't match type ‘a’ with ‘(String, a)’ arising from a functional dependency between: constraint ‘MkA (String, a) a’ arising from a use of ‘mkA’ instance ‘MkA a1 a1’ at FD3.hs:12:10-16 + ‘a’ is a rigid type variable bound by + the type signature for: + translate :: forall a. (String, a) -> A a + at FD3.hs:14:1-31 • In the expression: mkA a In an equation for ‘translate’: translate a = mkA a • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_compile/T10072.stderr b/testsuite/tests/typecheck/should_compile/T10072.stderr index ad7fe2602a..71a93c9573 100644 --- a/testsuite/tests/typecheck/should_compile/T10072.stderr +++ b/testsuite/tests/typecheck/should_compile/T10072.stderr @@ -6,5 +6,5 @@ T10072.hs:3:31: error: at T10072.hs:3:1-47 To use the inferred type, enable PartialTypeSignatures • In the type ‘a -> _’ - In a RULE for ‘f’: a -> _ + In the type signature for ‘f’: a -> _ When checking the transformation rule "map/empty" diff --git a/testsuite/tests/typecheck/should_compile/T10283.hs b/testsuite/tests/typecheck/should_compile/T10283.hs index e623b1cb0a..8c5b8e2f5a 100644 --- a/testsuite/tests/typecheck/should_compile/T10283.hs +++ b/testsuite/tests/typecheck/should_compile/T10283.hs @@ -20,4 +20,4 @@ wrapIdComp f = runIdComp . f . liftOuter class Applicative p => ApplicativeFix p where afix :: (forall q. Applicative q => (Comp p q) a -> (Comp p q) a) -> p a - afix = wrapIdComp + afix f = wrapIdComp f diff --git a/testsuite/tests/typecheck/should_compile/T10390.hs b/testsuite/tests/typecheck/should_compile/T10390.hs index e0648c9554..facb26a26d 100644 --- a/testsuite/tests/typecheck/should_compile/T10390.hs +++ b/testsuite/tests/typecheck/should_compile/T10390.hs @@ -6,7 +6,7 @@ class ApPair r where apPair :: (forall a . (ApPair a, Num a) => Maybe a) -> Maybe r instance (ApPair a, ApPair b) => ApPair (a,b) where - apPair = apPair' + apPair x = apPair' x apPair' :: (ApPair b, ApPair c) => (forall a . (Num a, ApPair a) => Maybe a) -> Maybe (b,c) diff --git a/testsuite/tests/typecheck/should_compile/T11254.stderr b/testsuite/tests/typecheck/should_compile/T11254.stderr index a7466b78b9..10132d2cb8 100644 --- a/testsuite/tests/typecheck/should_compile/T11254.stderr +++ b/testsuite/tests/typecheck/should_compile/T11254.stderr @@ -6,8 +6,8 @@ T11254.hs:16:10: warning: [-Wdeferred-type-errors (in -Wdefault)] T11254.hs:18:12: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match type ‘GHC.Real.Ratio Integer’ with ‘Int’ - Expected type: Rational -> Frac Rational - Actual type: Rational -> Rational + Expected: Rational -> Frac Rational + Actual: Rational -> Rational • When checking that instance signature for ‘embed’ is more general than its signature in the class Instance sig: Rational -> Rational diff --git a/testsuite/tests/typecheck/should_compile/T11305.hs b/testsuite/tests/typecheck/should_compile/T11305.hs index 14cb955ed5..ee138a017c 100644 --- a/testsuite/tests/typecheck/should_compile/T11305.hs +++ b/testsuite/tests/typecheck/should_compile/T11305.hs @@ -54,4 +54,5 @@ instance ProfunctorComonad Tambara where yon ~(x,~(y,z)) = ((x,y),z) instance Profunctor p => Strong (Tambara p) where - first' = runTambara . produplicate + first' = (\x -> runTambara x) . produplicate + -- Simple subsumption (#17775) requires eta expansion here diff --git a/testsuite/tests/typecheck/should_compile/T12082.hs b/testsuite/tests/typecheck/should_compile/T12082.hs index 7aa4196737..0f001beabb 100644 --- a/testsuite/tests/typecheck/should_compile/T12082.hs +++ b/testsuite/tests/typecheck/should_compile/T12082.hs @@ -6,4 +6,5 @@ import Data.Typeable (Typeable) import Control.Monad.ST (RealWorld) f :: forall a. (forall b. Typeable b => b -> a) -> a -f = undefined :: (RealWorld -> a) -> a +f x = (undefined :: (RealWorld -> a) -> a) x + -- Simple subsumption (#17775) requires eta expansion here diff --git a/testsuite/tests/typecheck/should_compile/T12427a.hs b/testsuite/tests/typecheck/should_compile/T12427a.hs index cffab89749..56c7513012 100644 --- a/testsuite/tests/typecheck/should_compile/T12427a.hs +++ b/testsuite/tests/typecheck/should_compile/T12427a.hs @@ -36,5 +36,6 @@ h2 y = case y of T1 _ v -> v -- Fails in 7.10 (head exploded) -- Fails in 8.0.1 (ditto) -- Succeeds in 8.2 +-- Fails in 8.12 (simple subsumption) x3 :: (forall a. a->a) -> Int T1 _ x3 = undefined diff --git a/testsuite/tests/typecheck/should_compile/T12427a.stderr b/testsuite/tests/typecheck/should_compile/T12427a.stderr index efc87a1fc3..b9c3969bf0 100644 --- a/testsuite/tests/typecheck/should_compile/T12427a.stderr +++ b/testsuite/tests/typecheck/should_compile/T12427a.stderr @@ -12,8 +12,19 @@ T12427a.hs:17:29: error: h11 :: T -> p (bound at T12427a.hs:17:1) T12427a.hs:28:6: error: - • Cannot instantiate unification variable ‘p0’ + • Couldn't match expected type ‘p0’ + with actual type ‘(forall b. [b] -> [b]) -> Int’ + Cannot instantiate unification variable ‘p0’ with a type involving polytypes: (forall b. [b] -> [b]) -> Int - GHC doesn't yet support impredicative polymorphism • In the pattern: T1 _ x1 In a pattern binding: T1 _ x1 = undefined + +T12427a.hs:41:6: error: + • Couldn't match type ‘b’ with ‘[b]’ + Expected: (forall b. [b] -> [b]) -> Int + Actual: (forall a. a -> a) -> Int + ‘b’ is a rigid type variable bound by + the type [b] -> [b] + at T12427a.hs:41:1-19 + • In the pattern: T1 _ x3 + In a pattern binding: T1 _ x3 = undefined diff --git a/testsuite/tests/typecheck/should_compile/T13381.stderr b/testsuite/tests/typecheck/should_compile/T13381.stderr index 9c8eab6e67..7f250eaec1 100644 --- a/testsuite/tests/typecheck/should_compile/T13381.stderr +++ b/testsuite/tests/typecheck/should_compile/T13381.stderr @@ -1,14 +1,8 @@ T13381.hs:21:23: error: • Couldn't match type ‘Exp Int’ with ‘Int’ - Expected type: Exp Int -> Iter (Exp Int) (Exp Char) - Actual type: Int -> Iter (Exp Int) (Exp Char) + Expected: Int -> Iter Int (Exp Char) + Actual: Int -> Iter (Exp Int) (Exp Char) • In the first argument of ‘iterLoop’, namely ‘f’ In the first argument of ‘fromExp’, namely ‘(iterLoop f init)’ In the expression: fromExp (iterLoop f init) - -T13381.hs:21:25: error: - • Couldn't match expected type ‘Exp Int’ with actual type ‘Int’ - • In the second argument of ‘iterLoop’, namely ‘init’ - In the first argument of ‘fromExp’, namely ‘(iterLoop f init)’ - In the expression: fromExp (iterLoop f init) diff --git a/testsuite/tests/typecheck/should_compile/T13585a.hs b/testsuite/tests/typecheck/should_compile/T13585a.hs index 0652ece370..3f72a45ea3 100644 --- a/testsuite/tests/typecheck/should_compile/T13585a.hs +++ b/testsuite/tests/typecheck/should_compile/T13585a.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE KindSignatures, RankNTypes, TypeFamilies, MultiParamTypeClasses, FlexibleInstances,UndecidableInstances #-} +{-# LANGUAGE ScopedTypeVariables, KindSignatures, RankNTypes, TypeFamilies, MultiParamTypeClasses, FlexibleInstances,UndecidableInstances #-} module T13585a where @@ -78,5 +78,6 @@ au k = withIso k $ \ sa bt f -> fmap sa (f bt) {-# INLINE au #-} ala :: (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s) -ala = au . _Wrapping +ala = au . (\x -> _Wrapping x) + -- Simple subsumption (#17775) requires eta expansion here {-# INLINE ala #-} diff --git a/testsuite/tests/typecheck/should_compile/T13651.stderr b/testsuite/tests/typecheck/should_compile/T13651.stderr index 6b6c64302f..150291c210 100644 --- a/testsuite/tests/typecheck/should_compile/T13651.stderr +++ b/testsuite/tests/typecheck/should_compile/T13651.stderr @@ -8,6 +8,12 @@ T13651.hs:11:8: error: (F cr cu ~ Bar h (Bar r u), F cu cs ~ Bar (Foo h) (Bar u s)) => Bar h (Bar r u) -> Bar (Foo h) (Bar u s) -> Foo (cr -> cs) at T13651.hs:(11,8)-(13,65) + Expected: forall cr cu h r u cs s. + (F cr cu ~ Bar h (Bar r u), F cu cs ~ Bar (Foo h) (Bar u s)) => + Bar h (Bar r u) -> Bar (Foo h) (Bar u s) -> Foo (cr -> cs) + Actual: forall cr cu h r u cs s. + (F cr cu ~ Bar h (Bar r u), F cu cs ~ Bar (Foo h) (Bar u s)) => + Bar h (Bar r u) -> Bar (Foo h) (Bar u s) -> Foo (cr -> cs) • In the ambiguity check for ‘foo’ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes In the type signature: diff --git a/testsuite/tests/typecheck/should_compile/T14488.hs b/testsuite/tests/typecheck/should_compile/T14488.hs index a4a12841b7..04c295b706 100644 --- a/testsuite/tests/typecheck/should_compile/T14488.hs +++ b/testsuite/tests/typecheck/should_compile/T14488.hs @@ -7,4 +7,4 @@ type Lens' s a = forall f. Functor f => (a -> f a) -> s -> f s data T a = MkT { _tfield :: Eq a => a } tfield :: Eq a => Lens' (T a) a -tfield f t = MkT <$> f (_tfield t) +tfield f t = (\x -> MkT x) <$> f (_tfield t) diff --git a/testsuite/tests/typecheck/should_compile/T15368.stderr b/testsuite/tests/typecheck/should_compile/T15368.stderr index 693779e1f5..7f022744c4 100644 --- a/testsuite/tests/typecheck/should_compile/T15368.stderr +++ b/testsuite/tests/typecheck/should_compile/T15368.stderr @@ -15,9 +15,10 @@ T15368.hs:11:15: warning: [-Wtyped-holes (in -Wdefault)] trigger :: a -> b -> (F a b, F b a) (bound at T15368.hs:11:1) T15368.hs:11:15: warning: [-Wdeferred-type-errors (in -Wdefault)] - • Couldn't match type ‘F b a’ with ‘F b0 a0’ - Expected type: (F a b, F b a) - Actual type: (F a b, F b0 a0) + • Couldn't match type: F b a + with: F b0 a0 + Expected: (F a b, F b a) + Actual: (F a b, F b0 a0) NB: ‘F’ is a non-injective type family The type variables ‘b0’, ‘a0’ are ambiguous • In the expression: _ `transitive` trigger _ _ diff --git a/testsuite/tests/typecheck/should_compile/T15370.stderr b/testsuite/tests/typecheck/should_compile/T15370.stderr index ec0ff67482..f359155dbd 100644 --- a/testsuite/tests/typecheck/should_compile/T15370.stderr +++ b/testsuite/tests/typecheck/should_compile/T15370.stderr @@ -1,6 +1,8 @@ T15370.hs:14:10: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match type ‘n’ with ‘j’ + Expected: n :~: j + Actual: n :~: n ‘n’ is a rigid type variable bound by the type signature for: mkRefl :: forall {k} (n :: k) (j :: k). n :~: j @@ -9,8 +11,6 @@ T15370.hs:14:10: warning: [-Wdeferred-type-errors (in -Wdefault)] the type signature for: mkRefl :: forall {k} (n :: k) (j :: k). n :~: j at T15370.hs:13:1-17 - Expected type: n :~: j - Actual type: n :~: n • In the expression: Refl In an equation for ‘mkRefl’: mkRefl = Refl • Relevant bindings include @@ -18,8 +18,8 @@ T15370.hs:14:10: warning: [-Wdeferred-type-errors (in -Wdefault)] T15370.hs:20:13: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match type ‘S r’ with ‘()’ - Expected type: () - Actual type: S r + Expected: () + Actual: S r • In the expression: no + _ In a case alternative: Refl -> no + _ In the expression: case mkRefl @x @y of { Refl -> no + _ } diff --git a/testsuite/tests/typecheck/should_compile/T1634.hs b/testsuite/tests/typecheck/should_compile/T1634.hs index b4c6f2b561..a8fdd9f8eb 100644 --- a/testsuite/tests/typecheck/should_compile/T1634.hs +++ b/testsuite/tests/typecheck/should_compile/T1634.hs @@ -3,4 +3,4 @@ module T1634 where t1 :: a -> (forall b. b -> (a,b)) -t1 = (,) +t1 x = (,) x diff --git a/testsuite/tests/typecheck/should_compile/T17007.hs b/testsuite/tests/typecheck/should_compile/T17007.hs index 21b7639dd0..0b2b0f28a2 100644 --- a/testsuite/tests/typecheck/should_compile/T17007.hs +++ b/testsuite/tests/typecheck/should_compile/T17007.hs @@ -10,4 +10,4 @@ get (x :: ItemColID a b) = x :: ItemColID a b type family ItemColID' a b where ItemColID' a b = Int -- Discards a,b get' :: ItemColID' a b -> ItemColID' a b -get' (x :: ItemColID' a b) = x :: ItemColID' a b +get' (x :: ItemColID' p q) = x :: ItemColID' a b diff --git a/testsuite/tests/typecheck/should_compile/T17775-view-pats.hs b/testsuite/tests/typecheck/should_compile/T17775-view-pats.hs new file mode 100644 index 0000000000..8ffd704d9c --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T17775-view-pats.hs @@ -0,0 +1,52 @@ +{-# LANGUAGE RankNTypes, ViewPatterns #-} + +module ViewPats where + +ex1 :: forall a. a -> a -> Int -> Eq a => Bool +-- Accept; we skolemise over three args +ex1 x ((== x) -> result) _ = result + +{- +ex2 :: forall a. a -> a -> Int -> Eq a => Bool +-- Reject: only skolemise over two args +ex2 x ((== x) -> result) = \ _ -> result + +ex3 :: forall a. a -> a -> Int -> Eq a => Bool +-- Reject: only skolemise over two args +-- const (result :: Bool) :: b -> Eq a => Bool +ex3 x ((== x) -> result) = const result +-} + +ex4 :: forall a. a -> a -> Int -> Eq a => Bool +-- Accept +ex4 x y _ = x == y + +ex5 :: forall a. a -> a -> Int -> Eq a => Bool +-- Accept +ex5 x y = \ _ -> x == y + +{- +ex6 :: forall a. a -> a -> Int -> Eq a => Bool +-- Reject. Needs (const (bla :: Bool)) :: Int -> Eq a => Bool +ex6 x y = const (x == y) +-} + +ex7 :: forall a. a -> a -> Eq a => Bool +-- Accept +ex7 x ((== x) -> result) = result + +ex8 :: forall a. a -> a -> Eq a => Bool +-- Accept +ex8 x y = x == y + +ex9 :: forall a. a -> Eq a => a -> Bool +-- Accept +ex9 x ((== x) -> result) = result + +ex10 :: forall a. a -> Eq a => a -> Bool +-- Accept +ex10 x y = x == y + +ex11 :: forall a. a -> Eq a => a -> Bool +-- Accept +ex11 x = (== x) diff --git a/testsuite/tests/typecheck/should_compile/T17775-viewpats-a.hs b/testsuite/tests/typecheck/should_compile/T17775-viewpats-a.hs new file mode 100644 index 0000000000..96deb25631 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T17775-viewpats-a.hs @@ -0,0 +1,35 @@ +{-# LANGUAGE RankNTypes, ViewPatterns #-} + +module ViewPats where + +ex1 :: forall a. a -> a -> Int -> Eq a => Bool +-- Accept; we skolemise over three args +ex1 x ((== x) -> result) _ = result + +ex4 :: forall a. a -> a -> Int -> Eq a => Bool +-- Accept +ex4 x y _ = x == y + +ex5 :: forall a. a -> a -> Int -> Eq a => Bool +-- Accept +ex5 x y = \ _ -> x == y + +ex7 :: forall a. a -> a -> Eq a => Bool +-- Accept +ex7 x ((== x) -> result) = result + +ex8 :: forall a. a -> a -> Eq a => Bool +-- Accept +ex8 x y = x == y + +ex9 :: forall a. a -> Eq a => a -> Bool +-- Accept +ex9 x ((== x) -> result) = result + +ex10 :: forall a. a -> Eq a => a -> Bool +-- Accept +ex10 x y = x == y + +ex11 :: forall a. a -> Eq a => a -> Bool +-- Accept +ex11 x = (== x) diff --git a/testsuite/tests/typecheck/should_compile/T17775-viewpats-b.hs b/testsuite/tests/typecheck/should_compile/T17775-viewpats-b.hs new file mode 100644 index 0000000000..18a6ec8da6 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T17775-viewpats-b.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes, ViewPatterns #-} + +module ViewPats where + +ex2 :: forall a. a -> a -> Int -> Eq a => Bool +-- Reject: only skolemise over two args +ex2 x ((== x) -> result) = \ _ -> result diff --git a/testsuite/tests/typecheck/should_compile/T17775-viewpats-b.stderr b/testsuite/tests/typecheck/should_compile/T17775-viewpats-b.stderr new file mode 100644 index 0000000000..e631106dd0 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T17775-viewpats-b.stderr @@ -0,0 +1,10 @@ + +T17775-viewpats-b.hs:7:9: error: + • No instance for (Eq a) arising from a use of ‘==’ + Possible fix: + add (Eq a) to the context of + the type signature for: + ex2 :: forall a. a -> a -> Int -> Eq a => Bool + • In the expression: == x + In the pattern: (== x) -> result + In an equation for ‘ex2’: ex2 x ((== x) -> result) = \ _ -> result diff --git a/testsuite/tests/typecheck/should_compile/T17775-viewpats-c.hs b/testsuite/tests/typecheck/should_compile/T17775-viewpats-c.hs new file mode 100644 index 0000000000..78b4e9d0b5 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T17775-viewpats-c.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE RankNTypes, ViewPatterns #-} + +module ViewPats where + +ex3 :: forall a. a -> a -> Int -> Eq a => Bool +-- Reject: only skolemise over two args +-- const (result :: Bool) :: b -> Eq a => Bool +ex3 x ((== x) -> result) = const result diff --git a/testsuite/tests/typecheck/should_compile/T17775-viewpats-c.stderr b/testsuite/tests/typecheck/should_compile/T17775-viewpats-c.stderr new file mode 100644 index 0000000000..a0456c5a70 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T17775-viewpats-c.stderr @@ -0,0 +1,11 @@ + +T17775-viewpats-c.hs:8:28: error: + • Couldn't match type ‘Bool’ with ‘Eq a => Bool’ + Expected: Int -> Eq a => Bool + Actual: Int -> Bool + • In the expression: const result + In an equation for ‘ex3’: ex3 x ((== x) -> result) = const result + • Relevant bindings include + x :: a (bound at T17775-viewpats-c.hs:8:5) + ex3 :: a -> a -> Int -> Eq a => Bool + (bound at T17775-viewpats-c.hs:8:1) diff --git a/testsuite/tests/typecheck/should_compile/T17775-viewpats-d.hs b/testsuite/tests/typecheck/should_compile/T17775-viewpats-d.hs new file mode 100644 index 0000000000..3a133d7930 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T17775-viewpats-d.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE RankNTypes, ViewPatterns #-} + +module ViewPats where + +ex6 :: forall a. a -> a -> Int -> Eq a => Bool +-- Reject. Needs (const (bla :: Bool)) :: Int -> Eq a => Bool +ex6 x y = const (x == y) diff --git a/testsuite/tests/typecheck/should_compile/T17775-viewpats-d.stderr b/testsuite/tests/typecheck/should_compile/T17775-viewpats-d.stderr new file mode 100644 index 0000000000..e270cecc25 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T17775-viewpats-d.stderr @@ -0,0 +1,12 @@ + +T17775-viewpats-d.hs:7:11: error: + • Couldn't match type ‘Bool’ with ‘Eq a => Bool’ + Expected: Int -> Eq a => Bool + Actual: Int -> Bool + • In the expression: const (x == y) + In an equation for ‘ex6’: ex6 x y = const (x == y) + • Relevant bindings include + y :: a (bound at T17775-viewpats-d.hs:7:7) + x :: a (bound at T17775-viewpats-d.hs:7:5) + ex6 :: a -> a -> Int -> Eq a => Bool + (bound at T17775-viewpats-d.hs:7:1) diff --git a/testsuite/tests/typecheck/should_compile/T2494.stderr b/testsuite/tests/typecheck/should_compile/T2494.stderr index 5cf4fde746..8e427c5ac8 100644 --- a/testsuite/tests/typecheck/should_compile/T2494.stderr +++ b/testsuite/tests/typecheck/should_compile/T2494.stderr @@ -1,14 +1,14 @@ T2494.hs:15:14: error: • Couldn't match type ‘b’ with ‘a’ + Expected: Maybe (m a) -> Maybe (m a) + Actual: Maybe (m b) -> Maybe (m b) ‘b’ is a rigid type variable bound by the RULE "foo/foo" at T2494.hs:(12,1)-(15,33) ‘a’ is a rigid type variable bound by the RULE "foo/foo" at T2494.hs:(12,1)-(15,33) - Expected type: Maybe (m a) -> Maybe (m a) - Actual type: Maybe (m b) -> Maybe (m b) • In the first argument of ‘foo’, namely ‘g’ In the second argument of ‘foo’, namely ‘(foo g x)’ In the expression: foo f (foo g x) @@ -21,14 +21,14 @@ T2494.hs:15:14: error: T2494.hs:15:30: error: • Couldn't match type ‘b’ with ‘a’ + Expected: Maybe (m b) -> Maybe (m a) + Actual: Maybe (m b) -> Maybe (m b) ‘b’ is a rigid type variable bound by the RULE "foo/foo" at T2494.hs:(12,1)-(15,33) ‘a’ is a rigid type variable bound by the RULE "foo/foo" at T2494.hs:(12,1)-(15,33) - Expected type: Maybe (m b) -> Maybe (m a) - Actual type: Maybe (m b) -> Maybe (m b) • In the second argument of ‘(.)’, namely ‘g’ In the first argument of ‘foo’, namely ‘(f . g)’ In the expression: foo (f . g) x diff --git a/testsuite/tests/typecheck/should_compile/T3692.hs b/testsuite/tests/typecheck/should_compile/T3692.hs index 5be093f55f..4d5a61074f 100644 --- a/testsuite/tests/typecheck/should_compile/T3692.hs +++ b/testsuite/tests/typecheck/should_compile/T3692.hs @@ -7,5 +7,8 @@ type Foo a b = () -> (Bar a => a) class Bar a where {} +boo :: Foo p q +boo x = undefined + foo :: Foo a b -foo = id (undefined :: Foo p q) +foo y = id (\x -> boo x) y diff --git a/testsuite/tests/typecheck/should_compile/T4284.hs b/testsuite/tests/typecheck/should_compile/T4284.hs index 2d5164a487..5e1b9ceb5f 100644 --- a/testsuite/tests/typecheck/should_compile/T4284.hs +++ b/testsuite/tests/typecheck/should_compile/T4284.hs @@ -2,11 +2,11 @@ module Test where foo :: () -> forall b. b -foo = undefined +foo x = undefined -works = id foo +works = id (\x -> foo x) -fails = (id) foo +fails = (id) (\x -> foo x) -- works type checks, but fails fails with the following error -- message: diff --git a/testsuite/tests/typecheck/should_compile/T7220a.hs b/testsuite/tests/typecheck/should_compile/T7220a.hs index 4739626fa5..2ea0150f29 100644 --- a/testsuite/tests/typecheck/should_compile/T7220a.hs +++ b/testsuite/tests/typecheck/should_compile/T7220a.hs @@ -23,5 +23,7 @@ f :: (forall b. (C a b, TF b ~ Y) => b) -> X -- g = f -- Now we fail in all ways! -f _ = undefined +-- But with simple subsumption (#17775) we +-- no longer get an ambiguity check here +f _ = undefined diff --git a/testsuite/tests/typecheck/should_compile/T7220a.stderr b/testsuite/tests/typecheck/should_compile/T7220a.stderr deleted file mode 100644 index 2b311c1111..0000000000 --- a/testsuite/tests/typecheck/should_compile/T7220a.stderr +++ /dev/null @@ -1,14 +0,0 @@ - -T7220a.hs:17:6: error: - • Could not deduce (C a b) - from the context: (C a0 b, TF b ~ Y) - bound by a type expected by the context: - forall b. (C a0 b, TF b ~ Y) => b - at T7220a.hs:17:6-44 - Possible fix: - add (C a b) to the context of - a type expected by the context: - forall b. (C a0 b, TF b ~ Y) => b - • In the ambiguity check for ‘f’ - To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature: f :: (forall b. (C a b, TF b ~ Y) => b) -> X diff --git a/testsuite/tests/typecheck/should_compile/T9569a.hs b/testsuite/tests/typecheck/should_compile/T9569a.hs index 3205cb1b4e..0eeb4c40a7 100644 --- a/testsuite/tests/typecheck/should_compile/T9569a.hs +++ b/testsuite/tests/typecheck/should_compile/T9569a.hs @@ -5,7 +5,7 @@ g :: (Int -> Int) -> Int g f = f 4 f1 :: (forall a. a -> a) -> Int +-- Fails; needs eta-expansion +-- cf T9569b f1 = g -f2 :: (forall a. a -> a) -> Int -f2 x = g x diff --git a/testsuite/tests/typecheck/should_compile/T9569a.stderr b/testsuite/tests/typecheck/should_compile/T9569a.stderr new file mode 100644 index 0000000000..57d44a0f2a --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T9569a.stderr @@ -0,0 +1,8 @@ + +T9569a.hs:10:6: error: + • Couldn't match type: Int -> Int + with: forall a. a -> a + Expected: (forall a. a -> a) -> Int + Actual: (Int -> Int) -> Int + • In the expression: g + In an equation for ‘f1’: f1 = g diff --git a/testsuite/tests/typecheck/should_compile/T9569b.hs b/testsuite/tests/typecheck/should_compile/T9569b.hs new file mode 100644 index 0000000000..67ddf21d73 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T9569b.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE RankNTypes #-} +module T9569a where + +g :: (Int -> Int) -> Int +g f = f 4 + +f2 :: (forall a. a -> a) -> Int +f2 f = g f diff --git a/testsuite/tests/typecheck/should_compile/T9834.hs b/testsuite/tests/typecheck/should_compile/T9834.hs index c16e395f8c..728de2b8ed 100644 --- a/testsuite/tests/typecheck/should_compile/T9834.hs +++ b/testsuite/tests/typecheck/should_compile/T9834.hs @@ -20,4 +20,4 @@ wrapIdComp f = runIdComp . f . liftOuter class Applicative p => ApplicativeFix p where afix :: (forall q. Applicative q => (Comp p q) a -> (Comp p q) a) -> p a - afix = wrapIdComp
\ No newline at end of file + afix f = wrapIdComp f diff --git a/testsuite/tests/typecheck/should_compile/T9834.stderr b/testsuite/tests/typecheck/should_compile/T9834.stderr index 52f207d511..5963781325 100644 --- a/testsuite/tests/typecheck/should_compile/T9834.stderr +++ b/testsuite/tests/typecheck/should_compile/T9834.stderr @@ -1,40 +1,46 @@ -T9834.hs:23:10: warning: [-Wdeferred-type-errors (in -Wdefault)] - • Occurs check: cannot construct the infinite type: p ~ (->) (p a0) - Expected type: (forall (q :: * -> *). - Applicative q => - Comp p q a -> Comp p q a) - -> p a - Actual type: (forall (q :: * -> *). - Applicative q => - Nat (Comp p q) (Comp p q)) - -> p a0 -> p a0 - • In the expression: wrapIdComp - In an equation for ‘afix’: afix = wrapIdComp +T9834.hs:23:12: warning: [-Wdeferred-type-errors (in -Wdefault)] + • Couldn't match type ‘p’ with ‘(->) (p a0)’ + Expected: p a + Actual: p a0 -> p a0 + ‘p’ is a rigid type variable bound by + the class declaration for ‘ApplicativeFix’ + at T9834.hs:21:39 + • In the expression: wrapIdComp f + In an equation for ‘afix’: afix f = wrapIdComp f • Relevant bindings include + f :: forall (q :: * -> *). + Applicative q => + Comp p q a -> Comp p q a + (bound at T9834.hs:23:8) afix :: (forall (q :: * -> *). Applicative q => Comp p q a -> Comp p q a) -> p a (bound at T9834.hs:23:3) -T9834.hs:23:10: warning: [-Wdeferred-type-errors (in -Wdefault)] +T9834.hs:23:23: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match type ‘a1’ with ‘a’ + Expected: Comp p q a1 -> Comp p q a1 + Actual: Comp p q a -> Comp p q a ‘a1’ is a rigid type variable bound by a type expected by the context: forall (q :: * -> *). Applicative q => Nat (Comp p q) (Comp p q) - at T9834.hs:23:10-19 + at T9834.hs:23:23 ‘a’ is a rigid type variable bound by the type signature for: afix :: forall a. (forall (q :: * -> *). Applicative q => Comp p q a -> Comp p q a) -> p a at T9834.hs:22:11-74 - Expected type: Comp p q a1 -> Comp p q a1 - Actual type: Comp p q a -> Comp p q a - • In the expression: wrapIdComp - In an equation for ‘afix’: afix = wrapIdComp + • In the first argument of ‘wrapIdComp’, namely ‘f’ + In the expression: wrapIdComp f + In an equation for ‘afix’: afix f = wrapIdComp f • Relevant bindings include + f :: forall (q :: * -> *). + Applicative q => + Comp p q a -> Comp p q a + (bound at T9834.hs:23:8) afix :: (forall (q :: * -> *). Applicative q => Comp p q a -> Comp p q a) diff --git a/testsuite/tests/typecheck/should_compile/UnliftedNewtypesUnifySig.hs b/testsuite/tests/typecheck/should_compile/UnliftedNewtypesUnifySig.hs index 9f5b984025..a7645a0b3e 100644 --- a/testsuite/tests/typecheck/should_compile/UnliftedNewtypesUnifySig.hs +++ b/testsuite/tests/typecheck/should_compile/UnliftedNewtypesUnifySig.hs @@ -14,7 +14,10 @@ import GHC.Exts (Int#,Word#,RuntimeRep(IntRep)) import GHC.Exts (TYPE) type KindOf (a :: TYPE k) = k + data family D (a :: TYPE r) :: TYPE r + newtype instance D a = MkWordD Word# + newtype instance D a :: TYPE (KindOf a) where MkIntD :: forall (a :: TYPE 'IntRep). Int# -> D a diff --git a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr index e422b8629e..119c6b91e5 100644 --- a/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/abstract_refinement_hole_fits.stderr @@ -42,29 +42,29 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where pure :: forall (f :: * -> *) a. Applicative f => a -> f a ($!) (_ :: [Integer] -> Integer) where ($!) :: forall a b. (a -> b) -> a -> b - curry (_ :: (a2, [Integer]) -> Integer) (_ :: a2) + curry (_ :: (t0, [Integer]) -> Integer) (_ :: t0) where curry :: forall a b c. ((a, b) -> c) -> a -> b -> c (.) (_ :: b1 -> Integer) (_ :: [Integer] -> b1) where (.) :: forall b c a. (b -> c) -> (a -> b) -> a -> c - flip (_ :: [Integer] -> b7 -> Integer) (_ :: b7) + flip (_ :: [Integer] -> t0 -> Integer) (_ :: t0) where flip :: forall a b c. (a -> b -> c) -> b -> a -> c - (>>=) (_ :: [Integer] -> a11) (_ :: a11 -> [Integer] -> Integer) + (>>=) (_ :: [Integer] -> a8) (_ :: a8 -> [Integer] -> Integer) where (>>=) :: forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b - (>>) (_ :: [Integer] -> a10) (_ :: [Integer] -> Integer) + (>>) (_ :: [Integer] -> a7) (_ :: [Integer] -> Integer) where (>>) :: forall (m :: * -> *) a b. Monad m => m a -> m b -> m b - fmap (_ :: a12 -> Integer) (_ :: [Integer] -> a12) + fmap (_ :: a9 -> Integer) (_ :: [Integer] -> a9) where fmap :: forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b - (<*>) (_ :: [Integer] -> a8 -> Integer) (_ :: [Integer] -> a8) + (<*>) (_ :: [Integer] -> a5 -> Integer) (_ :: [Integer] -> a5) where (<*>) :: forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b - (*>) (_ :: [Integer] -> a7) (_ :: [Integer] -> Integer) + (*>) (_ :: [Integer] -> a4) (_ :: [Integer] -> Integer) where (*>) :: forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b @@ -72,7 +72,7 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where (<$>) :: forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b - (=<<) (_ :: a9 -> [Integer] -> Integer) (_ :: [Integer] -> a9) + (=<<) (_ :: a6 -> [Integer] -> Integer) (_ :: [Integer] -> a6) where (=<<) :: forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b @@ -84,15 +84,15 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where (<$) :: forall (f :: * -> *) a b. Functor f => a -> f b -> f a - id (_ :: t1 -> [Integer] -> Integer) (_ :: t1) + id (_ :: t0 -> [Integer] -> Integer) (_ :: t0) where id :: forall a. a -> a - head (_ :: [t1 -> [Integer] -> Integer]) (_ :: t1) + head (_ :: [t0 -> [Integer] -> Integer]) (_ :: t0) where head :: forall a. [a] -> a - last (_ :: [t1 -> [Integer] -> Integer]) (_ :: t1) + last (_ :: [t0 -> [Integer] -> Integer]) (_ :: t0) where last :: forall a. [a] -> a - fst (_ :: (t1 -> [Integer] -> Integer, b2)) (_ :: t1) + fst (_ :: (t0 -> [Integer] -> Integer, b2)) (_ :: t0) where fst :: forall a b. (a, b) -> a - snd (_ :: (a3, t1 -> [Integer] -> Integer)) (_ :: t1) + snd (_ :: (a2, t0 -> [Integer] -> Integer)) (_ :: t0) where snd :: forall a b. (a, b) -> b id (_ :: [Integer] -> Integer) where id :: forall a. a -> a @@ -108,19 +108,19 @@ abstract_refinement_hole_fits.hs:4:5: warning: [-Wtyped-holes (in -Wdefault)] where fst :: forall a b. (a, b) -> a snd (_ :: (a0, [Integer] -> Integer)) where snd :: forall a b. (a, b) -> b - const (_ :: [Integer] -> Integer) (_ :: b6) + const (_ :: [Integer] -> Integer) (_ :: t0) where const :: forall a b. a -> b -> a - seq (_ :: a13) (_ :: [Integer] -> Integer) + seq (_ :: t2) (_ :: [Integer] -> Integer) where seq :: forall a b. a -> b -> b - ($) (_ :: a5 -> [Integer] -> Integer) (_ :: a5) + ($) (_ :: t0 -> [Integer] -> Integer) (_ :: t0) where ($) :: forall a b. (a -> b) -> a -> b - return (_ :: [Integer] -> Integer) (_ :: t1) + return (_ :: [Integer] -> Integer) (_ :: t0) where return :: forall (m :: * -> *) a. Monad m => a -> m a - pure (_ :: [Integer] -> Integer) (_ :: t1) + pure (_ :: [Integer] -> Integer) (_ :: t0) where pure :: forall (f :: * -> *) a. Applicative f => a -> f a - uncurry (_ :: a4 -> b3 -> [Integer] -> Integer) (_ :: (a4, b3)) + uncurry (_ :: a3 -> b3 -> [Integer] -> Integer) (_ :: (a3, b3)) where uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c - ($!) (_ :: a6 -> [Integer] -> Integer) (_ :: a6) + ($!) (_ :: t0 -> [Integer] -> Integer) (_ :: t0) where ($!) :: forall a b. (a -> b) -> a -> b abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] @@ -158,31 +158,31 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] where pure :: forall (f :: * -> *) a. Applicative f => a -> f a ($!) (_ :: Integer -> [Integer] -> Integer) where ($!) :: forall a b. (a -> b) -> a -> b - curry (_ :: (a2, Integer) -> [Integer] -> Integer) (_ :: a2) + curry (_ :: (t0, Integer) -> [Integer] -> Integer) (_ :: t0) where curry :: forall a b c. ((a, b) -> c) -> a -> b -> c (.) (_ :: b1 -> [Integer] -> Integer) (_ :: Integer -> b1) where (.) :: forall b c a. (b -> c) -> (a -> b) -> a -> c - flip (_ :: Integer -> b7 -> [Integer] -> Integer) (_ :: b7) + flip (_ :: Integer -> t0 -> [Integer] -> Integer) (_ :: t0) where flip :: forall a b c. (a -> b -> c) -> b -> a -> c - (>>=) (_ :: Integer -> a11) - (_ :: a11 -> Integer -> [Integer] -> Integer) + (>>=) (_ :: Integer -> a8) + (_ :: a8 -> Integer -> [Integer] -> Integer) where (>>=) :: forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b - (>>) (_ :: Integer -> a10) (_ :: Integer -> [Integer] -> Integer) + (>>) (_ :: Integer -> a7) (_ :: Integer -> [Integer] -> Integer) where (>>) :: forall (m :: * -> *) a b. Monad m => m a -> m b -> m b - fmap (_ :: a12 -> [Integer] -> Integer) (_ :: Integer -> a12) + fmap (_ :: a9 -> [Integer] -> Integer) (_ :: Integer -> a9) where fmap :: forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b - (<*>) (_ :: Integer -> a8 -> [Integer] -> Integer) - (_ :: Integer -> a8) + (<*>) (_ :: Integer -> a5 -> [Integer] -> Integer) + (_ :: Integer -> a5) where (<*>) :: forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b - (*>) (_ :: Integer -> a7) (_ :: Integer -> [Integer] -> Integer) + (*>) (_ :: Integer -> a4) (_ :: Integer -> [Integer] -> Integer) where (*>) :: forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b @@ -190,8 +190,8 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] where (<$>) :: forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b - (=<<) (_ :: a9 -> Integer -> [Integer] -> Integer) - (_ :: Integer -> a9) + (=<<) (_ :: a6 -> Integer -> [Integer] -> Integer) + (_ :: Integer -> a6) where (=<<) :: forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b @@ -203,15 +203,15 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] where (<$) :: forall (f :: * -> *) a b. Functor f => a -> f b -> f a - id (_ :: t1 -> Integer -> [Integer] -> Integer) (_ :: t1) + id (_ :: t0 -> Integer -> [Integer] -> Integer) (_ :: t0) where id :: forall a. a -> a - head (_ :: [t1 -> Integer -> [Integer] -> Integer]) (_ :: t1) + head (_ :: [t0 -> Integer -> [Integer] -> Integer]) (_ :: t0) where head :: forall a. [a] -> a - last (_ :: [t1 -> Integer -> [Integer] -> Integer]) (_ :: t1) + last (_ :: [t0 -> Integer -> [Integer] -> Integer]) (_ :: t0) where last :: forall a. [a] -> a - fst (_ :: (t1 -> Integer -> [Integer] -> Integer, b2)) (_ :: t1) + fst (_ :: (t0 -> Integer -> [Integer] -> Integer, b2)) (_ :: t0) where fst :: forall a b. (a, b) -> a - snd (_ :: (a3, t1 -> Integer -> [Integer] -> Integer)) (_ :: t1) + snd (_ :: (a2, t0 -> Integer -> [Integer] -> Integer)) (_ :: t0) where snd :: forall a b. (a, b) -> b id (_ :: Integer -> [Integer] -> Integer) where id :: forall a. a -> a @@ -228,18 +228,18 @@ abstract_refinement_hole_fits.hs:7:5: warning: [-Wtyped-holes (in -Wdefault)] where fst :: forall a b. (a, b) -> a snd (_ :: (a0, Integer -> [Integer] -> Integer)) where snd :: forall a b. (a, b) -> b - const (_ :: Integer -> [Integer] -> Integer) (_ :: b6) + const (_ :: Integer -> [Integer] -> Integer) (_ :: t0) where const :: forall a b. a -> b -> a - seq (_ :: a13) (_ :: Integer -> [Integer] -> Integer) + seq (_ :: t2) (_ :: Integer -> [Integer] -> Integer) where seq :: forall a b. a -> b -> b - ($) (_ :: a5 -> Integer -> [Integer] -> Integer) (_ :: a5) + ($) (_ :: t0 -> Integer -> [Integer] -> Integer) (_ :: t0) where ($) :: forall a b. (a -> b) -> a -> b - return (_ :: Integer -> [Integer] -> Integer) (_ :: t1) + return (_ :: Integer -> [Integer] -> Integer) (_ :: t0) where return :: forall (m :: * -> *) a. Monad m => a -> m a - pure (_ :: Integer -> [Integer] -> Integer) (_ :: t1) + pure (_ :: Integer -> [Integer] -> Integer) (_ :: t0) where pure :: forall (f :: * -> *) a. Applicative f => a -> f a - uncurry (_ :: a4 -> b3 -> Integer -> [Integer] -> Integer) - (_ :: (a4, b3)) + uncurry (_ :: a3 -> b3 -> Integer -> [Integer] -> Integer) + (_ :: (a3, b3)) where uncurry :: forall a b c. (a -> b -> c) -> (a, b) -> c - ($!) (_ :: a6 -> Integer -> [Integer] -> Integer) (_ :: a6) + ($!) (_ :: t0 -> Integer -> [Integer] -> Integer) (_ :: t0) where ($!) :: forall a b. (a -> b) -> a -> b diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 3189595fc3..b4ac6c9916 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -422,7 +422,8 @@ test('TcStaticPointers02', normal, compile, ['']) test('T8762', normal, compile, ['']) test('MutRec', normal, compile, ['']) test('T8856', normal, compile, ['']) -test('T9569a', normal, compile, ['']) +test('T9569a', normal, compile_fail, ['']) +test('T9569b', normal, compile, ['']) test('T9117', normal, compile, ['']) test('T9117_2', normal, compile, ['']) test('T9117_3', normal, compile, ['']) @@ -430,7 +431,7 @@ test('T9708', expect_broken(9708), compile, ['']) test('T9404', normal, compile, ['']) test('T9404b', normal, compile, ['']) test('T7220', normal, compile, ['']) -test('T7220a', normal, compile_fail, ['']) +test('T7220a', normal, compile, ['']) test('T9151', normal, compile, ['']) test('T9497a', normal, compile, ['-fdefer-typed-holes']) test('T9497b', normal, compile, ['-fdefer-typed-holes -fno-warn-typed-holes']) @@ -684,7 +685,7 @@ test('UnliftedNewtypesUnifySig', normal, compile, ['']) test('UnliftedNewtypesForall', normal, compile, ['']) test('UnlifNewUnify', normal, compile, ['']) test('UnliftedNewtypesLPFamily', normal, compile, ['']) -test('UnliftedNewtypesDifficultUnification', normal, compile, ['']) +test('UnliftedNewtypesDifficultUnification', when(compiler_debugged(), expect_broken(18300)), compile, ['']) test('T16832', normal, ghci_script, ['T16832.script']) test('T16995', normal, compile, ['']) test('T17007', normal, compile, ['']) @@ -711,3 +712,7 @@ test('T18129', expect_broken(18129), compile, ['']) test('T18185', normal, compile, ['']) test('ExplicitSpecificityA1', normal, compile, ['']) test('ExplicitSpecificityA2', normal, compile, ['']) +test('T17775-viewpats-a', normal, compile, ['']) +test('T17775-viewpats-b', normal, compile_fail, ['']) +test('T17775-viewpats-c', normal, compile_fail, ['']) +test('T17775-viewpats-d', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr index eb4b02f34e..8ea32fcde6 100644 --- a/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/subsumption_sort_hole_fits.stderr @@ -1,6 +1,6 @@ subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)] - • Found hole: _ :: [Char] -> [String] + • Found hole: _ :: String -> [String] • In the expression: _ In the expression: _ "hello, world" In an equation for ‘f’: f = _ "hello, world" @@ -22,7 +22,7 @@ subsumption_sort_hole_fits.hs:2:5: warning: [-Wtyped-holes (in -Wdefault)] (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 (and originally defined in ‘GHC.List’)) mempty :: forall a. Monoid a => a - with mempty @([Char] -> [String]) + with mempty @(String -> [String]) (imported from ‘Prelude’ at subsumption_sort_hole_fits.hs:1:1 (and originally defined in ‘GHC.Base’)) fail :: forall (m :: * -> *) a. MonadFail m => String -> m a diff --git a/testsuite/tests/typecheck/should_compile/tc145.hs b/testsuite/tests/typecheck/should_compile/tc145.hs index 8ab4a56321..9d1ada71a6 100644 --- a/testsuite/tests/typecheck/should_compile/tc145.hs +++ b/testsuite/tests/typecheck/should_compile/tc145.hs @@ -9,7 +9,7 @@ module ShouldCompile where -- implicit parameter to give -- r :: (?param::a) => a r :: Int -> ((?param :: a) => a) - r = error "urk" + r _ = error "urk" -- The unboxed tuple is OK because it is -- used on the right hand end of an arrow diff --git a/testsuite/tests/typecheck/should_compile/tc160.hs b/testsuite/tests/typecheck/should_compile/tc160.hs index 2425221aee..28e1b9e76b 100644 --- a/testsuite/tests/typecheck/should_compile/tc160.hs +++ b/testsuite/tests/typecheck/should_compile/tc160.hs @@ -7,8 +7,8 @@ module ShouldCompile where type Foo x = forall a. a -> x foo :: Foo (Foo ()) --- foo :: forall a b. a -> b -> () +-- foo :: forall a. a -> forall b. b -> () -- NOT forall a. a -> a -> () -foo = undefined +foo x = undefined baz = foo 'c' True diff --git a/testsuite/tests/typecheck/should_compile/tc208.hs b/testsuite/tests/typecheck/should_compile/tc208.hs index 8d9bb3636e..254eb82264 100644 --- a/testsuite/tests/typecheck/should_compile/tc208.hs +++ b/testsuite/tests/typecheck/should_compile/tc208.hs @@ -11,4 +11,4 @@ module ShouldCompile where type PPDoc = (?env :: Int) => Char f :: Char -> PPDoc -f = succ +f x = succ x diff --git a/testsuite/tests/typecheck/should_compile/tc210.hs b/testsuite/tests/typecheck/should_compile/tc210.hs index b4a377f761..9a0de89d4e 100644 --- a/testsuite/tests/typecheck/should_compile/tc210.hs +++ b/testsuite/tests/typecheck/should_compile/tc210.hs @@ -3,10 +3,10 @@ module ShouldCompile where f :: forall a. a -> forall b. b -> Int -f = error "urk" +f x = error "urk" -- Both these should be ok, but an early GHC 6.6 failed -g1 = [ (+) :: Int -> Int -> Int, f ] -g2 = [ f, (+) :: Int -> Int -> Int ] +g1 = [ (+) :: Int -> Int -> Int, \x -> f x ] +g2 = [ \x -> f x, (+) :: Int -> Int -> Int ] diff --git a/testsuite/tests/typecheck/should_compile/tc211.stderr b/testsuite/tests/typecheck/should_compile/tc211.stderr index ccc3da6fb0..bbffa16943 100644 --- a/testsuite/tests/typecheck/should_compile/tc211.stderr +++ b/testsuite/tests/typecheck/should_compile/tc211.stderr @@ -1,10 +1,11 @@ -tc211.hs:20:8: error: - • Couldn't match expected type ‘forall a. a -> a’ - with actual type ‘a9 -> a9’ - • In the expression: - (:) :: - (forall a. a -> a) -> [forall a. a -> a] -> [forall a. a -> a] +tc211.hs:21:17: error: + • Couldn't match expected type: a -> a + with actual type: forall a. a -> a + • In the first argument of ‘(:) :: + (forall a. a -> a) + -> [forall a. a -> a] -> [forall a. a -> a]’, namely + ‘(head foo)’ In the expression: ((:) :: (forall a. a -> a) -> [forall a. a -> a] -> [forall a. a -> a]) @@ -14,77 +15,3 @@ tc211.hs:20:8: error: = ((:) :: (forall a. a -> a) -> [forall a. a -> a] -> [forall a. a -> a]) (head foo) foo - -tc211.hs:25:8: error: - • Couldn't match type ‘a1 -> a1’ with ‘forall a. a -> a’ - Expected type: [forall a. a -> a] - Actual type: [a1 -> a1] - • In the expression: (head foo) : (tail foo) - In an equation for ‘barr’: barr = (head foo) : (tail foo) - -tc211.hs:25:20: error: - • Couldn't match type ‘forall a. a -> a’ with ‘a1 -> a1’ - Expected type: [a1 -> a1] - Actual type: [forall a. a -> a] - • In the second argument of ‘(:)’, namely ‘(tail foo)’ - In the expression: (head foo) : (tail foo) - In an equation for ‘barr’: barr = (head foo) : (tail foo) - -tc211.hs:62:18: error: - • Couldn't match expected type ‘forall a. a -> a’ - with actual type ‘a6 -> a6’ - • In the expression: - Cons :: - (forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a) - In an equation for ‘cons’: - cons - = Cons :: - (forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a) - In the expression: - let - cons - = Cons :: - (forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a) - in cons (\ x -> x) Nil - -tc211.hs:68:8: error: - • Couldn't match expected type ‘forall a. a -> a’ - with actual type ‘a0 -> a0’ - • In the expression: - Cons :: - ((forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a)) - In the expression: - (Cons :: - ((forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a))) - (\ x -> x) Nil - In an equation for ‘xs2’: - xs2 - = (Cons :: - ((forall a. a -> a) - -> List (forall a. a -> a) -> List (forall a. a -> a))) - (\ x -> x) Nil - -tc211.hs:76:9: error: - • Couldn't match type ‘forall a11. a11 -> a11’ with ‘a10 -> a10’ - Expected type: List (forall a. a -> a) - -> (forall a. a -> a) -> a10 -> a10 - Actual type: List (a10 -> a10) -> (a10 -> a10) -> a10 -> a10 - • In the expression: - foo2 :: - List (forall a. a -> a) -> (forall a. a -> a) -> (forall a. a -> a) - In the expression: - (foo2 :: - List (forall a. a -> a) - -> (forall a. a -> a) -> (forall a. a -> a)) - xs1 (\ x -> x) - In an equation for ‘bar4’: - bar4 - = (foo2 :: - List (forall a. a -> a) - -> (forall a. a -> a) -> (forall a. a -> a)) - xs1 (\ x -> x) diff --git a/testsuite/tests/typecheck/should_compile/twins.hs b/testsuite/tests/typecheck/should_compile/twins.hs index 99c77aa796..31d967aa59 100644 --- a/testsuite/tests/typecheck/should_compile/twins.hs +++ b/testsuite/tests/typecheck/should_compile/twins.hs @@ -22,7 +22,7 @@ gzip f x y else Nothing gzipWithM :: Monad m => GenericQ (GenericM m) -> GenericQ (GenericM m) -gzipWithM _ = error "urk" +gzipWithM _ _ = error "urk" orElse :: Maybe a -> Maybe a -> Maybe a orElse = error "urk" diff --git a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr index 1c108f719b..116a18f42f 100644 --- a/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr +++ b/testsuite/tests/typecheck/should_compile/valid_hole_fits.stderr @@ -225,7 +225,7 @@ valid_hole_fits.hs:38:10: warning: [-Wtyped-holes (in -Wdefault)] (and originally defined in ‘GHC.Base’)) valid_hole_fits.hs:41:8: warning: [-Wtyped-holes (in -Wdefault)] - • Found hole: _ :: [Char] -> IO () + • Found hole: _ :: String -> IO () • In the expression: _ In the expression: _ "hello, world" In an equation for ‘main’: main = _ "hello, world" @@ -242,7 +242,7 @@ valid_hole_fits.hs:41:8: warning: [-Wtyped-holes (in -Wdefault)] (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 (and originally defined in ‘System.IO’)) print :: forall a. Show a => a -> IO () - with print @[Char] + with print @String (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 (and originally defined in ‘System.IO’)) fail :: forall (m :: * -> *) a. MonadFail m => String -> m a @@ -250,6 +250,6 @@ valid_hole_fits.hs:41:8: warning: [-Wtyped-holes (in -Wdefault)] (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 (and originally defined in ‘Control.Monad.Fail’)) mempty :: forall a. Monoid a => a - with mempty @([Char] -> IO ()) + with mempty @(String -> IO ()) (imported from ‘Prelude’ at valid_hole_fits.hs:3:1-40 (and originally defined in ‘GHC.Base’)) diff --git a/testsuite/tests/typecheck/should_fail/ExpandSynsFail1.stderr b/testsuite/tests/typecheck/should_fail/ExpandSynsFail1.stderr index 0d5a9109a4..f592741d6f 100644 --- a/testsuite/tests/typecheck/should_fail/ExpandSynsFail1.stderr +++ b/testsuite/tests/typecheck/should_fail/ExpandSynsFail1.stderr @@ -1,11 +1,12 @@ + ExpandSynsFail1.hs:4:31: error: - Couldn't match type ‘Bool’ with ‘Int’ - Expected type: Foo - Actual type: Bar - Type synonyms expanded: - Expected type: Int - Actual type: Bool - In the second argument of ‘(==)’, namely ‘(False :: Bar)’ - In the second argument of ‘($)’, namely - ‘(1 :: Foo) == (False :: Bar)’ - In the expression: print $ (1 :: Foo) == (False :: Bar) + • Couldn't match type ‘Bool’ with ‘Int’ + Expected: Foo + Actual: Bar + Type synonyms expanded: + Expected type: Int + Actual type: Bool + • In the second argument of ‘(==)’, namely ‘(False :: Bar)’ + In the second argument of ‘($)’, namely + ‘(1 :: Foo) == (False :: Bar)’ + In the expression: print $ (1 :: Foo) == (False :: Bar) diff --git a/testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr b/testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr index 49e262cd3c..24aca978e3 100644 --- a/testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr +++ b/testsuite/tests/typecheck/should_fail/ExpandSynsFail2.stderr @@ -1,8 +1,8 @@ ExpandSynsFail2.hs:19:37: error: • Couldn't match type ‘Int’ with ‘Bool’ - Expected type: ST s Foo - Actual type: MyBarST s + Expected: ST s Foo + Actual: MyBarST s Type synonyms expanded: Expected type: ST s Int Actual type: ST s Bool diff --git a/testsuite/tests/typecheck/should_fail/ExpandSynsFail3.stderr b/testsuite/tests/typecheck/should_fail/ExpandSynsFail3.stderr index 65d91351f5..5179c4ddc1 100644 --- a/testsuite/tests/typecheck/should_fail/ExpandSynsFail3.stderr +++ b/testsuite/tests/typecheck/should_fail/ExpandSynsFail3.stderr @@ -1,11 +1,12 @@ + ExpandSynsFail3.hs:21:8: error: - Couldn't match type ‘Int’ with ‘Bool’ - Expected type: T (T3, T5, Int) - Actual type: T (T5, T3, Bool) - Type synonyms expanded: - Expected type: T (T3, T3, Int) - Actual type: T (T3, T3, Bool) - In the first argument of ‘f’, namely - ‘(undefined :: T (T5, T3, Bool))’ - In the expression: f (undefined :: T (T5, T3, Bool)) - In an equation for ‘a’: a = f (undefined :: T (T5, T3, Bool)) + • Couldn't match type ‘Bool’ with ‘Int’ + Expected: T (T3, T5, Int) + Actual: T (T5, T3, Bool) + Type synonyms expanded: + Expected type: T (T3, T3, Int) + Actual type: T (T3, T3, Bool) + • In the first argument of ‘f’, namely + ‘(undefined :: T (T5, T3, Bool))’ + In the expression: f (undefined :: T (T5, T3, Bool)) + In an equation for ‘a’: a = f (undefined :: T (T5, T3, Bool)) diff --git a/testsuite/tests/typecheck/should_fail/ExpandSynsFail4.stderr b/testsuite/tests/typecheck/should_fail/ExpandSynsFail4.stderr index bae53ce104..d11f72a758 100644 --- a/testsuite/tests/typecheck/should_fail/ExpandSynsFail4.stderr +++ b/testsuite/tests/typecheck/should_fail/ExpandSynsFail4.stderr @@ -1,7 +1,8 @@ + ExpandSynsFail4.hs:11:22: error: - Couldn't match type ‘Bool’ with ‘Int’ - Expected type: T Int - Actual type: T Bool - In the first argument of ‘f’, namely ‘(undefined :: T Bool)’ - In the second argument of ‘($)’, namely ‘f (undefined :: T Bool)’ - In the expression: putStrLn $ f (undefined :: T Bool) + • Couldn't match type ‘Bool’ with ‘Int’ + Expected: T Int + Actual: T Bool + • In the first argument of ‘f’, namely ‘(undefined :: T Bool)’ + In the second argument of ‘($)’, namely ‘f (undefined :: T Bool)’ + In the expression: putStrLn $ f (undefined :: T Bool) diff --git a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr index 613d92b837..255b3ad702 100644 --- a/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr +++ b/testsuite/tests/typecheck/should_fail/FrozenErrorTests.stderr @@ -1,7 +1,6 @@ FrozenErrorTests.hs:26:9: error: - • Occurs check: cannot construct the infinite type: a ~ [a] - arising from a use of ‘goo1’ + • Couldn't match type ‘a’ with ‘[a]’ arising from a use of ‘goo1’ • In the expression: goo1 False undefined In an equation for ‘test1’: test1 = goo1 False undefined • Relevant bindings include @@ -21,7 +20,8 @@ FrozenErrorTests.hs:30:9: error: In an equation for ‘test3’: test3 = goo1 False (goo2 undefined) FrozenErrorTests.hs:45:15: error: - • Couldn't match type ‘T2 c c’ with ‘M (T2 (T2 c c) c)’ + • Couldn't match type: T2 c c + with: M (T2 (T2 c c) c) arising from a use of ‘goo3’ • In the first argument of ‘goo4’, namely ‘(goo3 False undefined)’ In the expression: goo4 (goo3 False undefined) @@ -30,7 +30,8 @@ FrozenErrorTests.hs:45:15: error: test4 :: T2 (T2 c c) c (bound at FrozenErrorTests.hs:45:1) FrozenErrorTests.hs:46:9: error: - • Couldn't match type ‘T2 c c’ with ‘M (T2 (T2 c c) c)’ + • Couldn't match type: T2 c c + with: M (T2 (T2 c c) c) arising from a use of ‘goo3’ • In the expression: goo3 False (goo4 undefined) In an equation for ‘test5’: test5 = goo3 False (goo4 undefined) diff --git a/testsuite/tests/typecheck/should_fail/LevPolyBounded.stderr b/testsuite/tests/typecheck/should_fail/LevPolyBounded.stderr index afa8330765..114d3e962d 100644 --- a/testsuite/tests/typecheck/should_fail/LevPolyBounded.stderr +++ b/testsuite/tests/typecheck/should_fail/LevPolyBounded.stderr @@ -1,10 +1,16 @@ LevPolyBounded.hs:10:15: error: • Expected a type, but ‘a’ has kind ‘TYPE r’ + ‘r’ is a rigid type variable bound by + the class declaration for ‘XBounded’ + at LevPolyBounded.hs:9:27 • In the type signature: LevPolyBounded.minBound :: a In the class declaration for ‘XBounded’ LevPolyBounded.hs:11:15: error: • Expected a type, but ‘a’ has kind ‘TYPE r’ + ‘r’ is a rigid type variable bound by + the class declaration for ‘XBounded’ + at LevPolyBounded.hs:9:27 • In the type signature: LevPolyBounded.maxBound :: a In the class declaration for ‘XBounded’ diff --git a/testsuite/tests/typecheck/should_fail/T10194.stderr b/testsuite/tests/typecheck/should_fail/T10194.stderr index aeaad79440..60374ffe16 100644 --- a/testsuite/tests/typecheck/should_fail/T10194.stderr +++ b/testsuite/tests/typecheck/should_fail/T10194.stderr @@ -1,7 +1,9 @@ T10194.hs:7:8: error: - • Cannot instantiate unification variable ‘b0’ + • Couldn't match type ‘b0’ with ‘X’ + Expected: (X -> c) -> (a -> X) -> a -> c + Actual: (b0 -> c) -> (a -> b0) -> a -> c + Cannot instantiate unification variable ‘b0’ with a type involving polytypes: X - GHC doesn't yet support impredicative polymorphism • In the expression: (.) In an equation for ‘comp’: comp = (.) diff --git a/testsuite/tests/typecheck/should_fail/T10619.stderr b/testsuite/tests/typecheck/should_fail/T10619.stderr index 9d34750675..481a08a20c 100644 --- a/testsuite/tests/typecheck/should_fail/T10619.stderr +++ b/testsuite/tests/typecheck/should_fail/T10619.stderr @@ -1,8 +1,11 @@ T10619.hs:9:15: error: - • Couldn't match type ‘forall a. a -> a’ with ‘b -> b’ - Expected type: (b -> b) -> b -> b - Actual type: (forall a. a -> a) -> b -> b + • Couldn't match type ‘p’ with ‘forall b. b -> b’ + Expected: p -> p + Actual: (forall a. a -> a) -> forall b. b -> b + ‘p’ is a rigid type variable bound by + the inferred type of foo :: p1 -> p -> p + at T10619.hs:(8,1)-(10,20) • In the expression: (\ x -> x) :: (forall a. a -> a) -> forall b. b -> b In the expression: @@ -17,12 +20,15 @@ T10619.hs:9:15: error: else \ y -> y • Relevant bindings include - foo :: p -> (b -> b) -> b -> b (bound at T10619.hs:8:1) + foo :: p1 -> p -> p (bound at T10619.hs:8:1) T10619.hs:14:15: error: - • Couldn't match type ‘forall a. a -> a’ with ‘b -> b’ - Expected type: (b -> b) -> b -> b - Actual type: (forall a. a -> a) -> b -> b + • Couldn't match type ‘p’ with ‘forall a. a -> a’ + Expected: p -> p + Actual: (forall a. a -> a) -> forall b. b -> b + ‘p’ is a rigid type variable bound by + the inferred type of bar :: p1 -> p -> p + at T10619.hs:(12,1)-(14,66) • In the expression: (\ x -> x) :: (forall a. a -> a) -> forall b. b -> b In the expression: @@ -37,26 +43,32 @@ T10619.hs:14:15: error: else ((\ x -> x) :: (forall a. a -> a) -> forall b. b -> b) • Relevant bindings include - bar :: p -> (b -> b) -> b -> b (bound at T10619.hs:12:1) + bar :: p1 -> p -> p (bound at T10619.hs:12:1) T10619.hs:16:13: error: - • Couldn't match type ‘forall a. a -> a’ with ‘b -> b’ - Expected type: (b -> b) -> b -> b - Actual type: (forall a. a -> a) -> b -> b + • Couldn't match type ‘p’ with ‘forall b. b -> b’ + Expected: p -> p + Actual: (forall a. a -> a) -> forall b. b -> b + ‘p’ is a rigid type variable bound by + the inferred type of baz :: Bool -> p -> p + at T10619.hs:(16,1)-(17,19) • In the expression: (\ x -> x) :: (forall a. a -> a) -> forall b. b -> b In an equation for ‘baz’: baz True = (\ x -> x) :: (forall a. a -> a) -> forall b. b -> b • Relevant bindings include - baz :: Bool -> (b -> b) -> b -> b (bound at T10619.hs:16:1) + baz :: Bool -> p -> p (bound at T10619.hs:16:1) T10619.hs:20:14: error: - • Couldn't match type ‘forall a. a -> a’ with ‘b -> b’ - Expected type: (b -> b) -> b -> b - Actual type: (forall a. a -> a) -> b -> b + • Couldn't match type ‘p’ with ‘forall a. a -> a’ + Expected: p -> p + Actual: (forall a. a -> a) -> forall b. b -> b + ‘p’ is a rigid type variable bound by + the inferred type of quux :: Bool -> p -> p + at T10619.hs:(19,1)-(20,64) • In the expression: (\ x -> x) :: (forall a. a -> a) -> forall b. b -> b In an equation for ‘quux’: quux True = (\ x -> x) :: (forall a. a -> a) -> forall b. b -> b • Relevant bindings include - quux :: Bool -> (b -> b) -> b -> b (bound at T10619.hs:19:1) + quux :: Bool -> p -> p (bound at T10619.hs:19:1) diff --git a/testsuite/tests/typecheck/should_fail/T10715b.stderr b/testsuite/tests/typecheck/should_fail/T10715b.stderr index 8c7f370273..99875bbcf5 100644 --- a/testsuite/tests/typecheck/should_fail/T10715b.stderr +++ b/testsuite/tests/typecheck/should_fail/T10715b.stderr @@ -1,8 +1,12 @@ T10715b.hs:7:7: error: - Occurs check: cannot construct the infinite type: b ~ [b] - arising from a use of ‘coerce’ - In the first argument of ‘asTypeOf’, namely ‘coerce’ - In the expression: coerce `asTypeOf` head - In an equation for ‘foo’: foo = coerce `asTypeOf` head - Relevant bindings include foo :: [b] -> b (bound at T10715b.hs:7:1) + • Couldn't match representation of type ‘b’ with that of ‘[b]’ + arising from a use of ‘coerce’ + ‘b’ is a rigid type variable bound by + the inferred type of foo :: [b] -> b + at T10715b.hs:7:1-28 + • In the first argument of ‘asTypeOf’, namely ‘coerce’ + In the expression: coerce `asTypeOf` head + In an equation for ‘foo’: foo = coerce `asTypeOf` head + • Relevant bindings include + foo :: [b] -> b (bound at T10715b.hs:7:1) diff --git a/testsuite/tests/typecheck/should_fail/T10971d.stderr b/testsuite/tests/typecheck/should_fail/T10971d.stderr index 5cf339bd8d..93dce724d0 100644 --- a/testsuite/tests/typecheck/should_fail/T10971d.stderr +++ b/testsuite/tests/typecheck/should_fail/T10971d.stderr @@ -1,18 +1,21 @@ T10971d.hs:4:14: error: - • Couldn't match expected type ‘[a0]’ with actual type ‘Maybe a2’ + • Couldn't match expected type: [a0] + with actual type: Maybe a3 • In the first argument of ‘f’, namely ‘(Just 1)’ In the second argument of ‘($)’, namely ‘f (Just 1)’ In a stmt of a 'do' block: print $ f (Just 1) T10971d.hs:5:19: error: - • Couldn't match expected type ‘[b1]’ with actual type ‘Maybe a3’ + • Couldn't match expected type: [b0] + with actual type: Maybe a4 • In the second argument of ‘g’, namely ‘(Just 5)’ In the second argument of ‘($)’, namely ‘g (+ 1) (Just 5)’ In a stmt of a 'do' block: print $ g (+ 1) (Just 5) T10971d.hs:6:23: error: - • Couldn't match expected type ‘[b0]’ with actual type ‘Maybe a1’ + • Couldn't match expected type: [a2] + with actual type: Maybe a1 • In the second argument of ‘h’, namely ‘Nothing’ In the second argument of ‘($)’, namely ‘h (const 5) Nothing’ In a stmt of a 'do' block: print $ h (const 5) Nothing diff --git a/testsuite/tests/typecheck/should_fail/T11514.stderr b/testsuite/tests/typecheck/should_fail/T11514.stderr index 62acf15b73..dd940a36b1 100644 --- a/testsuite/tests/typecheck/should_fail/T11514.stderr +++ b/testsuite/tests/typecheck/should_fail/T11514.stderr @@ -1,8 +1,9 @@ T11514.hs:6:7: error: - • Cannot instantiate unification variable ‘a0’ + • Couldn't match expected type ‘(Show a => a -> a) -> ()’ + with actual type ‘a0’ + Cannot instantiate unification variable ‘a0’ with a type involving polytypes: (Show a => a -> a) -> () - GHC doesn't yet support impredicative polymorphism • In the expression: undefined In an equation for ‘foo’: foo = undefined • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/T11672.stderr b/testsuite/tests/typecheck/should_fail/T11672.stderr index 16eb31042f..a0f8d7e36c 100644 --- a/testsuite/tests/typecheck/should_fail/T11672.stderr +++ b/testsuite/tests/typecheck/should_fail/T11672.stderr @@ -4,8 +4,8 @@ T11672.hs:9:10: error: When matching types a0 :: Symbol Int -> Bool :: * - Expected type: Proxy a0 - Actual type: Proxy (Int -> Bool) + Expected: Proxy a0 + Actual: Proxy (Int -> Bool) • In the first argument of ‘f’, namely ‘(Proxy :: Proxy (Int -> Bool))’ In the expression: f (Proxy :: Proxy (Int -> Bool)) diff --git a/testsuite/tests/typecheck/should_fail/T12170a.stderr b/testsuite/tests/typecheck/should_fail/T12170a.stderr index c1e4bdcecb..a8f349df43 100644 --- a/testsuite/tests/typecheck/should_fail/T12170a.stderr +++ b/testsuite/tests/typecheck/should_fail/T12170a.stderr @@ -1,9 +1,9 @@ -T12170a.hs:20:7: error: +T12170a.hs:20:35: error: • Couldn't match type ‘Ref m0’ with ‘IORef’ - Expected type: IO (Ref m0 (f0 ())) - Actual type: IO (Ref IO (f0 ())) + Expected: IORef (f0 ()) -> m0 (f0 ()) + Actual: Ref m0 (f0 ()) -> m0 (f0 ()) The type variable ‘m0’ is ambiguous - • In the first argument of ‘(>>=)’, namely ‘newRef (pure ())’ + • In the second argument of ‘(.)’, namely ‘readRef’ + In the second argument of ‘(>>=)’, namely ‘join . readRef’ In the expression: newRef (pure ()) >>= join . readRef - In an equation for ‘foo’: foo = newRef (pure ()) >>= join . readRef
\ No newline at end of file diff --git a/testsuite/tests/typecheck/should_fail/T12373.stderr b/testsuite/tests/typecheck/should_fail/T12373.stderr index a2568d75f9..20137fbdad 100644 --- a/testsuite/tests/typecheck/should_fail/T12373.stderr +++ b/testsuite/tests/typecheck/should_fail/T12373.stderr @@ -4,8 +4,8 @@ T12373.hs:10:19: error: When matching types a0 :: * MVar# RealWorld a1 :: TYPE 'UnliftedRep - Expected type: (# State# RealWorld, a0 #) - Actual type: (# State# RealWorld, MVar# RealWorld a1 #) + Expected: (# State# RealWorld, a0 #) + Actual: (# State# RealWorld, MVar# RealWorld a1 #) • In the expression: newMVar# rw In the first argument of ‘IO’, namely ‘(\ rw -> newMVar# rw)’ In the first argument of ‘(>>)’, namely ‘IO (\ rw -> newMVar# rw)’ diff --git a/testsuite/tests/typecheck/should_fail/T12563.stderr b/testsuite/tests/typecheck/should_fail/T12563.stderr index e6619aa1da..f141a23e96 100644 --- a/testsuite/tests/typecheck/should_fail/T12563.stderr +++ b/testsuite/tests/typecheck/should_fail/T12563.stderr @@ -1,8 +1,9 @@ T12563.hs:7:15: error: - • Cannot instantiate unification variable ‘p0’ + • Couldn't match expected type ‘(forall a. f0 a) -> f0 r0’ + with actual type ‘p0’ + Cannot instantiate unification variable ‘p0’ with a type involving polytypes: (forall a. f0 a) -> f0 r0 - GHC doesn't yet support impredicative polymorphism • In the first argument of ‘foo’, namely ‘g’ In the expression: foo g In the expression: \ g -> foo g diff --git a/testsuite/tests/typecheck/should_fail/T12589.stderr b/testsuite/tests/typecheck/should_fail/T12589.stderr index 80ea5edb80..5f359090d9 100644 --- a/testsuite/tests/typecheck/should_fail/T12589.stderr +++ b/testsuite/tests/typecheck/should_fail/T12589.stderr @@ -2,10 +2,11 @@ T12589.hs:13:3: error: Variable not in scope: (&) :: t0 -> t1 -> t T12589.hs:13:5: error: - • Cannot instantiate unification variable ‘t1’ + • Couldn't match expected type ‘t1’ + with actual type ‘(forall a. Bounded a => f0 a) -> h0 f0 xs0’ + Cannot instantiate unification variable ‘t1’ with a type involving polytypes: (forall a. Bounded a => f0 a) -> h0 f0 xs0 - GHC doesn't yet support impredicative polymorphism • In the second argument of ‘(&)’, namely ‘hcpure (Proxy @Bounded)’ In the expression: minBound & hcpure (Proxy @Bounded) In an equation for ‘a’: a = minBound & hcpure (Proxy @Bounded) diff --git a/testsuite/tests/typecheck/should_fail/T12648.stderr b/testsuite/tests/typecheck/should_fail/T12648.stderr index 227bc6773e..f13b6c1cd0 100644 --- a/testsuite/tests/typecheck/should_fail/T12648.stderr +++ b/testsuite/tests/typecheck/should_fail/T12648.stderr @@ -1,12 +1,12 @@ T12648.hs:76:2: error: • Couldn't match type ‘a’ with ‘()’ + Expected: m a + Actual: m () ‘a’ is a rigid type variable bound by the type signature for: f :: forall (m :: * -> *) a. MonadBaseUnlift m IO => m a at T12648.hs:71:1-34 - Expected type: m a - Actual type: m () • In a stmt of a 'do' block: return () In the expression: do _ <- askUnliftBase diff --git a/testsuite/tests/typecheck/should_fail/T12906.stderr b/testsuite/tests/typecheck/should_fail/T12906.stderr index c74fd97bbc..f1f245c912 100644 --- a/testsuite/tests/typecheck/should_fail/T12906.stderr +++ b/testsuite/tests/typecheck/should_fail/T12906.stderr @@ -3,8 +3,9 @@ T12906.hs:1:1: error: The IO action ‘main’ is not defined in module ‘Main’ T12906.hs:2:7: error: - • Couldn't match type ‘IO ()’ with ‘[Char]’ - Expected type: String - Actual type: IO () + • Couldn't match type: IO () + with: [Char] + Expected: String + Actual: IO () • In the expression: print (reverse s + 1) In an equation for ‘x’: x s = print (reverse s + 1) diff --git a/testsuite/tests/typecheck/should_fail/T12921.stderr b/testsuite/tests/typecheck/should_fail/T12921.stderr index d38ccf22b9..f10faf2751 100644 --- a/testsuite/tests/typecheck/should_fail/T12921.stderr +++ b/testsuite/tests/typecheck/should_fail/T12921.stderr @@ -10,7 +10,7 @@ T12921.hs:4:1: error: instance Data.Data.Data Ordering -- Defined in ‘Data.Data’ instance Data.Data.Data Integer -- Defined in ‘Data.Data’ ...plus 15 others - ...plus 47 instances involving out-of-scope types + ...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" #-} diff --git a/testsuite/tests/typecheck/should_fail/T13292.stderr b/testsuite/tests/typecheck/should_fail/T13292.stderr index adb2738e69..217c5d4a39 100644 --- a/testsuite/tests/typecheck/should_fail/T13292.stderr +++ b/testsuite/tests/typecheck/should_fail/T13292.stderr @@ -17,7 +17,7 @@ T13292a.hs:4:12: warning: [-Wdeferred-type-errors (in -Wdefault)] T13292.hs:6:1: warning: [-Wdeferred-type-errors (in -Wdefault)] • Couldn't match type ‘GHC.Types.Any’ with ‘IO’ - Expected type: IO () - Actual type: GHC.Types.Any () + Expected: IO () + Actual: GHC.Types.Any () • In the expression: main When checking the type of the IO action ‘main’ diff --git a/testsuite/tests/typecheck/should_fail/T13311.stderr b/testsuite/tests/typecheck/should_fail/T13311.stderr index d739d2173c..e858a6037e 100644 --- a/testsuite/tests/typecheck/should_fail/T13311.stderr +++ b/testsuite/tests/typecheck/should_fail/T13311.stderr @@ -1,7 +1,7 @@ T13311.hs:9:3: error: - • Couldn't match expected type ‘IO a0’ - with actual type ‘Maybe a1 -> Maybe b0’ + • Couldn't match expected type: IO a0 + with actual type: Maybe a1 -> Maybe b0 • Probable cause: ‘f’ is applied to too few arguments In a stmt of a 'do' block: f In the expression: diff --git a/testsuite/tests/typecheck/should_fail/T13320.stderr b/testsuite/tests/typecheck/should_fail/T13320.stderr index afafdb3074..4442069d15 100644 --- a/testsuite/tests/typecheck/should_fail/T13320.stderr +++ b/testsuite/tests/typecheck/should_fail/T13320.stderr @@ -1,6 +1,7 @@ T13320.hs:32:21: error: - • Couldn't match type ‘X_Var ξ’ with ‘TermX ξ’ + • Couldn't match type: X_Var ξ + with: TermX ξ arising from a use of ‘genTerm’ • In the first argument of ‘sized’, namely ‘genTerm’ In the expression: sized genTerm diff --git a/testsuite/tests/typecheck/should_fail/T13530.stderr b/testsuite/tests/typecheck/should_fail/T13530.stderr index 139c1b0f34..4b540f297c 100644 --- a/testsuite/tests/typecheck/should_fail/T13530.stderr +++ b/testsuite/tests/typecheck/should_fail/T13530.stderr @@ -4,7 +4,7 @@ T13530.hs:11:7: error: When matching types a0 :: * Int# :: TYPE 'IntRep - Expected type: (# Int#, Int# #) - Actual type: (# Int#, a0 #) + Expected: (# Int#, Int# #) + Actual: (# Int#, a0 #) • In the expression: g x In an equation for ‘f’: f x = g x diff --git a/testsuite/tests/typecheck/should_fail/T13610.stderr b/testsuite/tests/typecheck/should_fail/T13610.stderr index 0755ce9371..c04687988c 100644 --- a/testsuite/tests/typecheck/should_fail/T13610.stderr +++ b/testsuite/tests/typecheck/should_fail/T13610.stderr @@ -4,8 +4,8 @@ T13610.hs:11:15: error: When matching types a :: * Weak# () :: TYPE 'UnliftedRep - Expected type: (# State# RealWorld, a #) - Actual type: (# State# RealWorld, Weak# () #) + Expected: (# State# RealWorld, a #) + Actual: (# State# RealWorld, Weak# () #) • In the expression: mkWeakNoFinalizer# double () s In the first argument of ‘IO’, namely ‘(\ s -> mkWeakNoFinalizer# double () s)’ diff --git a/testsuite/tests/typecheck/should_fail/T13909.stderr b/testsuite/tests/typecheck/should_fail/T13909.stderr index 599be5a445..0cbae70733 100644 --- a/testsuite/tests/typecheck/should_fail/T13909.stderr +++ b/testsuite/tests/typecheck/should_fail/T13909.stderr @@ -1,5 +1,7 @@ T13909.hs:11:18: error: • Expected kind ‘k0’, but ‘Hm’ has kind ‘forall k -> k -> *’ + Cannot instantiate unification variable ‘k0’ + with a kind involving polytypes: forall k -> k -> * • In the first argument of ‘HasName’, namely ‘Hm’ In the instance declaration for ‘HasName Hm’ diff --git a/testsuite/tests/typecheck/should_fail/T14605.stderr b/testsuite/tests/typecheck/should_fail/T14605.stderr index 09181c6ee8..04d8b5a67d 100644 --- a/testsuite/tests/typecheck/should_fail/T14605.stderr +++ b/testsuite/tests/typecheck/should_fail/T14605.stderr @@ -1,8 +1,8 @@ T14605.hs:14:13: error: - • Couldn't match representation of type ‘x1’ with that of ‘()’ + • Couldn't match representation of type ‘x’ with that of ‘()’ arising from a use of ‘coerce’ - ‘x1’ is a rigid type variable bound by + ‘x’ is a rigid type variable bound by the type () at T14605.hs:14:1-49 • In the expression: coerce @(forall x. ()) @(forall x. x) diff --git a/testsuite/tests/typecheck/should_fail/T14618.stderr b/testsuite/tests/typecheck/should_fail/T14618.stderr index 8faa64c25e..2faf4a925b 100644 --- a/testsuite/tests/typecheck/should_fail/T14618.stderr +++ b/testsuite/tests/typecheck/should_fail/T14618.stderr @@ -1,16 +1,12 @@ T14618.hs:6:14: error: - • Couldn't match type ‘a’ with ‘b’ - ‘a’ is a rigid type variable bound by - the type signature for: - safeCoerce :: forall a b. a -> b - at T14618.hs:5:1-20 + • Couldn't match type ‘b’ with ‘forall c. a’ + Expected: a -> b + Actual: a -> forall c. a ‘b’ is a rigid type variable bound by the type signature for: safeCoerce :: forall a b. a -> b at T14618.hs:5:1-20 - Expected type: a -> b - Actual type: b -> b • In the expression: f' In an equation for ‘safeCoerce’: safeCoerce diff --git a/testsuite/tests/typecheck/should_fail/T14884.stderr b/testsuite/tests/typecheck/should_fail/T14884.stderr index cb85da14a5..f454bb5625 100644 --- a/testsuite/tests/typecheck/should_fail/T14884.stderr +++ b/testsuite/tests/typecheck/should_fail/T14884.stderr @@ -1,6 +1,6 @@ T14884.hs:4:5: error: - • Found hole: _ :: (a0 -> IO ()) -> [Char] -> IO () + • Found hole: _ :: (a0 -> IO ()) -> String -> IO () Where: ‘a0’ is an ambiguous type variable • In the expression: _ In the expression: _ print "abc" @@ -20,15 +20,15 @@ T14884.hs:4:5: error: (imported from ‘Prelude’ at T14884.hs:1:8-13 (and originally defined in ‘Data.Foldable’)) ($) :: forall a b. (a -> b) -> a -> b - with ($) @'GHC.Types.LiftedRep @[Char] @(IO ()) + with ($) @'GHC.Types.LiftedRep @String @(IO ()) (imported from ‘Prelude’ at T14884.hs:1:8-13 (and originally defined in ‘GHC.Base’)) ($!) :: forall a b. (a -> b) -> a -> b - with ($!) @'GHC.Types.LiftedRep @[Char] @(IO ()) + with ($!) @'GHC.Types.LiftedRep @String @(IO ()) (imported from ‘Prelude’ at T14884.hs:1:8-13 (and originally defined in ‘GHC.Base’)) id :: forall a. a -> a - with id @([Char] -> IO ()) + with id @(String -> IO ()) (imported from ‘Prelude’ at T14884.hs:1:8-13 (and originally defined in ‘GHC.Base’)) diff --git a/testsuite/tests/typecheck/should_fail/T14904a.stderr b/testsuite/tests/typecheck/should_fail/T14904a.stderr index ea92de3465..c0e2b84a80 100644 --- a/testsuite/tests/typecheck/should_fail/T14904a.stderr +++ b/testsuite/tests/typecheck/should_fail/T14904a.stderr @@ -1,5 +1,7 @@ T14904a.hs:9:6: error: • Expected kind ‘forall (a :: k1). g a’, but ‘f’ has kind ‘k0’ + Cannot instantiate unification variable ‘k0’ + with a kind involving polytypes: forall (a :: k1). g a • In the first argument of ‘F’, namely ‘(f :: forall a. g a)’ In the type family declaration for ‘F’ diff --git a/testsuite/tests/typecheck/should_fail/T14904b.stderr b/testsuite/tests/typecheck/should_fail/T14904b.stderr index fff6942af1..83a9ec15fa 100644 --- a/testsuite/tests/typecheck/should_fail/T14904b.stderr +++ b/testsuite/tests/typecheck/should_fail/T14904b.stderr @@ -1,6 +1,8 @@ T14904b.hs:9:7: error: • Expected kind ‘forall (a :: k1). g a’, but ‘f’ has kind ‘k0’ + Cannot instantiate unification variable ‘k0’ + with a kind involving polytypes: forall (a :: k1). g a • In the first argument of ‘F’, namely ‘((f :: forall a. g a) :: forall a. g a)’ In the type family declaration for ‘F’ diff --git a/testsuite/tests/typecheck/should_fail/T15330.stderr b/testsuite/tests/typecheck/should_fail/T15330.stderr index cef80452a1..c2bf2447cc 100644 --- a/testsuite/tests/typecheck/should_fail/T15330.stderr +++ b/testsuite/tests/typecheck/should_fail/T15330.stderr @@ -1,13 +1,17 @@ T15330.hs:11:6: error: - • Couldn't match expected type ‘Proxy (T 'True)’ - with actual type ‘[Char]’ + • Couldn't match type: [Char] + with: Proxy (T 'True) + Expected: Proxy (T 'True) + Actual: String • In the expression: "foo" In an equation for ‘f1’: f1 = "foo" T15330.hs:15:6: error: - • Couldn't match expected type ‘Proxy (t 'True)’ - with actual type ‘[Char]’ + • Couldn't match type: [Char] + with: Proxy (t 'True) + Expected: Proxy (t 'True) + Actual: String • In the expression: "foo" In an equation for ‘f2’: f2 = "foo" • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/T15361.stderr b/testsuite/tests/typecheck/should_fail/T15361.stderr index 4b8c23ebf2..1520bc3982 100644 --- a/testsuite/tests/typecheck/should_fail/T15361.stderr +++ b/testsuite/tests/typecheck/should_fail/T15361.stderr @@ -6,6 +6,8 @@ T15361.hs:13:13: error: HRefl :: forall {k1} (a :: k1). a :~~: a, in an equation for ‘foo’ at T15361.hs:13:5-9 + Expected: a :~~: c + Actual: a :~~: a ‘a’ is a rigid type variable bound by the type signature for: foo :: forall a b c. (a :~~: b) -> a :~~: c @@ -14,8 +16,6 @@ T15361.hs:13:13: error: the type signature for: foo :: forall a b c. (a :~~: b) -> a :~~: c at T15361.hs:(11,1)-(12,27) - Expected type: a :~~: c - Actual type: a :~~: a • In the expression: HRefl In an equation for ‘foo’: foo HRefl = HRefl • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/T15438.hs b/testsuite/tests/typecheck/should_fail/T15438.hs index 0f995389a0..975afa3e9e 100644 --- a/testsuite/tests/typecheck/should_fail/T15438.hs +++ b/testsuite/tests/typecheck/should_fail/T15438.hs @@ -4,5 +4,7 @@ module T15438 where class C a b +-- With simple subsumption (#17775) we +-- no longer get an ambiguity check here foo :: (forall a b. C a b => b -> b) -> Int -foo = error "urk" +foo x = error "urk" diff --git a/testsuite/tests/typecheck/should_fail/T15438.stderr b/testsuite/tests/typecheck/should_fail/T15438.stderr deleted file mode 100644 index 473d5dcc98..0000000000 --- a/testsuite/tests/typecheck/should_fail/T15438.stderr +++ /dev/null @@ -1,11 +0,0 @@ - -T15438.hs:7:8: error: - • Could not deduce (C a0 b) - from the context: C a b - bound by a type expected by the context: - forall a b. C a b => b -> b - at T15438.hs:7:8-43 - The type variable ‘a0’ is ambiguous - • In the ambiguity check for ‘foo’ - To defer the ambiguity check to use sites, enable AllowAmbiguousTypes - In the type signature: foo :: (forall a b. C a b => b -> b) -> Int diff --git a/testsuite/tests/typecheck/should_fail/T15629.stderr b/testsuite/tests/typecheck/should_fail/T15629.stderr index ac307ed9d5..09d59fdf62 100644 --- a/testsuite/tests/typecheck/should_fail/T15629.stderr +++ b/testsuite/tests/typecheck/should_fail/T15629.stderr @@ -1,39 +1,19 @@ T15629.hs:26:37: error: - • Expected kind ‘x1 ~> F x1 ab1’, - but ‘F1Sym :: x ~> F x z’ has kind ‘x1 ~> F x1 z1’ + • Couldn't match kind ‘z’ with ‘ab’ + Expected kind ‘x ~> F x ab’, + but ‘F1Sym :: x ~> F x z’ has kind ‘x ~> F x z’ + ‘z’ is a rigid type variable bound by + ‘forall z ab. + Proxy ((Comp (F1Sym :: x ~> F x z) F2Sym) :: F x ab ~> F x ab)’ + at T15629.hs:26:17 + ‘ab’ is a rigid type variable bound by + ‘forall z ab. + Proxy ((Comp (F1Sym :: x ~> F x z) F2Sym) :: F x ab ~> F x ab)’ + at T15629.hs:26:19-20 • In the first argument of ‘Comp’, namely ‘(F1Sym :: x ~> F x z)’ In the first argument of ‘Proxy’, namely ‘((Comp (F1Sym :: x ~> F x z) F2Sym) :: F x ab ~> F x ab)’ In the type signature: g :: forall z ab. Proxy ((Comp (F1Sym :: x ~> F x z) F2Sym) :: F x ab ~> F x ab) - -T15629.hs:27:9: error: - • Couldn't match kind ‘z1’ with ‘ab1’ - ‘z1’ is a rigid type variable bound by - the type signature for: - g :: forall z1 ab1. Proxy (Comp F1Sym F2Sym) - at T15629.hs:26:5-84 - ‘ab1’ is a rigid type variable bound by - the type signature for: - g :: forall z1 ab1. Proxy (Comp F1Sym F2Sym) - at T15629.hs:26:5-84 - When matching types - f0 :: x ~> F x ab - F1Sym :: TyFun x1 (F x1 z1) -> * - Expected type: Proxy (Comp F1Sym F2Sym) - Actual type: Proxy (Comp f0 F2Sym) - • In the expression: sg Proxy Proxy - In an equation for ‘g’: g = sg Proxy Proxy - In an equation for ‘f’: - f _ - = () - where - g :: - forall z ab. - Proxy ((Comp (F1Sym :: x ~> F x z) F2Sym) :: F x ab ~> F x ab) - g = sg Proxy Proxy - • Relevant bindings include - g :: Proxy (Comp F1Sym F2Sym) (bound at T15629.hs:27:5) - f :: Proxy x1 -> () (bound at T15629.hs:24:1) diff --git a/testsuite/tests/typecheck/should_fail/T15648.stderr b/testsuite/tests/typecheck/should_fail/T15648.stderr index 192d8d15e8..7de4bc9e18 100644 --- a/testsuite/tests/typecheck/should_fail/T15648.stderr +++ b/testsuite/tests/typecheck/should_fail/T15648.stderr @@ -1,9 +1,9 @@ T15648.hs:23:21: error: - • Couldn't match type ‘(a0 GHC.Prim.~# b0) -> JankyEquality a0 b0’ - with ‘JankyEquality a a’ - Expected type: JankyEquality a b - Actual type: (a0 GHC.Prim.~# b0) -> JankyEquality a0 b0 + • Couldn't match type: (a0 GHC.Prim.~# b0) -> JankyEquality a0 b0 + with: JankyEquality a a + Expected: JankyEquality a b + Actual: (a0 GHC.Prim.~# b0) -> JankyEquality a0 b0 • Probable cause: ‘Jank’ is applied to too few arguments In the expression: Jank In an equation for ‘legitToJank’: legitToJank Legit = Jank @@ -12,9 +12,9 @@ T15648.hs:23:21: error: (bound at T15648.hs:23:1) T15648.hs:30:10: error: - • Couldn't match expected type ‘(a GHC.Prim.~# b) - -> b GHC.Prim.~# a’ - with actual type ‘b GHC.Prim.~# a’ + • Couldn't match expected type: (a GHC.Prim.~# b) + -> b GHC.Prim.~# a + with actual type: b GHC.Prim.~# a • In the expression: unJank $ legitToJank $ mkLegit @b @a In an equation for ‘ueqSym’: ueqSym = unJank $ legitToJank $ mkLegit @b @a diff --git a/testsuite/tests/typecheck/should_fail/T15801.stderr b/testsuite/tests/typecheck/should_fail/T15801.stderr index e74972332c..2209d72ab8 100644 --- a/testsuite/tests/typecheck/should_fail/T15801.stderr +++ b/testsuite/tests/typecheck/should_fail/T15801.stderr @@ -1,6 +1,6 @@ T15801.hs:52:10: error: - • Couldn't match representation of type ‘UnOp op_a -> UnOp b’ - with that of ‘op_a --> b’ + • Couldn't match representation of type: UnOp op_a -> UnOp b + with that of: op_a --> b arising from the superclasses of an instance declaration • In the instance declaration for ‘OpRíki (Op (*))’ diff --git a/testsuite/tests/typecheck/should_fail/T16074.stderr b/testsuite/tests/typecheck/should_fail/T16074.stderr index cd04542641..10b263efcb 100644 --- a/testsuite/tests/typecheck/should_fail/T16074.stderr +++ b/testsuite/tests/typecheck/should_fail/T16074.stderr @@ -1,6 +1,8 @@ T16074.hs:10:7: error: • Couldn't match type ‘a’ with ‘b’ + Expected: TYPE a :~: TYPE b + Actual: TYPE a :~: TYPE a ‘a’ is a rigid type variable bound by the type signature for: foo :: * :~: * @@ -9,8 +11,6 @@ T16074.hs:10:7: error: the type signature for: foo :: * :~: * at T16074.hs:9:1-24 - Expected type: TYPE a :~: TYPE b - Actual type: TYPE a :~: TYPE a • In the expression: Refl In an equation for ‘foo’: foo = Refl • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/T16204c.stderr b/testsuite/tests/typecheck/should_fail/T16204c.stderr index 48d63785ad..6ad532a4ea 100644 --- a/testsuite/tests/typecheck/should_fail/T16204c.stderr +++ b/testsuite/tests/typecheck/should_fail/T16204c.stderr @@ -4,8 +4,8 @@ T16204c.hs:16:8: error: When matching types a0 :: Rep a :: * - Expected type: Sing a - Actual type: Sing a0 + Expected: Sing a + Actual: Sing a0 • In the first argument of ‘id’, namely ‘sTo’ In the expression: id sTo In an equation for ‘x’: x = id sTo diff --git a/testsuite/tests/typecheck/should_fail/T16517.stderr b/testsuite/tests/typecheck/should_fail/T16517.stderr index 8d20665afc..1e17286cff 100644 --- a/testsuite/tests/typecheck/should_fail/T16517.stderr +++ b/testsuite/tests/typecheck/should_fail/T16517.stderr @@ -1,6 +1,10 @@ T16517.hs:5:29: error: • Expected kind ‘k’, but ‘a’ has kind ‘k0’ + because kind variable ‘k’ would escape its scope + This (rigid, skolem) kind variable is bound by + the class declaration for ‘C’ + at T16517.hs:5:22-35 • In the first argument of ‘Proxy’, namely ‘(a :: k)’ In the type signature: m :: Proxy (a :: k) In the class declaration for ‘C’ diff --git a/testsuite/tests/typecheck/should_fail/T17077.stderr b/testsuite/tests/typecheck/should_fail/T17077.stderr index 3d05adc3c3..3f27d19c70 100644 --- a/testsuite/tests/typecheck/should_fail/T17077.stderr +++ b/testsuite/tests/typecheck/should_fail/T17077.stderr @@ -1,5 +1,7 @@ T17077.hs:7:13: error: • Expected kind ‘forall (k :: k1). a’, but ‘z’ has kind ‘k0’ + Cannot instantiate unification variable ‘k0’ + with a kind involving polytypes: forall (k2 :: k1). a • In the first argument of ‘Proxy’, namely ‘(z :: forall k. a)’ In the type signature: t :: Proxy (z :: forall k. a) diff --git a/testsuite/tests/typecheck/should_fail/T17775.hs b/testsuite/tests/typecheck/should_fail/T17775.hs new file mode 100644 index 0000000000..b10f0725f5 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17775.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE RankNTypes #-} + +module T1 where + + + +g :: Int -> Char + +g _ = 'a' + + + +f :: Int -> Show Int => () +f = g diff --git a/testsuite/tests/typecheck/should_fail/T17775.stderr b/testsuite/tests/typecheck/should_fail/T17775.stderr new file mode 100644 index 0000000000..2dc0448ab8 --- /dev/null +++ b/testsuite/tests/typecheck/should_fail/T17775.stderr @@ -0,0 +1,7 @@ + +T17775.hs:15:5: error: + • Couldn't match type ‘Char’ with ‘Show Int => ()’ + Expected: Int -> Show Int => () + Actual: Int -> Char + • In the expression: g + In an equation for ‘f’: f = g diff --git a/testsuite/tests/typecheck/should_fail/T18127a.stderr b/testsuite/tests/typecheck/should_fail/T18127a.stderr index ee354f7467..60dcb3e121 100644 --- a/testsuite/tests/typecheck/should_fail/T18127a.stderr +++ b/testsuite/tests/typecheck/should_fail/T18127a.stderr @@ -1,31 +1,33 @@ T18127a.hs:5:5: error: - • Cannot instantiate unification variable ‘a1’ + • Couldn't match expected type ‘(forall a. a) -> ()’ + with actual type ‘a1’ + Cannot instantiate unification variable ‘a1’ with a type involving polytypes: (forall a. a) -> () - GHC doesn't yet support impredicative polymorphism • In the expression: undefined In an equation for ‘a’: a = undefined T18127a.hs:8:5: error: - • Cannot instantiate unification variable ‘a3’ + • Couldn't match expected type ‘(Show a => a) -> ()’ + with actual type ‘a3’ + Cannot instantiate unification variable ‘a3’ with a type involving polytypes: (Show a => a) -> () - GHC doesn't yet support impredicative polymorphism • In the expression: undefined In an equation for ‘b’: b = undefined • Relevant bindings include b :: (Show a => a) -> () (bound at T18127a.hs:8:1) T18127a.hs:12:5: error: - • Cannot instantiate unification variable ‘a0’ + • Couldn't match expected type ‘C -> ()’ with actual type ‘a0’ + Cannot instantiate unification variable ‘a0’ with a type involving polytypes: C -> () - GHC doesn't yet support impredicative polymorphism • In the expression: undefined In an equation for ‘c’: c = undefined T18127a.hs:16:5: error: - • Cannot instantiate unification variable ‘a2’ + • Couldn't match expected type ‘D a -> ()’ with actual type ‘a2’ + Cannot instantiate unification variable ‘a2’ with a type involving polytypes: D a -> () - GHC doesn't yet support impredicative polymorphism • In the expression: undefined In an equation for ‘d’: d = undefined • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/T1899.stderr b/testsuite/tests/typecheck/should_fail/T1899.stderr index 9fe71027c0..eb84cba7b4 100644 --- a/testsuite/tests/typecheck/should_fail/T1899.stderr +++ b/testsuite/tests/typecheck/should_fail/T1899.stderr @@ -1,12 +1,12 @@ T1899.hs:14:36: error: • Couldn't match type ‘a’ with ‘Proposition a0’ + Expected: [Proposition a0] + Actual: [a] ‘a’ is a rigid type variable bound by the type signature for: transRHS :: forall a. [a] -> Int -> Constraint a at T1899.hs:9:2-39 - Expected type: [Proposition a0] - Actual type: [a] • In the first argument of ‘Auxiliary’, namely ‘varSet’ In the first argument of ‘Prop’, namely ‘(Auxiliary varSet)’ In the expression: Prop (Auxiliary varSet) diff --git a/testsuite/tests/typecheck/should_fail/T2414.stderr b/testsuite/tests/typecheck/should_fail/T2414.stderr index bbbf5fce6a..1d89247489 100644 --- a/testsuite/tests/typecheck/should_fail/T2414.stderr +++ b/testsuite/tests/typecheck/should_fail/T2414.stderr @@ -1,8 +1,8 @@ T2414.hs:9:13: error: - • Occurs check: cannot construct the infinite type: b0 ~ (Bool, b0) - Expected type: b0 -> Maybe (Bool, b0) - Actual type: (Bool, b0) -> Maybe (Bool, b0) + • Couldn't match type ‘b0’ with ‘(Bool, b0)’ + Expected: b0 -> Maybe (Bool, b0) + Actual: b0 -> Maybe b0 • In the first argument of ‘unfoldr’, namely ‘Just’ In the expression: unfoldr Just In an equation for ‘f’: f = unfoldr Just diff --git a/testsuite/tests/typecheck/should_fail/T2534.stderr b/testsuite/tests/typecheck/should_fail/T2534.stderr index 4e469f3cfd..24cee873c8 100644 --- a/testsuite/tests/typecheck/should_fail/T2534.stderr +++ b/testsuite/tests/typecheck/should_fail/T2534.stderr @@ -1,9 +1,9 @@ -T2534.hs:3:13: error: - • Couldn't match type ‘[b]’ with ‘a0 -> [b]’ - Expected type: [a0] -> [b] -> [b] - Actual type: [a0] -> (a0 -> [b]) -> [b] - • In the first argument of ‘foldr’, namely ‘(>>=)’ +T2534.hs:3:19: error: + • Couldn't match expected type: a -> a -> b + with actual type: [a0] + • In the second argument of ‘foldr’, namely ‘[]’ In the expression: foldr (>>=) [] [] In an equation for ‘foo’: foo = foldr (>>=) [] [] - • Relevant bindings include foo :: [b] (bound at T2534.hs:3:1) + • Relevant bindings include + foo :: a -> a -> b (bound at T2534.hs:3:1) diff --git a/testsuite/tests/typecheck/should_fail/T2714.hs b/testsuite/tests/typecheck/should_fail/T2714.hs index 52d67e38ec..7f6a12fb2c 100644 --- a/testsuite/tests/typecheck/should_fail/T2714.hs +++ b/testsuite/tests/typecheck/should_fail/T2714.hs @@ -5,7 +5,7 @@ module T2714 where f :: ((a -> b) -> b) -> (forall c. c -> a) -f = ffmap +f x = ffmap x ffmap :: Functor f => (p->q) -> f p -> f q ffmap = error "urk" diff --git a/testsuite/tests/typecheck/should_fail/T2714.stderr b/testsuite/tests/typecheck/should_fail/T2714.stderr index 9b3fc34c52..215ad495cf 100644 --- a/testsuite/tests/typecheck/should_fail/T2714.stderr +++ b/testsuite/tests/typecheck/should_fail/T2714.stderr @@ -1,13 +1,14 @@ -T2714.hs:8:5: error: +T2714.hs:8:7: error: • Couldn't match type ‘c’ with ‘f0 (a -> b)’ + Expected: c -> a + Actual: f0 (a -> b) -> f0 b ‘c’ is a rigid type variable bound by - the type signature for: - f :: ((a -> b) -> b) -> forall c. c -> a - at T2714.hs:8:1-9 - Expected type: ((a -> b) -> b) -> c -> a - Actual type: ((a -> b) -> b) -> f0 (a -> b) -> f0 b - • In the expression: ffmap - In an equation for ‘f’: f = ffmap + a type expected by the context: + forall c. c -> a + at T2714.hs:8:1-13 + • In the expression: ffmap x + In an equation for ‘f’: f x = ffmap x • Relevant bindings include + x :: (a -> b) -> b (bound at T2714.hs:8:3) f :: ((a -> b) -> b) -> forall c. c -> a (bound at T2714.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/T3102.hs b/testsuite/tests/typecheck/should_fail/T3102.hs index 910ac06ee9..f7d9dad344 100644 --- a/testsuite/tests/typecheck/should_fail/T3102.hs +++ b/testsuite/tests/typecheck/should_fail/T3102.hs @@ -8,8 +8,8 @@ f :: (forall a. a -> String) -> Int f _ = 3 result :: Int -result = f t - +result = f (\x -> t x) + -- Simple subsumption (#17775) requires eta expansion here -- This should work. -- Elaborated result = f (/\a. \x:a. t @a (\p::Int. x)) diff --git a/testsuite/tests/typecheck/should_fail/T3406.stderr b/testsuite/tests/typecheck/should_fail/T3406.stderr index 69834d15f6..70fffee3ac 100644 --- a/testsuite/tests/typecheck/should_fail/T3406.stderr +++ b/testsuite/tests/typecheck/should_fail/T3406.stderr @@ -1,8 +1,8 @@ T3406.hs:11:28: error: • Couldn't match type ‘Int’ with ‘a -> ItemColID a b’ - Expected type: a -> ItemColID a b - Actual type: ItemColID a1 b1 + Expected: a -> ItemColID a b + Actual: ItemColID a1 b1 • In the expression: x :: ItemColID a b In an equation for ‘get’: get (x :: ItemColID a b) = x :: ItemColID a b diff --git a/testsuite/tests/typecheck/should_fail/T3592.stderr b/testsuite/tests/typecheck/should_fail/T3592.stderr index ab03985faa..bc3f774ecc 100644 --- a/testsuite/tests/typecheck/should_fail/T3592.stderr +++ b/testsuite/tests/typecheck/should_fail/T3592.stderr @@ -1,12 +1,14 @@ T3592.hs:8:5: error: - • No instance for (Show a) arising from a use of ‘show’ - Possible fix: - add (Show a) to the context of - the type signature for: - f :: forall a. T a -> String + • Couldn't match type ‘a0’ with ‘T a’ + Expected: T a -> String + Actual: a0 -> String + Cannot instantiate unification variable ‘a0’ + with a type involving polytypes: T a • In the expression: show In an equation for ‘f’: f = show + • Relevant bindings include + f :: T a -> String (bound at T3592.hs:8:1) T3592.hs:11:7: error: • No instance for (Show a) arising from a use of ‘show’ diff --git a/testsuite/tests/typecheck/should_fail/T3613.stderr b/testsuite/tests/typecheck/should_fail/T3613.stderr index a221a95c17..8183ff981e 100644 --- a/testsuite/tests/typecheck/should_fail/T3613.stderr +++ b/testsuite/tests/typecheck/should_fail/T3613.stderr @@ -1,8 +1,8 @@ T3613.hs:14:20: error: • Couldn't match type ‘IO’ with ‘Maybe’ - Expected type: Maybe b - Actual type: IO b + Expected: Maybe b + Actual: IO b • In the first argument of ‘fooThen’, namely ‘(bar >> undefined)’ In the expression: fooThen (bar >> undefined) In the expression: @@ -10,8 +10,8 @@ T3613.hs:14:20: error: T3613.hs:17:24: error: • Couldn't match type ‘IO’ with ‘Maybe’ - Expected type: Maybe () - Actual type: IO () + Expected: Maybe () + Actual: IO () • In a stmt of a 'do' block: bar In the first argument of ‘fooThen’, namely ‘(do bar diff --git a/testsuite/tests/typecheck/should_fail/T3950.stderr b/testsuite/tests/typecheck/should_fail/T3950.stderr index e0a3526000..f71fd5d501 100644 --- a/testsuite/tests/typecheck/should_fail/T3950.stderr +++ b/testsuite/tests/typecheck/should_fail/T3950.stderr @@ -4,8 +4,8 @@ T3950.hs:15:8: error: When matching types w :: (* -> * -> *) -> * Sealed :: (* -> *) -> * - Expected type: Maybe (w (Id p)) - Actual type: Maybe (Sealed (Id p0 x0)) + Expected: Maybe (w (Id p)) + Actual: Maybe (Sealed (Id p0 x0)) • In the expression: Just rp' In an equation for ‘rp’: rp _ diff --git a/testsuite/tests/typecheck/should_fail/T502.stderr b/testsuite/tests/typecheck/should_fail/T502.stderr index ba5f6d157a..dd6b97d132 100644 --- a/testsuite/tests/typecheck/should_fail/T502.stderr +++ b/testsuite/tests/typecheck/should_fail/T502.stderr @@ -1,7 +1,7 @@ T502.hs:8:11: error: - • Couldn't match expected type ‘(a0, Int)’ - with actual type ‘(# Int, Int #)’ + • Couldn't match expected type: (a0, Int) + with actual type: (# Int, Int #) • In the first argument of ‘snd’, namely ‘foo’ In the expression: snd foo In an equation for ‘bar’: diff --git a/testsuite/tests/typecheck/should_fail/T5246.stderr b/testsuite/tests/typecheck/should_fail/T5246.stderr index 54d340cc5e..ea4185af33 100644 --- a/testsuite/tests/typecheck/should_fail/T5246.stderr +++ b/testsuite/tests/typecheck/should_fail/T5246.stderr @@ -1,11 +1,10 @@ T5246.hs:11:10: error: - Couldn't match type ‘[Char]’ with ‘Int’ - arising from a functional dependency between constraints: - ‘?x::Int’ arising from a use of ‘foo’ at T5246.hs:11:10-12 - ‘?x::[Char]’ - arising from the implicit-parameter binding for ?x - at T5246.hs:(10,7)-(11,12) - In the expression: foo - In the expression: let ?x = "hello" in foo - In an equation for ‘bar’: bar = let ?x = "hello" in foo + • Couldn't match type ‘[Char]’ with ‘Int’ + arising from a functional dependency between constraints: + ‘?x::Int’ arising from a use of ‘foo’ at T5246.hs:11:10-12 + ‘?x::String’ + arising from the implicit-parameter binding for ?x at T5246.hs:(10,7)-(11,12) + • In the expression: foo + In the expression: let ?x = "hello" in foo + In an equation for ‘bar’: bar = let ?x = "hello" in foo diff --git a/testsuite/tests/typecheck/should_fail/T6001.stderr b/testsuite/tests/typecheck/should_fail/T6001.stderr index 57d55dc336..a7a8274923 100644 --- a/testsuite/tests/typecheck/should_fail/T6001.stderr +++ b/testsuite/tests/typecheck/should_fail/T6001.stderr @@ -1,10 +1,10 @@ -T6001.hs:8:18: - Couldn't match type ‘Integer’ with ‘Int’ - Expected type: Integer -> DayKind - Actual type: Int -> DayKind - When checking that instance signature for ‘fromInteger’ - is more general than its signature in the class - Instance sig: Int -> DayKind - Class sig: Integer -> DayKind - In the instance declaration for ‘Num DayKind’ +T6001.hs:8:18: error: + • Couldn't match type ‘Int’ with ‘Integer’ + Expected: Integer -> DayKind + Actual: Int -> DayKind + • When checking that instance signature for ‘fromInteger’ + is more general than its signature in the class + Instance sig: Int -> DayKind + Class sig: Integer -> DayKind + In the instance declaration for ‘Num DayKind’ diff --git a/testsuite/tests/typecheck/should_fail/T6069.stderr b/testsuite/tests/typecheck/should_fail/T6069.stderr index e2d3ef4d91..c70939fee5 100644 --- a/testsuite/tests/typecheck/should_fail/T6069.stderr +++ b/testsuite/tests/typecheck/should_fail/T6069.stderr @@ -1,24 +1,27 @@ T6069.hs:13:15: error: - • Couldn't match type ‘ST s0 Int’ with ‘forall s. ST s a0’ - Expected type: ST s0 Int -> a0 - Actual type: (forall s. ST s a0) -> a0 + • Couldn't match type: forall s. ST s b0 + with: ST s0 Int + Expected: ST s0 Int -> b0 + Actual: (forall s. ST s b0) -> b0 • In the second argument of ‘(.)’, namely ‘runST’ In the expression: print . runST In the expression: (print . runST) fourty_two T6069.hs:14:15: error: - • Couldn't match type ‘ST s1 Int’ with ‘forall s. ST s a1’ - Expected type: ST s1 Int -> a1 - Actual type: (forall s. ST s a1) -> a1 + • Couldn't match type: forall s. ST s b1 + with: ST s1 Int + Expected: ST s1 Int -> b1 + Actual: (forall s. ST s b1) -> b1 • In the second argument of ‘(.)’, namely ‘runST’ In the first argument of ‘($)’, namely ‘(print . runST)’ In the expression: (print . runST) $ fourty_two T6069.hs:15:16: error: - • Couldn't match type ‘ST s2 Int’ with ‘forall s. ST s a2’ - Expected type: ST s2 Int -> a2 - Actual type: (forall s. ST s a2) -> a2 + • Couldn't match type: forall s. ST s b2 + with: ST s2 Int + Expected: ST s2 Int -> b2 + Actual: (forall s. ST s b2) -> b2 • In the second argument of ‘(.)’, namely ‘runST’ In the first argument of ‘($)’, namely ‘(print . runST)’ In the expression: (print . runST) $ diff --git a/testsuite/tests/typecheck/should_fail/T7264.stderr b/testsuite/tests/typecheck/should_fail/T7264.stderr index 71c99c5614..4d2a153306 100644 --- a/testsuite/tests/typecheck/should_fail/T7264.stderr +++ b/testsuite/tests/typecheck/should_fail/T7264.stderr @@ -1,10 +1,11 @@ T7264.hs:13:19: error: • Couldn't match type ‘a’ with ‘forall r. r -> String’ + Expected: a -> Foo + Actual: (forall r. r -> String) -> Foo ‘a’ is a rigid type variable bound by - the inferred type of mkFoo2 :: a -> Maybe Foo at T7264.hs:13:1-32 - Expected type: a -> Foo - Actual type: (forall r. r -> String) -> Foo + the inferred type of mkFoo2 :: a -> Maybe Foo + at T7264.hs:13:1-32 • In the first argument of ‘mmap’, namely ‘Foo’ In the expression: mmap Foo (Just val) In an equation for ‘mkFoo2’: mkFoo2 val = mmap Foo (Just val) diff --git a/testsuite/tests/typecheck/should_fail/T7368.stderr b/testsuite/tests/typecheck/should_fail/T7368.stderr index 54c12f76f7..ef100b1fa4 100644 --- a/testsuite/tests/typecheck/should_fail/T7368.stderr +++ b/testsuite/tests/typecheck/should_fail/T7368.stderr @@ -4,8 +4,8 @@ T7368.hs:3:10: error: When matching types b0 :: * Maybe :: * -> * - Expected type: a0 -> b0 - Actual type: c0 Maybe + Expected: a0 -> b0 + Actual: c0 Maybe • In the first argument of ‘b’, namely ‘(l Nothing)’ In the expression: b (l Nothing) In an equation for ‘f’: f = b (l Nothing) diff --git a/testsuite/tests/typecheck/should_fail/T7368a.stderr b/testsuite/tests/typecheck/should_fail/T7368a.stderr index 93b8b04378..2fcb92f209 100644 --- a/testsuite/tests/typecheck/should_fail/T7368a.stderr +++ b/testsuite/tests/typecheck/should_fail/T7368a.stderr @@ -4,8 +4,8 @@ T7368a.hs:8:6: error: When matching types f :: * -> * Bad :: (* -> *) -> * - Expected type: f (Bad f) - Actual type: Bad w0 + Expected: f (Bad f) + Actual: Bad w0 • In the pattern: Bad x In an equation for ‘fun’: fun (Bad x) = True • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/T7696.stderr b/testsuite/tests/typecheck/should_fail/T7696.stderr index 41f2296797..945312094d 100644 --- a/testsuite/tests/typecheck/should_fail/T7696.stderr +++ b/testsuite/tests/typecheck/should_fail/T7696.stderr @@ -1,7 +1,7 @@ T7696.hs:7:6: error: • Couldn't match type ‘m0 a0’ with ‘()’ - Expected type: ((), w ()) - Actual type: (m0 a0, t0 m0) + Expected: ((), w ()) + Actual: (m0 a0, t0 m0) • In the expression: f1 In an equation for ‘f2’: f2 = f1 diff --git a/testsuite/tests/typecheck/should_fail/T7734.stderr b/testsuite/tests/typecheck/should_fail/T7734.stderr index 05002109ab..bf199cb4c2 100644 --- a/testsuite/tests/typecheck/should_fail/T7734.stderr +++ b/testsuite/tests/typecheck/should_fail/T7734.stderr @@ -1,6 +1,6 @@ T7734.hs:4:13: error: - • Occurs check: cannot construct the infinite type: t ~ t -> t1 + • Couldn't match expected type ‘t’ with actual type ‘t -> t1’ • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘f’: x `f` y = x x @@ -9,7 +9,7 @@ T7734.hs:4:13: error: f :: (t -> t1) -> p -> t1 (bound at T7734.hs:4:3) T7734.hs:5:13: error: - • Occurs check: cannot construct the infinite type: t ~ t -> t1 + • Couldn't match expected type ‘t’ with actual type ‘t -> t1’ • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘&’: (&) x y = x x diff --git a/testsuite/tests/typecheck/should_fail/T7851.stderr b/testsuite/tests/typecheck/should_fail/T7851.stderr index 0e1964e35c..289df8ad40 100644 --- a/testsuite/tests/typecheck/should_fail/T7851.stderr +++ b/testsuite/tests/typecheck/should_fail/T7851.stderr @@ -1,7 +1,7 @@ T7851.hs:5:10: error: - • Couldn't match expected type ‘IO a0’ - with actual type ‘a1 -> IO ()’ + • Couldn't match expected type: IO a0 + with actual type: a1 -> IO () • Probable cause: ‘print’ is applied to too few arguments In a stmt of a 'do' block: print In the expression: diff --git a/testsuite/tests/typecheck/should_fail/T7856.stderr b/testsuite/tests/typecheck/should_fail/T7856.stderr index e6fe2bd42f..a5a3a4bff1 100644 --- a/testsuite/tests/typecheck/should_fail/T7856.stderr +++ b/testsuite/tests/typecheck/should_fail/T7856.stderr @@ -1,11 +1,11 @@ -T7856.hs:4:7: - Couldn't match expected type ‘String -> IO ()’ - with actual type ‘IO ()’ - Possible cause: ‘sequence_’ is applied to too many arguments - In the expression: sequence_ lst - In an equation for ‘tmp’: - tmp - = sequence_ lst - where - lst = [putStrLn "hi"] +T7856.hs:4:7: error: + • Couldn't match expected type: String -> IO () + with actual type: IO () + • Possible cause: ‘sequence_’ is applied to too many arguments + In the expression: sequence_ lst + In an equation for ‘tmp’: + tmp + = sequence_ lst + where + lst = [putStrLn "hi"] diff --git a/testsuite/tests/typecheck/should_fail/T7869.stderr b/testsuite/tests/typecheck/should_fail/T7869.stderr index 7e01868526..15e9cc4658 100644 --- a/testsuite/tests/typecheck/should_fail/T7869.stderr +++ b/testsuite/tests/typecheck/should_fail/T7869.stderr @@ -1,6 +1,8 @@ T7869.hs:3:12: error: • Couldn't match type ‘b1’ with ‘b’ + Expected: [a1] -> b1 + Actual: [a] -> b ‘b1’ is a rigid type variable bound by an expression type signature: forall a1 b1. [a1] -> b1 @@ -8,8 +10,6 @@ T7869.hs:3:12: error: ‘b’ is a rigid type variable bound by the inferred type of f :: [a] -> b at T7869.hs:3:1-27 - Expected type: [a1] -> b1 - Actual type: [a] -> b • In the expression: f x In the expression: (\ x -> f x) :: [a] -> b In an equation for ‘f’: f = (\ x -> f x) :: [a] -> b diff --git a/testsuite/tests/typecheck/should_fail/T8030.stderr b/testsuite/tests/typecheck/should_fail/T8030.stderr index c1ff38b685..623eabbdbc 100644 --- a/testsuite/tests/typecheck/should_fail/T8030.stderr +++ b/testsuite/tests/typecheck/should_fail/T8030.stderr @@ -1,6 +1,7 @@ T8030.hs:9:3: error: - • Couldn't match expected type ‘Pr a’ with actual type ‘Pr a0’ + • Couldn't match expected type: Pr a + with actual type: Pr a0 NB: ‘Pr’ is a non-injective type family The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘op1’ @@ -10,9 +11,10 @@ T8030.hs:9:3: error: In the class declaration for ‘C’ T8030.hs:10:3: error: - • Couldn't match type ‘Pr a0’ with ‘Pr a’ - Expected type: Pr a -> Pr a -> Pr a - Actual type: Pr a0 -> Pr a0 -> Pr a0 + • Couldn't match type: Pr a0 + with: Pr a + Expected: Pr a -> Pr a -> Pr a + Actual: Pr a0 -> Pr a0 -> Pr a0 NB: ‘Pr’ is a non-injective type family The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘op2’ diff --git a/testsuite/tests/typecheck/should_fail/T8034.stderr b/testsuite/tests/typecheck/should_fail/T8034.stderr index cce73f355a..8f64538554 100644 --- a/testsuite/tests/typecheck/should_fail/T8034.stderr +++ b/testsuite/tests/typecheck/should_fail/T8034.stderr @@ -1,8 +1,9 @@ T8034.hs:6:3: error: - • Couldn't match type ‘F a0’ with ‘F a’ - Expected type: F a -> F a - Actual type: F a0 -> F a0 + • Couldn't match type: F a0 + with: F a + Expected: F a -> F a + Actual: F a0 -> F a0 NB: ‘F’ is a non-injective type family The type variable ‘a0’ is ambiguous • In the ambiguity check for ‘foo’ diff --git a/testsuite/tests/typecheck/should_fail/T8044.stderr b/testsuite/tests/typecheck/should_fail/T8044.stderr index 78ef035af8..2069f5f281 100644 --- a/testsuite/tests/typecheck/should_fail/T8044.stderr +++ b/testsuite/tests/typecheck/should_fail/T8044.stderr @@ -1,9 +1,9 @@ -T8044.hs:16:13: - Couldn't match type ‘Frob a’ with ‘Char’ - Expected type: X (Frob a) - Actual type: X Char - In the expression: XChar - In an equation for ‘frob’: frob _ = XChar - Relevant bindings include - frob :: X a -> X (Frob a) (bound at T8044.hs:15:1) +T8044.hs:16:13: error: + • Couldn't match type ‘Frob a’ with ‘Char’ + Expected: X (Frob a) + Actual: X Char + • In the expression: XChar + In an equation for ‘frob’: frob _ = XChar + • Relevant bindings include + frob :: X a -> X (Frob a) (bound at T8044.hs:15:1) diff --git a/testsuite/tests/typecheck/should_fail/T8142.stderr b/testsuite/tests/typecheck/should_fail/T8142.stderr index 25d60d1aff..a9f4590e44 100644 --- a/testsuite/tests/typecheck/should_fail/T8142.stderr +++ b/testsuite/tests/typecheck/should_fail/T8142.stderr @@ -1,8 +1,9 @@ T8142.hs:6:10: error: - • Couldn't match type ‘Nu ((,) a0)’ with ‘c -> f c’ - Expected type: (c -> f c) -> c -> f c - Actual type: Nu ((,) a0) -> Nu g0 + • Couldn't match type: Nu ((,) a0) + with: c -> f c + Expected: (c -> f c) -> c -> f c + Actual: Nu ((,) a0) -> Nu f0 The type variable ‘a0’ is ambiguous • In the expression: h In an equation for ‘tracer’: @@ -14,11 +15,12 @@ T8142.hs:6:10: error: tracer :: (c -> f c) -> c -> f c (bound at T8142.hs:6:1) T8142.hs:6:57: error: - • Couldn't match type ‘Nu ((,) a)’ with ‘g (Nu ((,) a))’ - Expected type: Nu ((,) a) -> (a, g (Nu ((,) a))) - Actual type: Nu ((,) a) -> (a, Nu ((,) a)) + • Couldn't match type: Nu ((,) a) + with: f1 (Nu ((,) a)) + Expected: Nu ((,) a) -> (a, f1 (Nu ((,) a))) + Actual: Nu ((,) a) -> (a, Nu ((,) a)) • In the second argument of ‘(.)’, namely ‘out’ In the expression: (\ (_, b) -> ((outI . fmap h) b)) . out In an equation for ‘h’: h = (\ (_, b) -> ((outI . fmap h) b)) . out • Relevant bindings include - h :: Nu ((,) a) -> Nu g (bound at T8142.hs:6:18) + h :: Nu ((,) a) -> Nu f1 (bound at T8142.hs:6:18) diff --git a/testsuite/tests/typecheck/should_fail/T8428.stderr b/testsuite/tests/typecheck/should_fail/T8428.stderr index ce83c3efe5..2668bb45fd 100644 --- a/testsuite/tests/typecheck/should_fail/T8428.stderr +++ b/testsuite/tests/typecheck/should_fail/T8428.stderr @@ -1,8 +1,9 @@ T8428.hs:11:19: error: - • Couldn't match type ‘(forall s. ST s) a’ with ‘forall s. ST s a’ - Expected type: IdentityT (forall s. ST s) a -> forall s. ST s a - Actual type: IdentityT (forall s. ST s) a -> (forall s. ST s) a + • Couldn't match type: (forall s. ST s) a + with: forall s. ST s a + Expected: IdentityT (forall s. ST s) a -> forall s. ST s a + Actual: IdentityT (forall s. ST s) a -> (forall s. ST s) a • In the second argument of ‘(.)’, namely ‘runIdentityT’ In the expression: runST . runIdentityT In an equation for ‘runIdST’: runIdST = runST . runIdentityT diff --git a/testsuite/tests/typecheck/should_fail/T8450.stderr b/testsuite/tests/typecheck/should_fail/T8450.stderr index 7503f4d37e..a75d0703c6 100644 --- a/testsuite/tests/typecheck/should_fail/T8450.stderr +++ b/testsuite/tests/typecheck/should_fail/T8450.stderr @@ -1,12 +1,12 @@ T8450.hs:8:20: error: • Couldn't match type ‘a’ with ‘Bool’ + Expected: Either Bool () + Actual: Either a () ‘a’ is a rigid type variable bound by the type signature for: run :: forall a. a at T8450.hs:7:1-18 - Expected type: Either Bool () - Actual type: Either a () • In the second argument of ‘($)’, namely ‘(undefined :: Either a ())’ In the expression: runEffect $ (undefined :: Either a ()) diff --git a/testsuite/tests/typecheck/should_fail/T8603.stderr b/testsuite/tests/typecheck/should_fail/T8603.stderr index 29c5d9df12..4776253f52 100644 --- a/testsuite/tests/typecheck/should_fail/T8603.stderr +++ b/testsuite/tests/typecheck/should_fail/T8603.stderr @@ -1,8 +1,9 @@ T8603.hs:33:17: error: - • Couldn't match type ‘RV a1’ with ‘StateT s RV a0’ - Expected type: [a2] -> StateT s RV a0 - Actual type: t0 ((->) [a1]) (RV a1) + • Couldn't match type: RV a1 + with: StateT s RV a0 + Expected: [a2] -> StateT s RV a0 + Actual: t0 ((->) [a1]) (RV a1) • The function ‘lift’ is applied to two value arguments, but its type ‘([a1] -> RV a1) -> t0 ((->) [a1]) (RV a1)’ has only one diff --git a/testsuite/tests/typecheck/should_fail/T9201.stderr b/testsuite/tests/typecheck/should_fail/T9201.stderr index 5e8f0173c5..16a183bef0 100644 --- a/testsuite/tests/typecheck/should_fail/T9201.stderr +++ b/testsuite/tests/typecheck/should_fail/T9201.stderr @@ -1,6 +1,12 @@ T9201.hs:6:17: error: • Expected kind ‘x’, but ‘a’ has kind ‘y’ + ‘y’ is a rigid type variable bound by + the class declaration for ‘MonoidalCCC’ + at T9201.hs:5:30 + ‘x’ is a rigid type variable bound by + the class declaration for ‘MonoidalCCC’ + at T9201.hs:5:25 • In the first argument of ‘f’, namely ‘a’ In the second argument of ‘d’, namely ‘(f a)’ In the type signature: ret :: d a (f a) diff --git a/testsuite/tests/typecheck/should_fail/T9260.stderr b/testsuite/tests/typecheck/should_fail/T9260.stderr index f55f474904..2a6c0ac16c 100644 --- a/testsuite/tests/typecheck/should_fail/T9260.stderr +++ b/testsuite/tests/typecheck/should_fail/T9260.stderr @@ -1,8 +1,8 @@ T9260.hs:12:14: error: • Couldn't match type ‘1’ with ‘0’ - Expected type: Fin 0 - Actual type: Fin (0 + 1) + Expected: Fin 0 + Actual: Fin (0 + 1) • In the first argument of ‘Fsucc’, namely ‘Fzero’ In the expression: Fsucc Fzero In an equation for ‘test’: test = Fsucc Fzero diff --git a/testsuite/tests/typecheck/should_fail/T9318.stderr b/testsuite/tests/typecheck/should_fail/T9318.stderr index c637788a7e..0a87c4a1e2 100644 --- a/testsuite/tests/typecheck/should_fail/T9318.stderr +++ b/testsuite/tests/typecheck/should_fail/T9318.stderr @@ -1,7 +1,7 @@ T9318.hs:12:5: error: • Couldn't match type ‘Bool’ with ‘Char’ - Expected type: F Int - Actual type: Char + Expected: F Int + Actual: Char • In the pattern: 'x' In an equation for ‘bar’: bar 'x' = () diff --git a/testsuite/tests/typecheck/should_fail/T9605.stderr b/testsuite/tests/typecheck/should_fail/T9605.stderr index 683265c26b..6132c9538e 100644 --- a/testsuite/tests/typecheck/should_fail/T9605.stderr +++ b/testsuite/tests/typecheck/should_fail/T9605.stderr @@ -1,8 +1,8 @@ T9605.hs:7:6: error: • Couldn't match type ‘Bool’ with ‘m Bool’ - Expected type: t0 -> m Bool - Actual type: t0 -> Bool + Expected: t0 -> m Bool + Actual: t0 -> Bool • In the result of a function call In the expression: f1 undefined In an equation for ‘f2’: f2 = f1 undefined diff --git a/testsuite/tests/typecheck/should_fail/T9612.stderr b/testsuite/tests/typecheck/should_fail/T9612.stderr index 462edc3e2d..26cea79487 100644 --- a/testsuite/tests/typecheck/should_fail/T9612.stderr +++ b/testsuite/tests/typecheck/should_fail/T9612.stderr @@ -1,20 +1,21 @@ T9612.hs:16:9: error: - Couldn't match type ‘[(Int, a)]’ with ‘(Int, a)’ - arising from a functional dependency between: - constraint ‘MonadWriter (Int, a) (WriterT [(Int, a)] Identity)’ - arising from a use of ‘tell’ - instance ‘MonadWriter w (WriterT w m)’ at T9612.hs:20:10-59 - In a stmt of a 'do' block: tell (n, x) - In the expression: - do tell (n, x) - return (1, y) - In an equation for ‘f’: - f y (n, x) - = do tell (n, x) - return (1, y) - Relevant bindings include - x :: a (bound at T9612.hs:14:8) - y :: a (bound at T9612.hs:14:3) - f :: a -> (Int, a) -> Writer [(Int, a)] (Int, a) - (bound at T9612.hs:14:1) + • Couldn't match type: [(Int, a)] + with: (Int, a) + arising from a functional dependency between: + constraint ‘MonadWriter (Int, a) (WriterT [(Int, a)] Identity)’ + arising from a use of ‘tell’ + instance ‘MonadWriter w (WriterT w m)’ at T9612.hs:20:10-59 + • In a stmt of a 'do' block: tell (n, x) + In the expression: + do tell (n, x) + return (1, y) + In an equation for ‘f’: + f y (n, x) + = do tell (n, x) + return (1, y) + • Relevant bindings include + x :: a (bound at T9612.hs:14:8) + y :: a (bound at T9612.hs:14:3) + f :: a -> (Int, a) -> Writer [(Int, a)] (Int, a) + (bound at T9612.hs:14:1) diff --git a/testsuite/tests/typecheck/should_fail/T9774.stderr b/testsuite/tests/typecheck/should_fail/T9774.stderr index 28b1b58c4c..da75c339b8 100644 --- a/testsuite/tests/typecheck/should_fail/T9774.stderr +++ b/testsuite/tests/typecheck/should_fail/T9774.stderr @@ -1,8 +1,8 @@ T9774.hs:5:17: error: • Couldn't match type ‘Char’ with ‘[Char]’ - Expected type: String - Actual type: Char + Expected: String + Actual: Char • In the first argument of ‘putStrLn’, namely ‘(assert True 'a')’ In the expression: putStrLn (assert True 'a') In an equation for ‘foo’: foo = putStrLn (assert True 'a') diff --git a/testsuite/tests/typecheck/should_fail/T9858e.stderr b/testsuite/tests/typecheck/should_fail/T9858e.stderr index 04e08000ca..f397723a02 100644 --- a/testsuite/tests/typecheck/should_fail/T9858e.stderr +++ b/testsuite/tests/typecheck/should_fail/T9858e.stderr @@ -1,9 +1,10 @@ T9858e.hs:9:8: error: - Couldn't match type ‘Eq Int => Int’ with ‘a0 b0’ - Expected type: Proxy (a0 b0) - Actual type: Proxy (Eq Int => Int) - In the first argument of ‘i’, namely - ‘(Proxy :: Proxy (Eq Int => Int))’ - In the expression: i (Proxy :: Proxy (Eq Int => Int)) - In an equation for ‘j’: j = i (Proxy :: Proxy (Eq Int => Int)) + • Couldn't match type: Eq Int => Int + with: a0 b0 + Expected: Proxy (a0 b0) + Actual: Proxy (Eq Int => Int) + • In the first argument of ‘i’, namely + ‘(Proxy :: Proxy (Eq Int => Int))’ + In the expression: i (Proxy :: Proxy (Eq Int => Int)) + In an equation for ‘j’: j = i (Proxy :: Proxy (Eq Int => Int)) diff --git a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr index f4e1d02eee..4370b606ca 100644 --- a/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr +++ b/testsuite/tests/typecheck/should_fail/TcCoercibleFail.stderr @@ -7,8 +7,8 @@ TcCoercibleFail.hs:11:8: error: In an equation for ‘foo1’: foo1 = coerce $ one :: () TcCoercibleFail.hs:14:8: error: - • Couldn't match representation of type ‘m Int’ - with that of ‘m Age’ + • Couldn't match representation of type: m Int + with that of: m Age arising from a use of ‘coerce’ NB: We cannot know what roles the parameters to ‘m’ have; we must assume that the role is nominal diff --git a/testsuite/tests/typecheck/should_fail/TcMultiWayIfFail.stderr b/testsuite/tests/typecheck/should_fail/TcMultiWayIfFail.stderr index 70ac94f060..487cfee88f 100644 --- a/testsuite/tests/typecheck/should_fail/TcMultiWayIfFail.stderr +++ b/testsuite/tests/typecheck/should_fail/TcMultiWayIfFail.stderr @@ -1,16 +1,28 @@ -TcMultiWayIfFail.hs:6:24: - Couldn't match expected type ‘Int’ with actual type ‘[Char]’ - In the expression: "2" - In the expression: - if | True -> 1 :: Int | False -> "2" | otherwise -> [3 :: Int] - In an equation for ‘x1’: - x1 = if | True -> 1 :: Int | False -> "2" | otherwise -> [3 :: Int] +TcMultiWayIfFail.hs:6:24: error: + • Couldn't match type ‘[Char]’ with ‘Int’ + Expected: Int + Actual: String + • In the expression: "2" + In the expression: + if | True -> 1 :: Int + | False -> "2" + | otherwise -> [3 :: Int] + In an equation for ‘x1’: + x1 + = if | True -> 1 :: Int + | False -> "2" + | otherwise -> [3 :: Int] -TcMultiWayIfFail.hs:7:24: - Couldn't match expected type ‘Int’ with actual type ‘[Int]’ - In the expression: [3 :: Int] - In the expression: - if | True -> 1 :: Int | False -> "2" | otherwise -> [3 :: Int] - In an equation for ‘x1’: - x1 = if | True -> 1 :: Int | False -> "2" | otherwise -> [3 :: Int] +TcMultiWayIfFail.hs:7:24: error: + • Couldn't match expected type ‘Int’ with actual type ‘[Int]’ + • In the expression: [3 :: Int] + In the expression: + if | True -> 1 :: Int + | False -> "2" + | otherwise -> [3 :: Int] + In an equation for ‘x1’: + x1 + = if | True -> 1 :: Int + | False -> "2" + | otherwise -> [3 :: Int] diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInfinite.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInfinite.stderr index bf50beed5e..9725a779e7 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInfinite.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInfinite.stderr @@ -1,7 +1,10 @@ UnliftedNewtypesInfinite.hs:9:20: error: - • Occurs check: cannot construct the infinite kind: - t0 ~ 'GHC.Types.TupleRep '[ 'GHC.Types.IntRep, t0] + • Couldn't match kind ‘t0’ + with ‘'GHC.Types.TupleRep '[ 'GHC.Types.IntRep, t0]’ + Expected kind ‘TYPE t0’, + but ‘(# Int#, Foo #)’ has kind ‘TYPE + ('GHC.Types.TupleRep '[ 'GHC.Types.IntRep, t0])’ • In the type ‘(# Int#, Foo #)’ In the definition of data constructor ‘FooC’ In the newtype declaration for ‘Foo’ diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInstanceFail.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInstanceFail.stderr index 3fb2814dab..0a49414c33 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInstanceFail.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesInstanceFail.stderr @@ -1,5 +1,7 @@ -UnliftedNewtypesInstanceFail.hs:13:3: - Expected kind ‘TYPE 'WordRep’, + +UnliftedNewtypesInstanceFail.hs:13:3: error: + • Couldn't match kind ‘'IntRep’ with ‘'WordRep’ + Expected kind ‘TYPE 'WordRep’, but ‘Bar Bool’ has kind ‘TYPE 'IntRep’ - In the newtype instance declaration for ‘Bar’ + • In the newtype instance declaration for ‘Bar’ In the instance declaration for ‘Foo Bool’ diff --git a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesMismatchedKindRecord.stderr b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesMismatchedKindRecord.stderr index c8386e663f..f30d8b8fe8 100644 --- a/testsuite/tests/typecheck/should_fail/UnliftedNewtypesMismatchedKindRecord.stderr +++ b/testsuite/tests/typecheck/should_fail/UnliftedNewtypesMismatchedKindRecord.stderr @@ -1,7 +1,7 @@ UnliftedNewtypesMismatchedKindRecord.hs:11:23: error: - • Expected kind ‘TYPE 'IntRep’, - but ‘Word#’ has kind ‘TYPE 'WordRep’ + • Couldn't match kind ‘'WordRep’ with ‘'IntRep’ + Expected kind ‘TYPE 'IntRep’, but ‘Word#’ has kind ‘TYPE 'WordRep’ • In the type ‘Word#’ In the definition of data constructor ‘FooC’ In the newtype declaration for ‘Foo’ diff --git a/testsuite/tests/typecheck/should_fail/VtaFail.hs b/testsuite/tests/typecheck/should_fail/VtaFail.hs index 250f9e273e..42e584ce0a 100644 --- a/testsuite/tests/typecheck/should_fail/VtaFail.hs +++ b/testsuite/tests/typecheck/should_fail/VtaFail.hs @@ -14,7 +14,9 @@ answer_constraint_fail = addOne @Bool 5 answer_lambda = (\x -> x) @Int 12 pair :: forall a. a -> forall b. b -> (a, b) -pair = (,) +pair x = (,) x +-- Without this eta-expansion, the two have +-- different types under simple subsumption (#17775) a = pair 3 @Int @Bool True diff --git a/testsuite/tests/typecheck/should_fail/VtaFail.stderr b/testsuite/tests/typecheck/should_fail/VtaFail.stderr index a9958016ce..87a2bea3fe 100644 --- a/testsuite/tests/typecheck/should_fail/VtaFail.stderr +++ b/testsuite/tests/typecheck/should_fail/VtaFail.stderr @@ -13,66 +13,67 @@ VtaFail.hs:14:17: error: In an equation for ‘answer_lambda’: answer_lambda = (\ x -> x) @Int 12 -VtaFail.hs:19:5: error: +VtaFail.hs:21:5: error: • Cannot apply expression of type ‘Int -> (a0, Int)’ to a visible type argument ‘Bool’ • In the expression: pair 3 @Int @Bool True In an equation for ‘a’: a = pair 3 @Int @Bool True -VtaFail.hs:26:15: error: +VtaFail.hs:28:15: error: • Expected kind ‘* -> *’, but ‘Int’ has kind ‘*’ • In the type ‘Int’ In the expression: first @Int F In an equation for ‘fInt’: fInt = first @Int F -VtaFail.hs:33:18: error: +VtaFail.hs:35:18: error: • Couldn't match type ‘Int’ with ‘Bool’ - Expected type: Proxy Bool - Actual type: Proxy Int + Expected: Proxy Bool + Actual: Proxy Int • In the second argument of ‘foo’, namely ‘(P :: Proxy Int)’ In the expression: foo @Bool (P :: Proxy Int) In an equation for ‘baz’: baz = foo @Bool (P :: Proxy Int) -VtaFail.hs:40:17: error: - • Expected kind ‘* -> k0 -> *’, but ‘Maybe’ has kind ‘* -> *’ +VtaFail.hs:42:17: error: + • Couldn't match kind ‘*’ with ‘k0 -> *’ + Expected kind ‘* -> k0 -> *’, but ‘Maybe’ has kind ‘* -> *’ • In the type ‘Maybe’ In the expression: too @Maybe T In an equation for ‘threeBad’: threeBad = too @Maybe T -VtaFail.hs:41:27: error: +VtaFail.hs:43:27: error: • Couldn't match type ‘Either’ with ‘(->)’ - Expected type: Three (->) - Actual type: Three Either + Expected: Three (->) + Actual: Three Either • In the second argument of ‘too’, namely ‘(T :: Three Either)’ In the expression: too @(->) (T :: Three Either) In an equation for ‘threeWorse’: threeWorse = too @(->) (T :: Three Either) -VtaFail.hs:46:5: error: +VtaFail.hs:48:5: error: • Cannot apply expression of type ‘Int -> Int -> Int’ to a visible type argument ‘Int’ • In the expression: plus @Int 5 7 In an equation for ‘b’: b = plus @Int 5 7 -VtaFail.hs:47:5: error: +VtaFail.hs:49:5: error: • Cannot apply expression of type ‘Int -> Int -> Int’ to a visible type argument ‘Rational’ • In the expression: plus @Rational 5 10 In an equation for ‘c’: c = plus @Rational 5 10 -VtaFail.hs:48:5: error: +VtaFail.hs:50:5: error: • Cannot apply expression of type ‘Int -> Int -> Int’ to a visible type argument ‘Int’ • In the expression: (+) @Int @Int @Int 12 14 In an equation for ‘d’: d = (+) @Int @Int @Int 12 14 -VtaFail.hs:51:5: error: +VtaFail.hs:53:5: error: • Cannot apply expression of type ‘Int -> String’ to a visible type argument ‘Float’ • In the expression: show @Int @Float (read "5") In an equation for ‘e’: e = show @Int @Float (read "5") -VtaFail.hs:52:11: error: +VtaFail.hs:54:11: error: • Cannot apply expression of type ‘String -> Int’ to a visible type argument ‘Bool’ • In the first argument of ‘show’, namely @@ -80,7 +81,7 @@ VtaFail.hs:52:11: error: In the expression: show (read @Int @Bool @Float "3") In an equation for ‘f’: f = show (read @Int @Bool @Float "3") -VtaFail.hs:57:12: error: +VtaFail.hs:59:12: error: • Expecting one more argument to ‘Maybe’ Expected a type, but ‘Maybe’ has kind ‘* -> *’ • In the type ‘Maybe’ diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T index d97c6f96e1..0b4e6b70d7 100644 --- a/testsuite/tests/typecheck/should_fail/all.T +++ b/testsuite/tests/typecheck/should_fail/all.T @@ -483,7 +483,7 @@ test('T14904b', normal, compile_fail, ['']) test('T15067', normal, compile_fail, ['']) test('T15330', normal, compile_fail, ['']) test('T15361', normal, compile_fail, ['']) -test('T15438', normal, compile_fail, ['']) +test('T15438', normal, compile, ['']) test('T15515', normal, compile_fail, ['']) test('T15523', normal, compile_fail, ['-O']) test('T15527', normal, compile_fail, ['']) @@ -561,6 +561,7 @@ test('T17566c', normal, compile_fail, ['']) test('T17773', normal, compile_fail, ['']) test('T17021', normal, compile_fail, ['']) test('T17021b', normal, compile_fail, ['']) +test('T17775', normal, compile_fail, ['']) test('T17955', normal, compile_fail, ['']) test('T17173', normal, compile_fail, ['']) test('T18127a', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_fail/mc19.stderr b/testsuite/tests/typecheck/should_fail/mc19.stderr index 1b9682e6c8..5d19a388af 100644 --- a/testsuite/tests/typecheck/should_fail/mc19.stderr +++ b/testsuite/tests/typecheck/should_fail/mc19.stderr @@ -1,8 +1,12 @@ mc19.hs:10:31: error: - • Occurs check: cannot construct the infinite type: a ~ [a] - Expected type: [a] -> [a] - Actual type: [a] -> [[a]] + • Couldn't match type ‘a’ with ‘[a]’ + Expected: [a] -> [a] + Actual: [a] -> [[a]] + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall {a}. [a] -> [a] + at mc19.hs:10:31-35 • In the expression: inits In a stmt of a monad comprehension: then inits In the expression: [x | x <- [3, 2, 1], then inits] diff --git a/testsuite/tests/typecheck/should_fail/mc21.stderr b/testsuite/tests/typecheck/should_fail/mc21.stderr index 014628f94a..abad9f6a20 100644 --- a/testsuite/tests/typecheck/should_fail/mc21.stderr +++ b/testsuite/tests/typecheck/should_fail/mc21.stderr @@ -1,8 +1,12 @@ mc21.hs:12:26: error: - • Occurs check: cannot construct the infinite type: a ~ [a] - Expected type: [a] -> [[a]] - Actual type: [[a]] -> [[a]] + • Couldn't match type ‘a’ with ‘[a]’ + Expected: [a] -> [[a]] + Actual: [a] -> [a] + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall {a}. [a] -> [[a]] + at mc21.hs:12:26-31 • In the expression: take 5 In a stmt of a monad comprehension: then group using take 5 In the expression: diff --git a/testsuite/tests/typecheck/should_fail/mc22.stderr b/testsuite/tests/typecheck/should_fail/mc22.stderr index 40a754a9c5..50dbf5425b 100644 --- a/testsuite/tests/typecheck/should_fail/mc22.stderr +++ b/testsuite/tests/typecheck/should_fail/mc22.stderr @@ -1,11 +1,15 @@ mc22.hs:10:26: error: - • Occurs check: cannot construct the infinite type: a ~ t a - Expected type: [a] -> [t a] - Actual type: [t a] -> [t a] + • Couldn't match type ‘a’ with ‘t a’ + Expected: [a] -> [t a] + Actual: [a] -> [a] + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall {a}. [a] -> [t a] + at mc22.hs:10:26-31 • In the expression: take 5 In a stmt of a monad comprehension: then group using take 5 In the expression: [x + 1 | x <- ["Hello", "World"], then group using take 5] • Relevant bindings include - foo :: [t [Char]] (bound at mc22.hs:8:1) + foo :: [t String] (bound at mc22.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/mc23.stderr b/testsuite/tests/typecheck/should_fail/mc23.stderr index 2f3ae27a98..b9029f1635 100644 --- a/testsuite/tests/typecheck/should_fail/mc23.stderr +++ b/testsuite/tests/typecheck/should_fail/mc23.stderr @@ -1,8 +1,9 @@ mc23.hs:9:29: error: - • Couldn't match type ‘[a0]’ with ‘[a] -> m a’ - Expected type: (a -> b) -> [a] -> m a - Actual type: [a0] -> [a0] + • Couldn't match type: [a0] + with: a -> b + Expected: (a -> b) -> [a] -> m a + Actual: [a0] -> [a0] • Possible cause: ‘take’ is applied to too many arguments In the expression: take 5 In a stmt of a monad comprehension: then take 5 by x diff --git a/testsuite/tests/typecheck/should_fail/mc24.stderr b/testsuite/tests/typecheck/should_fail/mc24.stderr index 06a9c51690..e40a0c6e72 100644 --- a/testsuite/tests/typecheck/should_fail/mc24.stderr +++ b/testsuite/tests/typecheck/should_fail/mc24.stderr @@ -1,11 +1,11 @@ mc24.hs:10:31: error: - • Couldn't match type ‘[a1]’ with ‘[a] -> m [a]’ - Expected type: (a -> a0) -> [a] -> m [a] - Actual type: [a1] -> [a1] + • Couldn't match type: [a1] + with: a -> a0 + Expected: (a -> a0) -> [a] -> m [a] + Actual: [a1] -> [a1] • Possible cause: ‘take’ is applied to too many arguments In the expression: take 2 In a stmt of a monad comprehension: then group by x using take 2 In the expression: [GHC.List.length x | x <- [1 .. 10], then group by x using take 2] - • Relevant bindings include foo :: m Int (bound at mc24.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/mc25.stderr b/testsuite/tests/typecheck/should_fail/mc25.stderr index 5c29197f04..f4e992f9e7 100644 --- a/testsuite/tests/typecheck/should_fail/mc25.stderr +++ b/testsuite/tests/typecheck/should_fail/mc25.stderr @@ -1,8 +1,8 @@ mc25.hs:9:46: error: - • Couldn't match type ‘a -> t1’ with ‘Int’ - Expected type: (a -> t1) -> [a] -> [t a] - Actual type: Int -> [t a] -> [t a] + • Couldn't match type ‘Int’ with ‘a -> t1’ + Expected: (a -> t1) -> [a] -> [t a] + Actual: Int -> [a] -> [a] • In the expression: take In a stmt of a monad comprehension: then group by x using take In the expression: [x | x <- [1 .. 10], then group by x using take] diff --git a/testsuite/tests/typecheck/should_fail/tcfail001.stderr b/testsuite/tests/typecheck/should_fail/tcfail001.stderr index 2d4caf2ac7..7f49c869ee 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail001.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail001.stderr @@ -1,7 +1,7 @@ tcfail001.hs:9:2: error: - • Couldn't match expected type ‘[a]’ - with actual type ‘[a0] -> [a1]’ + • Couldn't match expected type: [a] + with actual type: [a0] -> [a1] • The equation(s) for ‘op’ have one value argument, but its type ‘[a]’ has none In the instance declaration for ‘A [a]’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail002.stderr b/testsuite/tests/typecheck/should_fail/tcfail002.stderr index d72a34065e..664c910533 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail002.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail002.stderr @@ -1,6 +1,6 @@ tcfail002.hs:4:7: error: - • Occurs check: cannot construct the infinite type: p ~ [p] + • Couldn't match expected type ‘p’ with actual type ‘[p]’ • In the expression: z In an equation for ‘c’: c z = z • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/tcfail004.stderr b/testsuite/tests/typecheck/should_fail/tcfail004.stderr index 9d6657e651..0d4f700910 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail004.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail004.stderr @@ -1,7 +1,7 @@ tcfail004.hs:3:9: error: - • Couldn't match expected type ‘(a, b)’ - with actual type ‘(a0, b0, c0)’ + • Couldn't match expected type: (a, b) + with actual type: (a0, b0, c0) • In the expression: (1, 2, 3) In a pattern binding: (f, g) = (1, 2, 3) • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/tcfail005.stderr b/testsuite/tests/typecheck/should_fail/tcfail005.stderr index d206505cdc..8da93af1e2 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail005.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail005.stderr @@ -1,6 +1,7 @@ tcfail005.hs:3:9: error: - • Couldn't match expected type ‘[a]’ with actual type ‘(a0, Char)’ + • Couldn't match expected type: [a] + with actual type: (a0, Char) • In the expression: (1, 'a') In a pattern binding: (h : i) = (1, 'a') • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/tcfail014.stderr b/testsuite/tests/typecheck/should_fail/tcfail014.stderr index f506bff6f8..65b217ef1f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail014.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail014.stderr @@ -1,6 +1,6 @@ tcfail014.hs:5:33: error: - • Occurs check: cannot construct the infinite type: t4 ~ t4 -> t5 + • Couldn't match expected type ‘t4’ with actual type ‘t4 -> t5’ • In the first argument of ‘z’, namely ‘z’ In the expression: z z In an equation for ‘h’: h z = z z diff --git a/testsuite/tests/typecheck/should_fail/tcfail016.stderr b/testsuite/tests/typecheck/should_fail/tcfail016.stderr index 20b9e0fa36..9f38cd6461 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail016.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail016.stderr @@ -1,7 +1,8 @@ tcfail016.hs:8:1: error: - • Couldn't match type ‘Expr a’ with ‘(a, Expr a)’ - Expected type: AnnExpr a -> [[Char]] - Actual type: Expr a -> [[Char]] + • Couldn't match type: Expr a + with: (a, Expr a) + Expected: AnnExpr a -> [[Char]] + Actual: Expr a -> [[Char]] • Relevant bindings include g :: AnnExpr a -> [[Char]] (bound at tcfail016.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail033.stderr b/testsuite/tests/typecheck/should_fail/tcfail033.stderr index bc346c2aac..a1c5e7d7d0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail033.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail033.stderr @@ -1,6 +1,6 @@ tcfail033.hs:4:12: error: - • Occurs check: cannot construct the infinite type: a ~ (a, b) + • Couldn't match expected type ‘(a, b)’ with actual type ‘a’ • In the expression: x In the expression: [x | (x, y) <- buglet] In an equation for ‘buglet’: buglet = [x | (x, y) <- buglet] diff --git a/testsuite/tests/typecheck/should_fail/tcfail065.stderr b/testsuite/tests/typecheck/should_fail/tcfail065.stderr index c1f3283daa..9be21918cb 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail065.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail065.stderr @@ -1,14 +1,15 @@ tcfail065.hs:29:18: error: • Couldn't match type ‘x1’ with ‘x’ + Expected: X x + Actual: X x1 ‘x1’ is a rigid type variable bound by the type signature for: setX :: forall x1. x1 -> X x -> X x at tcfail065.hs:29:3-6 ‘x’ is a rigid type variable bound by - the instance declaration at tcfail065.hs:28:10-19 - Expected type: X x - Actual type: X x1 + the instance declaration + at tcfail065.hs:28:10-19 • In the expression: X x In an equation for ‘setX’: setX x (X _) = X x In the instance declaration for ‘HasX (X x)’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail068.stderr b/testsuite/tests/typecheck/should_fail/tcfail068.stderr index 299fc7b8a7..c7b7630e04 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail068.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail068.stderr @@ -1,6 +1,8 @@ tcfail068.hs:14:9: error: • Couldn't match type ‘s1’ with ‘s’ + Expected: GHC.ST.ST s1 (IndTree s a) + Actual: GHC.ST.ST s1 (STArray s1 (Int, Int) a) ‘s1’ is a rigid type variable bound by a type expected by the context: forall s1. GHC.ST.ST s1 (IndTree s a) @@ -11,8 +13,6 @@ tcfail068.hs:14:9: error: Constructed a => (Int, Int) -> a -> IndTree s a at tcfail068.hs:11:1-55 - Expected type: GHC.ST.ST s1 (IndTree s a) - Actual type: GHC.ST.ST s1 (STArray s1 (Int, Int) a) • In the first argument of ‘runST’, namely ‘(newSTArray ((1, 1), n) x)’ In the expression: runST (newSTArray ((1, 1), n) x) @@ -24,6 +24,8 @@ tcfail068.hs:14:9: error: tcfail068.hs:19:9: error: • Couldn't match type ‘s1’ with ‘s’ + Expected: GHC.ST.ST s1 (IndTree s a) + Actual: GHC.ST.ST s (IndTree s a) ‘s1’ is a rigid type variable bound by a type expected by the context: forall s1. GHC.ST.ST s1 (IndTree s a) @@ -34,8 +36,6 @@ tcfail068.hs:19:9: error: Constructed a => (Int, Int) -> (a -> a) -> IndTree s a -> IndTree s a at tcfail068.hs:16:1-75 - Expected type: GHC.ST.ST s1 (IndTree s a) - Actual type: GHC.ST.ST s (IndTree s a) • In the first argument of ‘runST’, namely ‘(readSTArray arr i >>= \ val -> writeSTArray arr i (f val) >> return arr)’ @@ -55,6 +55,8 @@ tcfail068.hs:19:9: error: tcfail068.hs:24:36: error: • Couldn't match type ‘s1’ with ‘s’ + Expected: GHC.ST.ST s1 (IndTree s a) + Actual: GHC.ST.ST s (IndTree s a) ‘s1’ is a rigid type variable bound by a type expected by the context: forall s1. GHC.ST.ST s1 (IndTree s a) @@ -65,8 +67,6 @@ tcfail068.hs:24:36: error: Constructed a => ((Int, Int), (Int, Int)) -> (a -> a) -> IndTree s a -> IndTree s a at tcfail068.hs:23:1-87 - Expected type: GHC.ST.ST s1 (IndTree s a) - Actual type: GHC.ST.ST s (IndTree s a) • In the first argument of ‘runST’, namely ‘(itrap' i k)’ In the expression: runST (itrap' i k) In an equation for ‘itrap’: @@ -92,6 +92,8 @@ tcfail068.hs:24:36: error: tcfail068.hs:36:46: error: • Couldn't match type ‘s1’ with ‘s’ + Expected: GHC.ST.ST s1 (c, IndTree s b) + Actual: GHC.ST.ST s (c, IndTree s b) ‘s1’ is a rigid type variable bound by a type expected by the context: forall s1. GHC.ST.ST s1 (c, IndTree s b) @@ -108,8 +110,6 @@ tcfail068.hs:36:46: error: -> IndTree s b -> (c, IndTree s b) at tcfail068.hs:(34,1)-(35,62) - Expected type: GHC.ST.ST s1 (c, IndTree s b) - Actual type: GHC.ST.ST s (c, IndTree s b) • In the first argument of ‘runST’, namely ‘(itrapstate' i k s)’ In the expression: runST (itrapstate' i k s) In an equation for ‘itrapstate’: diff --git a/testsuite/tests/typecheck/should_fail/tcfail069.stderr b/testsuite/tests/typecheck/should_fail/tcfail069.stderr index fcaf3e9542..a7c996ce84 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail069.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail069.stderr @@ -1,7 +1,7 @@ tcfail069.hs:21:7: error: - • Couldn't match expected type ‘([Int], [Int])’ - with actual type ‘[a0]’ + • Couldn't match expected type: ([Int], [Int]) + with actual type: [a0] • In the pattern: [] In a case alternative: [] -> error "foo" In the expression: case (list1, list2) of { [] -> error "foo" } diff --git a/testsuite/tests/typecheck/should_fail/tcfail076.stderr b/testsuite/tests/typecheck/should_fail/tcfail076.stderr index 52fcebb927..47432ae851 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail076.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail076.stderr @@ -1,6 +1,8 @@ tcfail076.hs:18:82: error: • Couldn't match type ‘res1’ with ‘res’ + Expected: m res1 + Actual: m res ‘res1’ is a rigid type variable bound by a type expected by the context: forall res1. (b -> m res1) -> m res1 @@ -9,8 +11,6 @@ tcfail076.hs:18:82: error: a type expected by the context: forall res. (a -> m res) -> m res at tcfail076.hs:18:35-96 - Expected type: m res1 - Actual type: m res • In the expression: cont a In the first argument of ‘KContT’, namely ‘(\ cont' -> cont a)’ In the expression: KContT (\ cont' -> cont a) diff --git a/testsuite/tests/typecheck/should_fail/tcfail103.stderr b/testsuite/tests/typecheck/should_fail/tcfail103.stderr index 2192d8a7f6..84c9c8b0b6 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail103.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail103.stderr @@ -1,6 +1,8 @@ tcfail103.hs:15:13: error: • Couldn't match type ‘s’ with ‘t’ + Expected: ST s Int + Actual: ST t Int ‘s’ is a rigid type variable bound by the type signature for: g :: forall s. ST s Int @@ -9,8 +11,6 @@ tcfail103.hs:15:13: error: the type signature for: f :: forall t. ST t Int at tcfail103.hs:10:1-12 - Expected type: ST s Int - Actual type: ST t Int • In the expression: readSTRef v In an equation for ‘g’: g = readSTRef v In the expression: diff --git a/testsuite/tests/typecheck/should_fail/tcfail104.stderr b/testsuite/tests/typecheck/should_fail/tcfail104.stderr index 6516dcbd3a..9844b53268 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail104.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail104.stderr @@ -1,8 +1,9 @@ tcfail104.hs:14:12: error: - • Couldn't match type ‘forall a. a -> a’ with ‘Char -> Char’ - Expected type: (Char -> Char) -> Char -> Char - Actual type: (forall a. a -> a) -> Char -> Char + • Couldn't match type: forall a. a -> a + with: Char -> Char + Expected: (Char -> Char) -> Char -> Char + Actual: (forall a. a -> a) -> Char -> Char • In the expression: \ (x :: forall a. a -> a) -> x In the expression: if v then (\ (x :: forall a. a -> a) -> x) else (\ x -> x) @@ -10,8 +11,8 @@ tcfail104.hs:14:12: error: (if v then (\ (x :: forall a. a -> a) -> x) else (\ x -> x)) id 'c' tcfail104.hs:22:15: error: - • Couldn't match expected type ‘Char -> Char’ - with actual type ‘forall a. a -> a’ + • Couldn't match expected type: Char -> Char + with actual type: forall a. a -> a • When checking that the pattern signature: forall a. a -> a fits the type of its context: Char -> Char In the pattern: x :: forall a. a -> a diff --git a/testsuite/tests/typecheck/should_fail/tcfail119.stderr b/testsuite/tests/typecheck/should_fail/tcfail119.stderr index 5c22aefc4e..d23ab1f537 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail119.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail119.stderr @@ -1,5 +1,7 @@ -tcfail119.hs:11:8: - Couldn't match expected type ‘Bool’ with actual type ‘[Char]’ - In the pattern: "Foo" - In an equation for ‘b’: b x "Foo" = () +tcfail119.hs:11:8: error: + • Couldn't match type ‘Bool’ with ‘[Char]’ + Expected: Bool + Actual: String + • In the pattern: "Foo" + In an equation for ‘b’: b x "Foo" = () diff --git a/testsuite/tests/typecheck/should_fail/tcfail122.stderr b/testsuite/tests/typecheck/should_fail/tcfail122.stderr index 0ac1419e7d..39507bdbeb 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail122.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail122.stderr @@ -4,8 +4,8 @@ tcfail122.hs:8:9: error: When matching types c0 :: (* -> *) -> * a :: * -> * - Expected type: a b - Actual type: c0 d0 + Expected: a b + Actual: c0 d0 • In the expression: undefined :: forall (c :: (* -> *) -> *) (d :: * -> *). c d In the expression: diff --git a/testsuite/tests/typecheck/should_fail/tcfail132.stderr b/testsuite/tests/typecheck/should_fail/tcfail132.stderr index 2e0a13c844..92f7c2ab52 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail132.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail132.stderr @@ -1,13 +1,15 @@ tcfail132.hs:17:37: error: - • Expected kind ‘* -> * -> * -> *’, + • Couldn't match kind ‘*’ with ‘* -> *’ + Expected kind ‘* -> * -> * -> *’, but ‘Object f' f t’ has kind ‘* -> * -> *’ • In the first argument of ‘T’, namely ‘(Object f' f t)’ In the type ‘T (Object f' f t) (DUnit t)’ In the type declaration for ‘LiftObject’ tcfail132.hs:17:53: error: - • Expected kind ‘* -> * -> * -> *’, + • Couldn't match kind ‘*’ with ‘* -> *’ + Expected kind ‘* -> * -> * -> *’, but ‘DUnit t’ has kind ‘* -> * -> *’ • In the second argument of ‘T’, namely ‘(DUnit t)’ In the type ‘T (Object f' f t) (DUnit t)’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail140.stderr b/testsuite/tests/typecheck/should_fail/tcfail140.stderr index c0049d0e19..8de86280e1 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail140.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail140.stderr @@ -17,14 +17,14 @@ tcfail140.hs:12:10: error: rot :: p -> t (bound at tcfail140.hs:12:1) tcfail140.hs:14:15: error: - • Couldn't match expected type ‘t -> b’ with actual type ‘Int’ + • Couldn't match expected type ‘a -> b’ with actual type ‘Int’ • The operator ‘f’ takes two value arguments, - but its type ‘Int -> Int’ has only one + but its type ‘Int -> Int’ has only one In the first argument of ‘map’, namely ‘(3 `f`)’ In the expression: map (3 `f`) xs • Relevant bindings include - xs :: [t] (bound at tcfail140.hs:14:5) - bot :: [t] -> [b] (bound at tcfail140.hs:14:1) + xs :: [a] (bound at tcfail140.hs:14:5) + bot :: [a] -> [b] (bound at tcfail140.hs:14:1) tcfail140.hs:16:8: error: • The constructor ‘Just’ should have 1 argument, but has been given none diff --git a/testsuite/tests/typecheck/should_fail/tcfail165.stderr b/testsuite/tests/typecheck/should_fail/tcfail165.stderr index 19fe79bb78..b1f173f447 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail165.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail165.stderr @@ -1,7 +1,7 @@ tcfail165.hs:19:23: error: - • Couldn't match expected type ‘forall a. Show a => a -> String’ - with actual type ‘b0 -> String’ + • Couldn't match expected type: forall a. Show a => a -> String + with actual type: b0 -> String • In the second argument of ‘putMVar’, namely ‘(show :: forall b. Show b => b -> String)’ In a stmt of a 'do' block: diff --git a/testsuite/tests/typecheck/should_fail/tcfail168.stderr b/testsuite/tests/typecheck/should_fail/tcfail168.stderr index 4ec71aaa1d..59972c2aa4 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail168.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail168.stderr @@ -1,7 +1,7 @@ tcfail168.hs:7:11: error: - • Couldn't match expected type ‘IO a0’ - with actual type ‘Char -> IO ()’ + • Couldn't match expected type: IO a0 + with actual type: Char -> IO () • Probable cause: ‘putChar’ is applied to too few arguments In a stmt of a 'do' block: putChar In the expression: diff --git a/testsuite/tests/typecheck/should_fail/tcfail174.stderr b/testsuite/tests/typecheck/should_fail/tcfail174.stderr index 724535145c..5747a270ef 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail174.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail174.stderr @@ -1,21 +1,22 @@ tcfail174.hs:9:5: error: - • Couldn't match type ‘a0 -> a0’ with ‘forall a. a -> a’ - Expected type: Capture (forall a. a -> a) - Actual type: Capture (a0 -> a0) + • Couldn't match type: a0 -> a0 + with: forall a. a -> a + Expected: Capture (forall a. a -> a) + Actual: Capture (a0 -> a0) • In the expression: Base id In an equation for ‘g’: g = Base id tcfail174.hs:16:14: error: • Couldn't match type ‘a1’ with ‘a’ + Expected: Capture (forall x. x -> a) + Actual: Capture (forall a. a -> a) ‘a1’ is a rigid type variable bound by the type a -> a at tcfail174.hs:16:1-14 ‘a’ is a rigid type variable bound by the inferred type of h1 :: Capture a at tcfail174.hs:16:1-14 - Expected type: Capture (forall x. x -> a) - Actual type: Capture (forall a. a -> a) • In the first argument of ‘Capture’, namely ‘g’ In the expression: Capture g In an equation for ‘h1’: h1 = Capture g @@ -24,6 +25,8 @@ tcfail174.hs:16:14: error: tcfail174.hs:19:14: error: • Couldn't match type ‘a’ with ‘b’ + Expected: Capture (forall x. x -> b) + Actual: Capture (forall a. a -> a) ‘a’ is a rigid type variable bound by the type a -> a at tcfail174.hs:1:1 @@ -31,8 +34,6 @@ tcfail174.hs:19:14: error: the type signature for: h2 :: forall b. Capture b at tcfail174.hs:18:1-15 - Expected type: Capture (forall x. x -> b) - Actual type: Capture (forall a. a -> a) • In the first argument of ‘Capture’, namely ‘g’ In the expression: Capture g In an equation for ‘h2’: h2 = Capture g diff --git a/testsuite/tests/typecheck/should_fail/tcfail178.stderr b/testsuite/tests/typecheck/should_fail/tcfail178.stderr index 98df425424..d9f1b455c0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail178.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail178.stderr @@ -1,8 +1,8 @@ tcfail178.hs:15:7: error: • Couldn't match type ‘()’ with ‘[a]’ - Expected type: Bool -> [a] - Actual type: Bool -> () + Expected: Bool -> [a] + Actual: Bool -> () • In the first argument of ‘a’, namely ‘y’ In the expression: a y In an equation for ‘c’: c = a y diff --git a/testsuite/tests/typecheck/should_fail/tcfail179.stderr b/testsuite/tests/typecheck/should_fail/tcfail179.stderr index 7d16288b1f..a0c124590f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail179.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail179.stderr @@ -1,6 +1,8 @@ tcfail179.hs:14:41: error: • Couldn't match type ‘x’ with ‘s’ + Expected: x -> s + Actual: x -> x ‘x’ is a rigid type variable bound by a pattern with constructor: T :: forall s x. (s -> (x -> s) -> (x, s, Int)) -> T s, @@ -10,8 +12,6 @@ tcfail179.hs:14:41: error: the type signature for: run :: forall s. T s -> Int at tcfail179.hs:12:1-17 - Expected type: x -> s - Actual type: s -> s • In the second argument of ‘g’, namely ‘id’ In the expression: g x id In a pattern binding: (x, _, b) = g x id diff --git a/testsuite/tests/typecheck/should_fail/tcfail182.stderr b/testsuite/tests/typecheck/should_fail/tcfail182.stderr index e57c3c1672..12dbb6efa8 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail182.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail182.stderr @@ -1,10 +1,10 @@ tcfail182.hs:9:3: error: - • Couldn't match expected type ‘Prelude.Maybe a’ - with actual type ‘Maybe a0’ - NB: ‘Maybe’ is defined at tcfail182.hs:6:1-18 - ‘Prelude.Maybe’ - is defined in ‘GHC.Maybe’ in package ‘base-4.13.0.0’ + • Couldn't match expected type: Prelude.Maybe a + with actual type: Maybe a0 + NB: ‘Prelude.Maybe’ + is defined in ‘GHC.Maybe’ in package ‘base-4.14.0.0’ + ‘Maybe’ is defined at tcfail182.hs:6:1-18 • In the pattern: Foo In an equation for ‘f’: f Foo = 3 • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/tcfail186.stderr b/testsuite/tests/typecheck/should_fail/tcfail186.stderr index 9b38bca915..5d931076f7 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail186.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail186.stderr @@ -1,8 +1,8 @@ tcfail186.hs:7:9: error: • Couldn't match type ‘[Char]’ with ‘Int’ - Expected type: PhantomSyn a0 - Actual type: [Char] + Expected: PhantomSyn a0 + Actual: String • In the first argument of ‘f’, namely ‘"hoo"’ In the expression: f "hoo" In an equation for ‘foo’: foo = f "hoo" diff --git a/testsuite/tests/typecheck/should_fail/tcfail189.stderr b/testsuite/tests/typecheck/should_fail/tcfail189.stderr index f33d1e37f6..108a7ad973 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail189.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail189.stderr @@ -1,8 +1,9 @@ tcfail189.hs:10:31: error: - • Couldn't match type ‘[a1]’ with ‘[a] -> [[a]]’ - Expected type: (a -> a0) -> [a] -> [[a]] - Actual type: [a1] -> [a1] + • Couldn't match type: [a1] + with: a -> a0 + Expected: (a -> a0) -> [a] -> [[a]] + Actual: [a1] -> [a1] • Possible cause: ‘take’ is applied to too many arguments In the expression: take 2 In a stmt of a list comprehension: then group by x using take 2 diff --git a/testsuite/tests/typecheck/should_fail/tcfail191.stderr b/testsuite/tests/typecheck/should_fail/tcfail191.stderr index 125c2d8393..fd874653b0 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail191.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail191.stderr @@ -1,8 +1,12 @@ tcfail191.hs:11:26: error: - • Occurs check: cannot construct the infinite type: a ~ [a] - Expected type: [a] -> [[a]] - Actual type: [[a]] -> [[a]] + • Couldn't match type ‘a’ with ‘[a]’ + Expected: [a] -> [[a]] + Actual: [a] -> [a] + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall {a}. [a] -> [[a]] + at tcfail191.hs:11:26-31 • In the expression: take 5 In a stmt of a list comprehension: then group using take 5 In the expression: diff --git a/testsuite/tests/typecheck/should_fail/tcfail193.stderr b/testsuite/tests/typecheck/should_fail/tcfail193.stderr index 028e2f0232..cf4813c9f2 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail193.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail193.stderr @@ -1,8 +1,12 @@ tcfail193.hs:10:31: error: - • Occurs check: cannot construct the infinite type: a ~ [a] - Expected type: [a] -> [a] - Actual type: [a] -> [[a]] + • Couldn't match type ‘a’ with ‘[a]’ + Expected: [a] -> [a] + Actual: [a] -> [[a]] + ‘a’ is a rigid type variable bound by + a type expected by the context: + forall {a}. [a] -> [a] + at tcfail193.hs:10:31-35 • In the expression: inits In a stmt of a list comprehension: then inits In the expression: [x | x <- [3, 2, 1], then inits] diff --git a/testsuite/tests/typecheck/should_fail/tcfail199.stderr b/testsuite/tests/typecheck/should_fail/tcfail199.stderr index 4833c769f9..50fc8e5f44 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail199.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail199.stderr @@ -1,5 +1,8 @@ -tcfail199.hs:5:1: - Couldn't match expected type ‘IO t0’ with actual type ‘[Char]’ - In the expression: main - When checking the type of the IO action ‘main’ +tcfail199.hs:5:1: error: + • Couldn't match type: [Char] + with: IO t0 + Expected: IO t0 + Actual: String + • In the expression: main + When checking the type of the IO action ‘main’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail201.stderr b/testsuite/tests/typecheck/should_fail/tcfail201.stderr index 77349e29f4..dd1385fc90 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail201.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail201.stderr @@ -1,14 +1,14 @@ tcfail201.hs:17:56: error: • Couldn't match type ‘a’ with ‘HsDoc id0’ + Expected: c a + Actual: c (HsDoc id0) ‘a’ is a rigid type variable bound by the type signature for: gfoldl' :: forall (c :: * -> *) a. (forall a1 b. c (a1 -> b) -> a1 -> c b) -> (forall g. g -> c g) -> a -> c a at tcfail201.hs:15:1-85 - Expected type: c a - Actual type: c (HsDoc id0) • In the expression: z DocEmpty In a case alternative: DocEmpty -> z DocEmpty In the expression: case hsDoc of { DocEmpty -> z DocEmpty } diff --git a/testsuite/tests/typecheck/should_fail/tcfail206.stderr b/testsuite/tests/typecheck/should_fail/tcfail206.stderr index 7c97fc02af..cfb5161100 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail206.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail206.stderr @@ -1,26 +1,27 @@ tcfail206.hs:5:5: error: • Couldn't match type ‘Bool’ with ‘Int’ - Expected type: Bool -> (Int, Bool) - Actual type: Int -> (Int, Bool) + Expected: Bool -> (Int, Bool) + Actual: Bool -> (Bool, Bool) • In the expression: (, True) In an equation for ‘a’: a = (, True) tcfail206.hs:8:5: error: - • Couldn't match type ‘(t1, Int)’ with ‘Bool -> (Int, Bool)’ - Expected type: Int -> Bool -> (Int, Bool) - Actual type: Int -> (t1, Int) + • Couldn't match type: (t1, Int) + with: Bool -> (Int, Bool) + Expected: Int -> Bool -> (Int, Bool) + Actual: Int -> (t1, Int) • In the expression: (1,) In an equation for ‘b’: b = (1,) tcfail206.hs:11:5: error: • Couldn't match type ‘a’ with ‘Bool’ + Expected: a -> (a, Bool) + Actual: a -> (Bool, a) ‘a’ is a rigid type variable bound by the type signature for: c :: forall a. a -> (a, Bool) at tcfail206.hs:10:1-19 - Expected type: a -> (a, Bool) - Actual type: Bool -> (a, Bool) • In the expression: (True || False,) In an equation for ‘c’: c = (True || False,) • Relevant bindings include @@ -28,27 +29,27 @@ tcfail206.hs:11:5: error: tcfail206.hs:14:5: error: • Couldn't match type ‘Bool’ with ‘Int’ - Expected type: Bool -> (# Int, Bool #) - Actual type: Int -> (# Int, Bool #) + Expected: Bool -> (# Int, Bool #) + Actual: Bool -> (# Bool, Bool #) • In the expression: (# , True #) In an equation for ‘d’: d = (# , True #) tcfail206.hs:17:5: error: - • Couldn't match type ‘(# t0, Int #)’ - with ‘Bool -> (# Int, Bool #)’ - Expected type: Int -> Bool -> (# Int, Bool #) - Actual type: Int -> (# t0, Int #) + • Couldn't match type: (# t0, Int #) + with: Bool -> (# Int, Bool #) + Expected: Int -> Bool -> (# Int, Bool #) + Actual: Int -> (# t0, Int #) • In the expression: (# 1, #) In an equation for ‘e’: e = (# 1, #) tcfail206.hs:20:5: error: • Couldn't match type ‘a’ with ‘Bool’ + Expected: a -> (# a, Bool #) + Actual: a -> (# Bool, a #) ‘a’ is a rigid type variable bound by the type signature for: f :: forall a. a -> (# a, Bool #) at tcfail206.hs:19:1-21 - Expected type: a -> (# a, Bool #) - Actual type: Bool -> (# a, Bool #) • In the expression: (# True || False, #) In an equation for ‘f’: f = (# True || False, #) • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_fail/tcfail207.stderr b/testsuite/tests/typecheck/should_fail/tcfail207.stderr index 986d7d5740..eb6fb1db15 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail207.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail207.stderr @@ -1,14 +1,14 @@ -tcfail207.hs:5:7: - Couldn't match expected type ‘[Int] -> [Int]’ - with actual type ‘[a1]’ - Possible cause: ‘take’ is applied to too many arguments - In the expression: take x [] - In an equation for ‘f’: f x = take x [] +tcfail207.hs:5:7: error: + • Couldn't match expected type: [Int] -> [Int] + with actual type: [a1] + • Possible cause: ‘take’ is applied to too many arguments + In the expression: take x [] + In an equation for ‘f’: f x = take x [] -tcfail207.hs:9:5: - Couldn't match expected type ‘[Int]’ - with actual type ‘[a0] -> [a0]’ - Probable cause: ‘take’ is applied to too few arguments - In the expression: take 3 - In an equation for ‘g’: g = take 3 +tcfail207.hs:9:5: error: + • Couldn't match expected type: [Int] + with actual type: [a0] -> [a0] + • Probable cause: ‘take’ is applied to too few arguments + In the expression: take 3 + In an equation for ‘g’: g = take 3 diff --git a/testsuite/tests/typecheck/should_fail/tcfail225.stderr b/testsuite/tests/typecheck/should_fail/tcfail225.stderr index 5a3ba3681f..8bfca4cb48 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail225.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail225.stderr @@ -1,6 +1,7 @@ tcfail225.hs:9:19: error: - • Expected kind ‘k -> *’, but ‘Maybe’ has kind ‘* -> *’ + • Couldn't match kind ‘k’ with ‘*’ + Expected kind ‘k -> *’, but ‘Maybe’ has kind ‘* -> *’ • In the first argument of ‘T’, namely ‘Maybe’ In the type ‘T Maybe (m a)’ In the definition of data constructor ‘MkT’ diff --git a/testsuite/tests/typecheck/should_run/IPRun.hs b/testsuite/tests/typecheck/should_run/IPRun.hs index 0d2a8d76c6..6c3c88ff95 100644 --- a/testsuite/tests/typecheck/should_run/IPRun.hs +++ b/testsuite/tests/typecheck/should_run/IPRun.hs @@ -15,7 +15,7 @@ f2 () = let ?x = 5 in \() -> ?x -- should always return 5 f3 :: () -> ((?x :: Int) => Int) --- Deep skolemisation means that the local x=5 still wins +-- Simple subsumption means that the x=0 from main wins f3 = let ?x = 5 in \() -> ?x main = let ?x = 0 in diff --git a/testsuite/tests/typecheck/should_run/IPRun.stdout b/testsuite/tests/typecheck/should_run/IPRun.stdout index e558e3cc3a..978f5752d6 100644 --- a/testsuite/tests/typecheck/should_run/IPRun.stdout +++ b/testsuite/tests/typecheck/should_run/IPRun.stdout @@ -1,4 +1,4 @@ 5 5 5 -5 +0 diff --git a/testsuite/tests/typecheck/should_run/KindInvariant.stderr b/testsuite/tests/typecheck/should_run/KindInvariant.stderr index 4f6cfffb7f..9d404ae088 100644 --- a/testsuite/tests/typecheck/should_run/KindInvariant.stderr +++ b/testsuite/tests/typecheck/should_run/KindInvariant.stderr @@ -1,6 +1,7 @@ <interactive>:1:3: error: - • Expected kind ‘* -> *’, + • Couldn't match a lifted type with an unlifted type + Expected kind ‘* -> *’, but ‘State#’ has kind ‘* -> TYPE ('TupleRep '[])’ • In the first argument of ‘T’, namely ‘State#’ In the type ‘T State#’ diff --git a/testsuite/tests/typecheck/should_run/T13838.stderr b/testsuite/tests/typecheck/should_run/T13838.stderr index b2129f7d13..a8de8b16d3 100644 --- a/testsuite/tests/typecheck/should_run/T13838.stderr +++ b/testsuite/tests/typecheck/should_run/T13838.stderr @@ -1,5 +1,6 @@ -T13838.exe: T13838.hs:6:1: error: - • Couldn't match expected type ‘IO t0’ with actual type ‘() -> ()’ +T13838: T13838.hs:6:1: error: + • Couldn't match expected type: IO t0 + with actual type: () -> () • Probable cause: ‘main’ is applied to too few arguments In the expression: main When checking the type of the IO action ‘main’ diff --git a/testsuite/tests/typecheck/should_run/T7861.stderr b/testsuite/tests/typecheck/should_run/T7861.stderr index 4a1c030d7c..f65b01e217 100644 --- a/testsuite/tests/typecheck/should_run/T7861.stderr +++ b/testsuite/tests/typecheck/should_run/T7861.stderr @@ -1,7 +1,11 @@ T7861: T7861.hs:10:5: error: - • Occurs check: cannot construct the infinite type: a ~ [a] - Expected type: (forall b. a) -> a - Actual type: (forall b. a) -> [a] + • Couldn't match type ‘a’ with ‘[a]’ + Expected: (forall b. a) -> a + Actual: (forall b. a) -> [a] + ‘a’ is a rigid type variable bound by + the type signature for: + f :: forall a. (forall b. a) -> a + at T7861.hs:9:1-23 • In the expression: doA In an equation for ‘f’: f = doA • Relevant bindings include diff --git a/testsuite/tests/typecheck/should_run/Typeable1.stderr b/testsuite/tests/typecheck/should_run/Typeable1.stderr index ec16681592..3ded9c03ed 100644 --- a/testsuite/tests/typecheck/should_run/Typeable1.stderr +++ b/testsuite/tests/typecheck/should_run/Typeable1.stderr @@ -1,6 +1,7 @@ Typeable1.hs:22:5: error: [-Winaccessible-code (in -Wdefault), -Werror=inaccessible-code] - • Couldn't match type ‘ComposeK’ with ‘a3 b3’ + • Couldn't match type: ComposeK + with: a3 b3 Inaccessible code in a pattern with pattern synonym: App :: forall k2 (t :: k2). diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 4cd7a1b73c..5afc7e3725 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -58,7 +58,7 @@ test('tcrun038', [extra_files(['TcRun038_B.hs'])], multimod_compile_and_run, ['t test('tcrun039', normal, compile_and_run, ['']) test('tcrun040', normal, compile_and_run, ['']) test('tcrun041', omit_ways(['ghci']), compile_and_run, ['']) -test('tcrun042', normal, compile_fail, ['']) +test('tcrun042', normal, compile, ['']) test('tcrun043', normal, compile_and_run, ['']) test('tcrun044', normal, compile_and_run, ['']) test('tcrun045', normal, compile_fail, ['']) diff --git a/testsuite/tests/typecheck/should_run/tcrun035.hs b/testsuite/tests/typecheck/should_run/tcrun035.hs index ee9f27bb7b..9106557ede 100644 --- a/testsuite/tests/typecheck/should_run/tcrun035.hs +++ b/testsuite/tests/typecheck/should_run/tcrun035.hs @@ -6,11 +6,15 @@ -- Now it breaks the impredicativity story -- (id {a}) . (id {a}) :: a -> a -- And (forall m. Monad m => m a) /~ IO a +-- +-- Apr 20: with simple subsumption this fails. So I +-- I eta-expanded foo, but leaving the (id . id) +-- composition. module Main(main) where foo :: (forall m. Monad m => m a) -> IO a -foo = id . id +foo x = (id . id) x main :: IO () main = foo (return ()) diff --git a/testsuite/tests/typecheck/should_run/tcrun042.hs b/testsuite/tests/typecheck/should_run/tcrun042.hs index 3b51d36c22..ba809a16ba 100644 --- a/testsuite/tests/typecheck/should_run/tcrun042.hs +++ b/testsuite/tests/typecheck/should_run/tcrun042.hs @@ -5,6 +5,8 @@ -- failing, which is OK. We don't really support impredicative -- polymorphism! -- +-- Apr 20: Works again. NB: the ImpredicativeTypes flag +-- -- The test was added by Max in 5e8ff849, apparently to test tuple sections module Main where diff --git a/testsuite/tests/typecheck/should_run/tcrun042.stderr b/testsuite/tests/typecheck/should_run/tcrun042.stderr deleted file mode 100644 index 52d9b29693..0000000000 --- a/testsuite/tests/typecheck/should_run/tcrun042.stderr +++ /dev/null @@ -1,6 +0,0 @@ - -tcrun042.hs:13:5: error: - • Couldn't match expected type ‘forall c. c -> c -> c’ - with actual type ‘b0 -> b0 -> b0’ - • In the expression: (, "Hello" ++ "World",) - In an equation for ‘e’: e = (, "Hello" ++ "World",) |