diff options
author | Richard Eisenberg <eir@cis.upenn.edu> | 2016-01-13 23:29:17 -0500 |
---|---|---|
committer | Richard Eisenberg <eir@cis.upenn.edu> | 2016-01-27 09:33:26 -0500 |
commit | 00cbbab3362578df44851442408a8b91a2a769fa (patch) | |
tree | c8f79d003510e191adeab0d1b98f20ebde40d914 /testsuite/tests | |
parent | 2899aa580d633103fc551e36c977720b94f5b41c (diff) | |
download | haskell-00cbbab3362578df44851442408a8b91a2a769fa.tar.gz |
Refactor the typechecker to use ExpTypes.
The idea here is described in [wiki:Typechecker]. Briefly,
this refactor keeps solid track of "synthesis" mode vs
"checking" in GHC's bidirectional type-checking algorithm.
When in synthesis mode, the expected type is just an IORef
to write to.
In addition, this patch does a significant reworking of
RebindableSyntax, allowing much more freedom in the types
of the rebindable operators. For example, we can now have
`negate :: Int -> Bool` and
`(>>=) :: m a -> (forall x. a x -> m b) -> m b`. The magic
is in tcSyntaxOp.
This addresses tickets #11397, #11452, and #11458.
Tests:
typecheck/should_compile/{RebindHR,RebindNegate,T11397,T11458}
th/T11452
Diffstat (limited to 'testsuite/tests')
76 files changed, 496 insertions, 380 deletions
diff --git a/testsuite/tests/ado/ado004.stderr b/testsuite/tests/ado/ado004.stderr index 6472310ece..6e877617dc 100644 --- a/testsuite/tests/ado/ado004.stderr +++ b/testsuite/tests/ado/ado004.stderr @@ -2,27 +2,27 @@ TYPE SIGNATURES test1 :: forall (f :: * -> *). Applicative f => (Int -> f Int) -> f Int test2 :: - forall (f :: * -> *) b a. - (Applicative f, Num a, Num b) => - (a -> f b) -> f b + forall (f :: * -> *) b t. + (Applicative f, Num t, Num b) => + (t -> f b) -> f b test3 :: - forall (m :: * -> *) a a1 a2. - (Num a2, Monad m) => - (a2 -> m a1) -> (a1 -> a1 -> m a) -> m a + forall (m :: * -> *) a t t1. + (Num t, Monad m) => + (t -> m t1) -> (t1 -> t1 -> m a) -> m a test4 :: - forall (m :: * -> *) a a1 a2. - (Num a2, Monad m) => - (a2 -> m a1) -> (a1 -> a1 -> m a) -> m a + forall (m :: * -> *) a a1 t. + (Num t, Monad m) => + (t -> m a1) -> (a1 -> a1 -> m a) -> m a test5 :: - forall (m :: * -> *) a a1 a2. - (Num a2, Monad m) => - (a2 -> m a1) -> (a1 -> a1 -> m a) -> m a + forall (m :: * -> *) a a1 t. + (Num t, Monad m) => + (t -> m a1) -> (a1 -> a1 -> m a) -> m a test6 :: - forall r (m :: * -> *) a. + forall t (m :: * -> *) a. (Num (m a), Monad m) => - (m a -> m (m a)) -> r -> m a + (m a -> m (m a)) -> t -> m a TYPE CONSTRUCTORS COERCION AXIOMS Dependent modules: [] Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, - integer-gmp-1.0.0.0] + integer-gmp-1.0.0.1] diff --git a/testsuite/tests/annotations/should_fail/annfail10.stderr b/testsuite/tests/annotations/should_fail/annfail10.stderr index 251f0c317c..3d55d4aed4 100644 --- a/testsuite/tests/annotations/should_fail/annfail10.stderr +++ b/testsuite/tests/annotations/should_fail/annfail10.stderr @@ -1,8 +1,8 @@ annfail10.hs:9:1: error: - • Ambiguous type variable ‘a0’ arising from an annotation - prevents the constraint ‘(Data.Data.Data a0)’ from being solved. - Probable fix: use a type annotation to specify what ‘a0’ should be. + • Ambiguous type variable ‘t0’ arising from an annotation + prevents the constraint ‘(Data.Data.Data t0)’ from being solved. + Probable fix: use a type annotation to specify what ‘t0’ should be. These potential instances exist: instance (Data.Data.Data a, Data.Data.Data b) => Data.Data.Data (Either a b) @@ -15,9 +15,9 @@ annfail10.hs:9:1: error: • In the annotation: {-# ANN f 1 #-} annfail10.hs:9:11: error: - • Ambiguous type variable ‘a0’ arising from the literal ‘1’ - prevents the constraint ‘(Num a0)’ from being solved. - Probable fix: use a type annotation to specify what ‘a0’ should be. + • Ambiguous type variable ‘t0’ arising from the literal ‘1’ + prevents the constraint ‘(Num t0)’ from being solved. + Probable fix: use a type annotation to specify what ‘t0’ should be. These potential instances exist: instance Num Integer -- Defined in ‘GHC.Num’ instance Num Double -- Defined in ‘GHC.Float’ diff --git a/testsuite/tests/deSugar/should_run/dsrun017.hs b/testsuite/tests/deSugar/should_run/dsrun017.hs index 7a8d16efe5..7f2ba5db64 100644 --- a/testsuite/tests/deSugar/should_run/dsrun017.hs +++ b/testsuite/tests/deSugar/should_run/dsrun017.hs @@ -8,6 +8,6 @@ import GHC.Exts(the,groupWith) main = putStrLn (show output) where - output = [ (the dept, sum salary, name) + output = [ (the dept, sum salary, name) | (dept, salary, name) <- [("A", 1, "Bob"), ("B", 2, "Fred"), ("A", 5, "Jim"), ("A", 9, "Jim")] - , then group by dept using groupWith ]
\ No newline at end of file + , then group by dept using groupWith ] diff --git a/testsuite/tests/determinism/typecheck/A.hs b/testsuite/tests/determinism/typecheck/A.hs index 50b3ab1db2..1d8c5267db 100644 --- a/testsuite/tests/determinism/typecheck/A.hs +++ b/testsuite/tests/determinism/typecheck/A.hs @@ -39,7 +39,7 @@ instance Data Node where toConstr = toConstr dataTypeOf = dataTypeOf - dataCast1 = undefined + dataCast1 _ = undefined dataCast2 = dataCast2 gmapT = gmapT diff --git a/testsuite/tests/gadt/gadt-escape1.stderr b/testsuite/tests/gadt/gadt-escape1.stderr index 215426ed15..9bcd99cffe 100644 --- a/testsuite/tests/gadt/gadt-escape1.stderr +++ b/testsuite/tests/gadt/gadt-escape1.stderr @@ -1,19 +1,19 @@ gadt-escape1.hs:19:58: error: - • Couldn't match type ‘r’ with ‘ExpGADT Int’ - ‘r’ is untouchable - inside the constraints: t ~ Int + • Couldn't match type ‘t’ with ‘ExpGADT Int’ + ‘t’ is untouchable + inside the constraints: t1 ~ Int bound by a pattern with constructor: ExpInt :: Int -> ExpGADT Int, in a case alternative at gadt-escape1.hs:19:43-50 - ‘r’ is a rigid type variable bound by - the inferred type of weird1 :: r at gadt-escape1.hs:19:1 + ‘t’ is a rigid type variable bound by + the inferred type of weird1 :: t at gadt-escape1.hs:19:1 Possible fix: add a type signature for ‘weird1’ - Expected type: r - Actual type: ExpGADT t + Expected type: t + Actual type: ExpGADT t1 • In the expression: a In a case alternative: Hidden (ExpInt _) a -> a In the expression: case (hval :: Hidden) of { Hidden (ExpInt _) a -> a } • Relevant bindings include - weird1 :: r (bound at gadt-escape1.hs:19:1) + weird1 :: t (bound at gadt-escape1.hs:19:1) diff --git a/testsuite/tests/gadt/gadt13.stderr b/testsuite/tests/gadt/gadt13.stderr index 57ee3fdc92..bc14bf1c51 100644 --- a/testsuite/tests/gadt/gadt13.stderr +++ b/testsuite/tests/gadt/gadt13.stderr @@ -1,17 +1,17 @@ gadt13.hs:15:13: error: - • Couldn't match expected type ‘r’ + • Couldn't match expected type ‘t1’ with actual type ‘String -> [Char]’ - ‘r’ is untouchable + ‘t1’ is untouchable inside the constraints: t ~ Int bound by a pattern with constructor: I :: Int -> Term Int, in an equation for ‘shw’ at gadt13.hs:15:6-8 - ‘r’ is a rigid type variable bound by - the inferred type of shw :: Term t -> r at gadt13.hs:15:1 + ‘t1’ is a rigid type variable bound by + the inferred type of shw :: Term t -> t1 at gadt13.hs:15:1 Possible fix: add a type signature for ‘shw’ • Possible cause: ‘(.)’ is applied to too many arguments In the expression: ("I " ++) . shows t In an equation for ‘shw’: shw (I t) = ("I " ++) . shows t • Relevant bindings include - shw :: Term t -> r (bound at gadt13.hs:15:1) + shw :: Term t -> t1 (bound at gadt13.hs:15:1) diff --git a/testsuite/tests/gadt/gadt7.stderr b/testsuite/tests/gadt/gadt7.stderr index 93b8c70c1f..8219bee032 100644 --- a/testsuite/tests/gadt/gadt7.stderr +++ b/testsuite/tests/gadt/gadt7.stderr @@ -1,20 +1,20 @@ gadt7.hs:16:38: error: - • Couldn't match expected type ‘r’ with actual type ‘r1’ - ‘r’ is untouchable - inside the constraints: t ~ Int + • Couldn't match expected type ‘t2’ with actual type ‘t’ + ‘t2’ is untouchable + inside the constraints: t1 ~ Int bound by a pattern with constructor: K :: T Int, in a case alternative at gadt7.hs:16:33 - ‘r’ is a rigid type variable bound by - the inferred type of i1b :: T t -> r1 -> r at gadt7.hs:16:1 - ‘r1’ is a rigid type variable bound by - the inferred type of i1b :: T t -> r1 -> r at gadt7.hs:16:1 + ‘t2’ is a rigid type variable bound by + the inferred type of i1b :: T t1 -> t -> t2 at gadt7.hs:16:1 + ‘t’ is a rigid type variable bound by + the inferred type of i1b :: T t1 -> t -> t2 at gadt7.hs:16:1 Possible fix: add a type signature for ‘i1b’ • In the expression: y1 In a case alternative: K -> y1 In the expression: case t1 of { K -> y1 } • Relevant bindings include - y1 :: r1 (bound at gadt7.hs:16:16) - y :: r1 (bound at gadt7.hs:16:7) - i1b :: T t -> r1 -> r (bound at gadt7.hs:16:1) + y1 :: t (bound at gadt7.hs:16:16) + y :: t (bound at gadt7.hs:16:7) + i1b :: T t1 -> t -> t2 (bound at gadt7.hs:16:1) diff --git a/testsuite/tests/ghc-api/annotations-literals/parsed.stdout b/testsuite/tests/ghc-api/annotations-literals/parsed.stdout index fdf2bfc739..ce7a004929 100644 --- a/testsuite/tests/ghc-api/annotations-literals/parsed.stdout +++ b/testsuite/tests/ghc-api/annotations-literals/parsed.stdout @@ -1,12 +1,12 @@ HsIntegral [0003] 3 -HsString [] "noSyntaxExpr" +HsString [] "noExpr" HsIntegral [0x04] 4 -HsString [] "noSyntaxExpr" +HsString [] "noExpr" HsString ["\x20"] " " HsChar ['\x20'] ' ' -HsString [] "noSyntaxExpr" +HsString [] "noExpr" HsCharPrim ['\x41'] 'A' HsIntPrim [0004#] 4 HsWordPrim [005##] 5 HsIntegral [1] 1 -HsString [] "noSyntaxExpr" +HsString [] "noExpr" diff --git a/testsuite/tests/ghci.debugger/scripts/break003.stderr b/testsuite/tests/ghci.debugger/scripts/break003.stderr index 66310e5355..d069493986 100644 --- a/testsuite/tests/ghci.debugger/scripts/break003.stderr +++ b/testsuite/tests/ghci.debugger/scripts/break003.stderr @@ -1,5 +1,5 @@ <interactive>:4:1: error: - • No instance for (Show (t -> a2)) arising from a use of ‘print’ + • No instance for (Show (t1 -> t)) arising from a use of ‘print’ (maybe you haven't applied a function to enough arguments?) • In a stmt of an interactive GHCi command: print it diff --git a/testsuite/tests/ghci.debugger/scripts/break003.stdout b/testsuite/tests/ghci.debugger/scripts/break003.stdout index e1f4d351d1..1d0844c6cc 100644 --- a/testsuite/tests/ghci.debugger/scripts/break003.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break003.stdout @@ -1,6 +1,6 @@ Breakpoint 0 activated at ../Test3.hs:2:18-31 Stopped in Main.mymap, ../Test3.hs:2:18-31 -_result :: [a2] = _ -f :: t -> a2 = _ -x :: t = _ -xs :: [t] = [_] +_result :: [t] = _ +f :: t1 -> t = _ +x :: t1 = _ +xs :: [t1] = [_] diff --git a/testsuite/tests/ghci.debugger/scripts/break005.stdout b/testsuite/tests/ghci.debugger/scripts/break005.stdout index d6b287eb58..81eae63726 100644 --- a/testsuite/tests/ghci.debugger/scripts/break005.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break005.stdout @@ -4,7 +4,7 @@ a :: Integer = 1 left :: [Integer] = _ right :: [Integer] = _ Stopped in QSort.qsort, ../QSort.hs:5:17-26 -_result :: [a2] = _ -left :: [a2] = _ +_result :: [t] = _ +left :: [t] = _ () left = [] diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr index 9098cc9c65..3b57eb3a64 100644 --- a/testsuite/tests/ghci.debugger/scripts/break006.stderr +++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr @@ -1,9 +1,9 @@ <interactive>:4:1: error: - • No instance for (Show a2) arising from a use of ‘print’ - Cannot resolve unknown runtime type ‘a2’ + • No instance for (Show t) arising from a use of ‘print’ + Cannot resolve unknown runtime type ‘t’ Use :print or :force to determine these types - Relevant bindings include it :: a2 (bound at <interactive>:4:1) + Relevant bindings include it :: t (bound at <interactive>:4:1) These potential instances exist: instance (Show a, Show b) => Show (Either a b) -- Defined in ‘Data.Either’ @@ -15,10 +15,10 @@ • In a stmt of an interactive GHCi command: print it <interactive>:6:1: error: - • No instance for (Show a2) arising from a use of ‘print’ - Cannot resolve unknown runtime type ‘a2’ + • No instance for (Show t) arising from a use of ‘print’ + Cannot resolve unknown runtime type ‘t’ Use :print or :force to determine these types - Relevant bindings include it :: a2 (bound at <interactive>:6:1) + Relevant bindings include it :: t (bound at <interactive>:6:1) These potential instances exist: instance (Show a, Show b) => Show (Either a b) -- Defined in ‘Data.Either’ diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stdout b/testsuite/tests/ghci.debugger/scripts/break006.stdout index 93326416e0..d8f1b65864 100644 --- a/testsuite/tests/ghci.debugger/scripts/break006.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break006.stdout @@ -1,13 +1,13 @@ Stopped in Main.mymap, ../Test3.hs:2:18-31 -_result :: [a2] = _ -f :: Integer -> a2 = _ +_result :: [t] = _ +f :: Integer -> t = _ x :: Integer = 1 xs :: [Integer] = [2,3] xs :: [Integer] = [2,3] x :: Integer = 1 -f :: Integer -> a2 = _ -_result :: [a2] = _ -y = (_t1::a2) +f :: Integer -> t = _ +_result :: [t] = _ +y = (_t1::t) y = 2 xs :: [Integer] = [2,3] x :: Integer = 1 diff --git a/testsuite/tests/ghci.debugger/scripts/break012.stdout b/testsuite/tests/ghci.debugger/scripts/break012.stdout index 4eed1e61f0..539a894b16 100644 --- a/testsuite/tests/ghci.debugger/scripts/break012.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break012.stdout @@ -1,14 +1,14 @@ Stopped in Main.g, break012.hs:5:10-18 -_result :: (r, a3 -> a3, (), a2 -> a2 -> a2) = _ -a :: r = _ +_result :: (t, a3 -> a3, (), a2 -> a2 -> a2) = _ +a :: t = _ b :: a4 -> a4 = _ c :: () = _ d :: a2 -> a2 -> a2 = _ -a :: r +a :: t b :: a4 -> a4 c :: () d :: a2 -> a2 -> a2 -a = (_t1::r) +a = (_t1::t) b = (_t2::a4 -> a4) c = (_t3::()) d = (_t4::a2 -> a2 -> a2) diff --git a/testsuite/tests/ghci.debugger/scripts/hist001.stdout b/testsuite/tests/ghci.debugger/scripts/hist001.stdout index c5b2787db5..7ef5dc1e8e 100644 --- a/testsuite/tests/ghci.debugger/scripts/hist001.stdout +++ b/testsuite/tests/ghci.debugger/scripts/hist001.stdout @@ -9,25 +9,25 @@ _result :: [a] = _ -6 : mymap (../Test3.hs:2:18-31) <end of history> Logged breakpoint at ../Test3.hs:2:22-31 -_result :: [a2] -f :: t -> a2 -xs :: [t] -xs :: [t] = [] -f :: t -> a2 = _ -_result :: [a2] = _ +_result :: [t] +f :: t1 -> t +xs :: [t1] +xs :: [t1] = [] +f :: t1 -> t = _ +_result :: [t] = _ Logged breakpoint at ../Test3.hs:2:18-20 -_result :: a2 -f :: Integer -> a2 +_result :: t +f :: Integer -> t x :: Integer -xs :: [t] = [] +xs :: [t1] = [] x :: Integer = 2 -f :: Integer -> a2 = _ -_result :: a2 = _ +f :: Integer -> t = _ +_result :: t = _ _result = 3 Logged breakpoint at ../Test3.hs:2:18-31 -_result :: [a2] -f :: Integer -> a2 +_result :: [t] +f :: Integer -> t x :: Integer xs :: [Integer] Logged breakpoint at ../Test3.hs:2:18-20 -_result :: a2 +_result :: t diff --git a/testsuite/tests/ghci.debugger/scripts/print022.stdout b/testsuite/tests/ghci.debugger/scripts/print022.stdout index 47c1483fc4..40d2b59544 100644 --- a/testsuite/tests/ghci.debugger/scripts/print022.stdout +++ b/testsuite/tests/ghci.debugger/scripts/print022.stdout @@ -2,7 +2,7 @@ test = C 1 32 1.2 1.23 'x' 1 1.2 1.23 Breakpoint 0 activated at print022.hs:11:7 Stopped in Main.f, print022.hs:11:7 -_result :: r = _ -x :: r = _ +_result :: t = _ +x :: t = _ x = C2 1 (W# 32) (TwoFields 'a' 3) x :: T2 diff --git a/testsuite/tests/ghci/scripts/T2182ghci.stderr b/testsuite/tests/ghci/scripts/T2182ghci.stderr index dd65a7fc1f..8a8d3dd65b 100644 --- a/testsuite/tests/ghci/scripts/T2182ghci.stderr +++ b/testsuite/tests/ghci/scripts/T2182ghci.stderr @@ -1,25 +1,25 @@ <interactive>:2:1: error: - No instance for (Show (r0 -> r0)) arising from a use of ‘print’ - (maybe you haven't applied a function to enough arguments?) - In a stmt of an interactive GHCi command: print it + • No instance for (Show (t0 -> t0)) arising from a use of ‘print’ + (maybe you haven't applied a function to enough arguments?) + • In a stmt of an interactive GHCi command: print it <interactive>:10:1: error: - No instance for (Show (r0 -> r0)) arising from a use of ‘print’ - (maybe you haven't applied a function to enough arguments?) - In a stmt of an interactive GHCi command: print it + • No instance for (Show (t0 -> t0)) arising from a use of ‘print’ + (maybe you haven't applied a function to enough arguments?) + • In a stmt of an interactive GHCi command: print it <interactive>:19:1: error: - No instance for (Show (r0 -> r0)) arising from a use of ‘print’ - (maybe you haven't applied a function to enough arguments?) - In a stmt of an interactive GHCi command: print it + • No instance for (Show (t0 -> t0)) arising from a use of ‘print’ + (maybe you haven't applied a function to enough arguments?) + • In a stmt of an interactive GHCi command: print it <interactive>:28:1: error: - No instance for (Show (r0 -> r0)) arising from a use of ‘print’ - (maybe you haven't applied a function to enough arguments?) - In a stmt of an interactive GHCi command: print it + • No instance for (Show (t0 -> t0)) arising from a use of ‘print’ + (maybe you haven't applied a function to enough arguments?) + • In a stmt of an interactive GHCi command: print it <interactive>:49:1: error: - No instance for (Show (r0 -> r0)) arising from a use of ‘print’ - (maybe you haven't applied a function to enough arguments?) - In a stmt of an interactive GHCi command: print it + • No instance for (Show (t0 -> t0)) arising from a use of ‘print’ + (maybe you haven't applied a function to enough arguments?) + • In a stmt of an interactive GHCi command: print it diff --git a/testsuite/tests/ghci/scripts/T8959.script b/testsuite/tests/ghci/scripts/T8959.script index da60aeb44e..e8f7490111 100644 --- a/testsuite/tests/ghci/scripts/T8959.script +++ b/testsuite/tests/ghci/scripts/T8959.script @@ -1,20 +1,22 @@ :set -XPatternGuards -XArrows -XRankNTypes +let hr :: (forall a. a -> a) -> a; hr _ = undefined + :t lookup -:t undefined :: (forall a. a -> a) -> a +:t hr :: (forall a. a -> a) -> a :t () >- () -< () >>- () -<< () let fun foo | True <- () = () :set -fprint-unicode-syntax :t lookup -:t undefined :: (forall a. a -> a) -> a +:t hr :: (forall a. a -> a) -> a :t () >- () -< () >>- () -<< () let fun foo | True <- () = () :set -fno-print-unicode-syntax :t lookup -:t undefined :: (forall a. a -> a) -> a +:t hr :: (forall a. a -> a) -> a :t () >- () -< () >>- () -<< () let fun foo | True <- () = () diff --git a/testsuite/tests/ghci/scripts/T8959.stderr b/testsuite/tests/ghci/scripts/T8959.stderr index 2c1d5e5d25..2890a172c2 100644 --- a/testsuite/tests/ghci/scripts/T8959.stderr +++ b/testsuite/tests/ghci/scripts/T8959.stderr @@ -1,36 +1,36 @@ -<interactive>:1:1: +<interactive>:1:1: error: Arrow command found where an expression was expected: () >- () -< () >>- () -<< () -<interactive>:6:15: - Couldn't match expected type ‘()’ with actual type ‘Bool’ - In the pattern: True - In a stmt of a pattern guard for - an equation for ‘fun’: - True <- () - In an equation for ‘fun’: fun foo | True <- () = () +<interactive>:8:15: error: + • Couldn't match expected type ‘()’ with actual type ‘Bool’ + • In the pattern: True + In a stmt of a pattern guard for + an equation for ‘fun’: + True <- () + In an equation for ‘fun’: fun foo | True <- () = () -<interactive>:1:1: +<interactive>:1:1: error: Arrow command found where an expression was expected: () ⤚ () ⤙ () ⤜ () ⤛ () -<interactive>:13:15: - Couldn't match expected type ‘()’ with actual type ‘Bool’ - In the pattern: True - In a stmt of a pattern guard for - an equation for ‘fun’: - True ← () - In an equation for ‘fun’: fun foo | True ← () = () +<interactive>:15:15: error: + • Couldn't match expected type ‘()’ with actual type ‘Bool’ + • In the pattern: True + In a stmt of a pattern guard for + an equation for ‘fun’: + True ← () + In an equation for ‘fun’: fun foo | True ← () = () -<interactive>:1:1: +<interactive>:1:1: error: Arrow command found where an expression was expected: () >- () -< () >>- () -<< () -<interactive>:20:15: - Couldn't match expected type ‘()’ with actual type ‘Bool’ - In the pattern: True - In a stmt of a pattern guard for - an equation for ‘fun’: - True <- () - In an equation for ‘fun’: fun foo | True <- () = () +<interactive>:22:15: error: + • Couldn't match expected type ‘()’ with actual type ‘Bool’ + • In the pattern: True + In a stmt of a pattern guard for + an equation for ‘fun’: + True <- () + In an equation for ‘fun’: fun foo | True <- () = () diff --git a/testsuite/tests/ghci/scripts/T8959.stdout b/testsuite/tests/ghci/scripts/T8959.stdout index 02b5f828c2..6e40a5f316 100644 --- a/testsuite/tests/ghci/scripts/T8959.stdout +++ b/testsuite/tests/ghci/scripts/T8959.stdout @@ -1,11 +1,6 @@ lookup :: Eq a => a -> [(a, b)] -> Maybe b -undefined :: (forall a. a -> a) -> a - :: (?callStack::GHC.Stack.Types.CallStack) => - (forall a1. a1 -> a1) -> a +hr :: (forall a. a -> a) -> a :: (forall a1. a1 -> a1) -> a lookup ∷ Eq a ⇒ a → [(a, b)] → Maybe b -undefined :: (forall a. a -> a) -> a - ∷ (?callStack::GHC.Stack.Types.CallStack) ⇒ (∀ a1. a1 → a1) → a +hr :: (forall a. a -> a) -> a ∷ (∀ a1. a1 → a1) → a lookup :: Eq a => a -> [(a, b)] -> Maybe b -undefined :: (forall a. a -> a) -> a - :: (?callStack::GHC.Stack.Types.CallStack) => - (forall a1. a1 -> a1) -> a +hr :: (forall a. a -> a) -> a :: (forall a1. a1 -> a1) -> a diff --git a/testsuite/tests/indexed-types/should_compile/T3484.hs b/testsuite/tests/indexed-types/should_compile/T3484.hs index e558cbbe21..1d53b320d2 100644 --- a/testsuite/tests/indexed-types/should_compile/T3484.hs +++ b/testsuite/tests/indexed-types/should_compile/T3484.hs @@ -8,9 +8,9 @@ newtype S n = S n class Nat n where caseNat :: (n ~ Z => r) -> (forall p. (n ~ S p, Nat p) => p -> r) -> n -> r instance Nat Z where - caseNat = error "urk1" + caseNat _ _ = error "urk1" instance Nat n => Nat (S n) where - caseNat = error "urk2" + caseNat _ _ = error "urk2" -- empty type newtype Naught = Naught (forall a. a) @@ -40,4 +40,4 @@ natEqDec m n = caseNat undefined mIsS m where -- strange things: -- (1) commenting out the "Yes" case or changing it to "undefined" makes compilation succeed --- (2) replacing the "No" line with with the commented out "No" line makes compilation succeed
\ No newline at end of file +-- (2) replacing the "No" line with with the commented out "No" line makes compilation succeed diff --git a/testsuite/tests/indexed-types/should_compile/T4120.hs b/testsuite/tests/indexed-types/should_compile/T4120.hs index 3b1475916d..ffa729aa8a 100644 --- a/testsuite/tests/indexed-types/should_compile/T4120.hs +++ b/testsuite/tests/indexed-types/should_compile/T4120.hs @@ -17,10 +17,8 @@ create :: (forall s. MVector s a) -> Int create = create1 -- Here we get Couldn't match expected type `forall s. MVector s a' -- with actual type `forall s. Mutable Vector s a1' --- Reason: when unifying under a for-all we don't solve type +-- Reason: when unifying under a for-all we don't solve type -- equalities. Think more about this. create1 :: (forall s. Mutable Vector s a) -> Int -create1 = error "urk" - - +create1 _ = error "urk" diff --git a/testsuite/tests/indexed-types/should_compile/T4494.hs b/testsuite/tests/indexed-types/should_compile/T4494.hs index ec04943d6b..ef8887ac9c 100644 --- a/testsuite/tests/indexed-types/should_compile/T4494.hs +++ b/testsuite/tests/indexed-types/should_compile/T4494.hs @@ -6,7 +6,7 @@ type family H s type family F v bar :: (forall t. Maybe t -> a) -> H a -> Int -bar = error "urk" +bar _ = error "urk" call :: F Bool -> Int call x = bar (\_ -> x) (undefined :: H (F Bool)) @@ -29,4 +29,3 @@ fuv1 := fuv2 alpha := F Bool -} - diff --git a/testsuite/tests/indexed-types/should_compile/T9090.hs b/testsuite/tests/indexed-types/should_compile/T9090.hs index b3b639f126..7dc065d639 100644 --- a/testsuite/tests/indexed-types/should_compile/T9090.hs +++ b/testsuite/tests/indexed-types/should_compile/T9090.hs @@ -10,7 +10,7 @@ type instance F (Eq a) = Eq a -- checks f :: Eq b => (forall a. F (Eq a) => f a -> Bool) -> f b -> Bool -f = error "urk" -- g x = g x +f _ = error "urk" -- g x = g x -- checks f' :: Eq b => (forall a. Eq a => f a -> Bool) -> f b -> Bool diff --git a/testsuite/tests/indexed-types/should_compile/T9316.hs b/testsuite/tests/indexed-types/should_compile/T9316.hs index 31da8f4791..473c213965 100644 --- a/testsuite/tests/indexed-types/should_compile/T9316.hs +++ b/testsuite/tests/indexed-types/should_compile/T9316.hs @@ -54,7 +54,7 @@ withSomeSing :: SingKind ('KProxy :: KProxy k) => DemoteRep ('KProxy :: KProxy k) -> (forall (a :: k). Sing a -> r) -> r -withSomeSing = error "urk" +withSomeSing _ _ = error "urk" ----------------------------------- diff --git a/testsuite/tests/indexed-types/should_fail/T3330a.hs b/testsuite/tests/indexed-types/should_fail/T3330a.hs index 51d97d5e1d..55bf067238 100644 --- a/testsuite/tests/indexed-types/should_fail/T3330a.hs +++ b/testsuite/tests/indexed-types/should_fail/T3330a.hs @@ -44,5 +44,4 @@ collect = error "collect" hmapM :: (forall ix. phi ix -> r ix -> m (r' ix)) -> phi ix -> f r ix -> m (f r' ix) -hmapM = error "hmapM" - +hmapM _ = error "hmapM" diff --git a/testsuite/tests/indexed-types/should_fail/T5934.stderr b/testsuite/tests/indexed-types/should_fail/T5934.stderr index 8460105c2f..20b16b273b 100644 --- a/testsuite/tests/indexed-types/should_fail/T5934.stderr +++ b/testsuite/tests/indexed-types/should_fail/T5934.stderr @@ -1,7 +1,6 @@ -T5934.hs:12:7: - Couldn't match type ‘Integer’ with ‘(forall s. GenST s) -> Int’ - Expected type: Integer -> (forall s. GenST s) -> Int - Actual type: Integer -> Integer - In the expression: 0 - In an equation for ‘run’: run = 0 +T5934.hs:12:7: error: + • Couldn't match expected type ‘(forall s. GenST s) -> Int’ + with actual type ‘Integer’ + • In the expression: 0 + In an equation for ‘run’: run = 0 diff --git a/testsuite/tests/indexed-types/should_fail/T7788.stderr b/testsuite/tests/indexed-types/should_fail/T7788.stderr index fa4f3ed260..65c78aea3b 100644 --- a/testsuite/tests/indexed-types/should_fail/T7788.stderr +++ b/testsuite/tests/indexed-types/should_fail/T7788.stderr @@ -1,11 +1,10 @@ -T7788.hs:19:20: error: +T7788.hs:9:7: error: • Reduction stack overflow; size = 201 When simplifying the following type: F (Id (Fix Id)) Use -freduction-depth=0 to disable this check (any upper bound you could choose might fail unpredictably with minor updates to GHC, so disabling the check is recommended if you're sure that type checking should terminate) - • In the first argument of ‘foo’, namely ‘Proxy’ - In the second argument of ‘($)’, namely ‘foo Proxy’ - In the expression: print $ foo Proxy + • In the expression: undefined + In an equation for ‘foo’: foo = undefined diff --git a/testsuite/tests/indexed-types/should_fail/T8518.stderr b/testsuite/tests/indexed-types/should_fail/T8518.stderr index 0df2b3cf83..037bb76bbe 100644 --- a/testsuite/tests/indexed-types/should_fail/T8518.stderr +++ b/testsuite/tests/indexed-types/should_fail/T8518.stderr @@ -1,7 +1,10 @@ T8518.hs:14:18: error: - • Couldn't match expected type ‘Maybe (F c)’ with actual type ‘F c’ - • In the expression: rpt (4 :: Int) c z b + • Couldn't match expected type ‘Z c -> B c -> Maybe (F c)’ + with actual type ‘F c’ + • The function ‘rpt’ is applied to four arguments, + but its type ‘Int -> c -> F c’ has only two + In the expression: rpt (4 :: Int) c z b In an equation for ‘callCont’: callCont c z b = rpt (4 :: Int) c z b @@ -14,19 +17,15 @@ T8518.hs:14:18: error: c :: c (bound at T8518.hs:14:10) callCont :: c -> Z c -> B c -> Maybe (F c) (bound at T8518.hs:14:1) -T8518.hs:17:78: error: - • Couldn't match expected type ‘F a’ - with actual type ‘Z a -> B a -> F a’ - • In the expression: rpt (i - 1) c'' - In the expression: - let c'' = fromJust (snd <$> (continue c' z' b')) in rpt (i - 1) c'' - In an equation for ‘rpt’: - rpt i c' z' b' - = let c'' = fromJust (snd <$> (continue c' z' b')) - in rpt (i - 1) c'' +T8518.hs:16:9: error: + • Couldn't match type ‘F t1’ with ‘Z t1 -> B t1 -> F t1’ + Expected type: t -> t1 -> F t1 + Actual type: t -> t1 -> Z t1 -> B t1 -> F t1 + • In an equation for ‘callCont’: + callCont c z b + = rpt (4 :: Int) c z b + where + rpt 0 c' z' b' = fromJust (fst <$> (continue c' z' b')) + rpt i c' z' b' = let ... in rpt (i - 1) c'' • Relevant bindings include - c'' :: a (bound at T8518.hs:17:30) - b' :: B a (bound at T8518.hs:17:21) - z' :: Z a (bound at T8518.hs:17:18) - c' :: a (bound at T8518.hs:17:15) - rpt :: a1 -> a -> Z a -> B a -> F a (bound at T8518.hs:16:9) + rpt :: t -> t1 -> F t1 (bound at T8518.hs:16:9) diff --git a/testsuite/tests/module/mod71.stderr b/testsuite/tests/module/mod71.stderr index 9c72697300..9480e92271 100644 --- a/testsuite/tests/module/mod71.stderr +++ b/testsuite/tests/module/mod71.stderr @@ -2,11 +2,11 @@ mod71.hs:4:9: error: • Found hole: _ :: t Where: ‘t’ is a rigid type variable bound by - the inferred type of f :: Num a => (t -> a -> r) -> r + the inferred type of f :: Num t1 => (t -> t1 -> t2) -> t2 at mod71.hs:4:1 • In the first argument of ‘x’, namely ‘_’ In the expression: x _ 1 In an equation for ‘f’: f x = x _ 1 • Relevant bindings include - x :: t -> a -> r (bound at mod71.hs:4:3) - f :: (t -> a -> r) -> r (bound at mod71.hs:4:1) + x :: t -> t1 -> t2 (bound at mod71.hs:4:3) + f :: (t -> t1 -> t2) -> t2 (bound at mod71.hs:4:1) diff --git a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail03.hs b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail03.hs index d1981846df..25d859d2a8 100644 --- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail03.hs +++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail03.hs @@ -1,3 +1,3 @@ {-# LANGUAGE OverloadedLists #-} -main = print (length ['a',"b"]) +main = print (length (['a',"b"] :: [Char])) diff --git a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail03.stderr b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail03.stderr index 9c2e41640e..4d55087e18 100644 --- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail03.stderr +++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail03.stderr @@ -1,6 +1,9 @@ -overloadedlistsfail03.hs:3:27: - Couldn't match expected type ‘Char’ with actual type ‘[Char]’ - In the expression: "b" - In the first argument of ‘length’, namely ‘['a', "b"]’ - In the first argument of ‘print’, namely ‘(length ['a', "b"])’ +overloadedlistsfail03.hs:3:28: error: + • Couldn't match type ‘[Char]’ with ‘Char’ + Expected type: GHC.Exts.Item [Char] + Actual type: [Char] + • In the expression: "b" + In the first argument of ‘length’, namely ‘(['a', "b"] :: [Char])’ + In the first argument of ‘print’, namely + ‘(length (['a', "b"] :: [Char]))’ diff --git a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail05.hs b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail05.hs index 3601c6e2f1..7059b4b5aa 100644 --- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail05.hs +++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail05.hs @@ -1,3 +1,3 @@ {-# LANGUAGE OverloadedLists #-} -main = print (length ['a'..(10 :: Int)]) +main = print (length (['a'..(10 :: Int)] :: [Int])) diff --git a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail05.stderr b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail05.stderr index c576b5868c..edd0c7fcef 100644 --- a/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail05.stderr +++ b/testsuite/tests/overloadedlists/should_fail/overloadedlistsfail05.stderr @@ -1,7 +1,10 @@ -overloadedlistsfail05.hs:3:29: - Couldn't match expected type ‘Char’ with actual type ‘Int’ - In the expression: (10 :: Int) - In the first argument of ‘length’, namely ‘['a' .. (10 :: Int)]’ - In the first argument of ‘print’, namely - ‘(length ['a' .. (10 :: Int)])’ +overloadedlistsfail05.hs:3:24: error: + • Couldn't match type ‘Char’ with ‘Int’ + Expected type: GHC.Exts.Item [Int] + Actual type: Char + • In the expression: 'a' + In the first argument of ‘length’, namely + ‘(['a' .. (10 :: Int)] :: [Int])’ + In the first argument of ‘print’, namely + ‘(length (['a' .. (10 :: Int)] :: [Int]))’ diff --git a/testsuite/tests/parser/should_compile/read014.stderr b/testsuite/tests/parser/should_compile/read014.stderr index ebc07af88e..030b2c52de 100644 --- a/testsuite/tests/parser/should_compile/read014.stderr +++ b/testsuite/tests/parser/should_compile/read014.stderr @@ -1,13 +1,13 @@ read014.hs:4:1: warning: Top-level binding with no type signature: - ng1 :: forall r a. Num a => r -> a -> a + ng1 :: forall t a. Num a => t -> a -> a read014.hs:4:5: warning: Defined but not used: ‘x’ read014.hs:6:10: warning: - No explicit implementation for - ‘+’, ‘*’, ‘abs’, ‘signum’, and ‘fromInteger’ - In the instance declaration for ‘Num (a, b)’ + • No explicit implementation for + ‘+’, ‘*’, ‘abs’, ‘signum’, and ‘fromInteger’ + • In the instance declaration for ‘Num (a, b)’ read014.hs:8:53: warning: Defined but not used: ‘x’ diff --git a/testsuite/tests/parser/should_fail/T7848.stderr b/testsuite/tests/parser/should_fail/T7848.stderr index b957433e9b..f7617ee606 100644 --- a/testsuite/tests/parser/should_fail/T7848.stderr +++ b/testsuite/tests/parser/should_fail/T7848.stderr @@ -1,33 +1,19 @@ -T7848.hs:6:57: error: +T7848.hs:6:1: error: • Occurs check: cannot construct the infinite type: - t2 ~ r0 -> t -> t1 -> A -> A -> A -> A -> t2 - • In the expression: y - In an equation for ‘x’: - x (+) ((&)@z) ((:&&) a b) (c :&& d) (e `A` f) (A g h) - = y - where - infixl 3 `y` - y _ = (&) - {-# INLINE (&) #-} - {-# SPECIALIZE (&) :: a #-} - (&) = x - • Relevant bindings include - y :: forall r. r -> t -> t1 -> A -> A -> A -> A -> t2 - (bound at T7848.hs:8:9) - (&) :: t -> t1 -> A -> A -> A -> A -> t2 (bound at T7848.hs:11:9) - z :: t1 (bound at T7848.hs:6:12) - (&) :: t1 (bound at T7848.hs:6:8) - (+) :: t (bound at T7848.hs:6:3) - x :: t -> t1 -> A -> A -> A -> A -> t2 (bound at T7848.hs:6:1) + t ~ t0 -> t1 -> A -> A -> A -> A -> t2 -> t + • When checking that: + t0 -> t1 -> A -> A -> A -> A -> forall t2. t2 -> t + is more polymorphic than: t + • Relevant bindings include x :: t (bound at T7848.hs:6:1) T7848.hs:10:9: error: - • Couldn't match expected type ‘t -> t1 -> A -> A -> A -> A -> t2’ - with actual type ‘a’ - ‘a’ is a rigid type variable bound by + • Couldn't match expected type ‘t’ with actual type ‘a’ + because type variable ‘a’ would escape its scope + This (rigid, skolem) type variable is bound by the type signature for: - (&) :: forall a. a - at T7848.hs:10:9 + (&) :: a + at T7848.hs:10:9-35 • In the SPECIALISE pragma {-# SPECIALIZE (&) :: a #-} In an equation for ‘x’: x (+) ((&)@z) ((:&&) a b) (c :&& d) (e `A` f) (A g h) @@ -38,8 +24,4 @@ T7848.hs:10:9: error: {-# INLINE (&) #-} {-# SPECIALIZE (&) :: a #-} (&) = x - • Relevant bindings include - z :: t1 (bound at T7848.hs:6:12) - (&) :: t1 (bound at T7848.hs:6:8) - (+) :: t (bound at T7848.hs:6:3) - x :: t -> t1 -> A -> A -> A -> A -> t2 (bound at T7848.hs:6:1) + • Relevant bindings include x :: t (bound at T7848.hs:6:1) diff --git a/testsuite/tests/partial-sigs/should_compile/T10438.stderr b/testsuite/tests/partial-sigs/should_compile/T10438.stderr index f26bfe7a8d..d04fca208b 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10438.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10438.stderr @@ -1,8 +1,8 @@ T10438.hs:7:22: warning: - • Found type wildcard ‘_’ standing for ‘r2’ - Where: ‘r2’ is a rigid type variable bound by - the inferred type of g :: r2 -> r2 at T10438.hs:6:9 + • Found type wildcard ‘_’ standing for ‘t2’ + Where: ‘t2’ is a rigid type variable bound by + the inferred type of g :: t2 -> t2 at T10438.hs:6:9 • In the type signature: x :: _ In an equation for ‘g’: @@ -21,8 +21,8 @@ T10438.hs:7:22: warning: x :: _ x = r • Relevant bindings include - x :: r2 (bound at T10438.hs:8:17) - r :: r2 (bound at T10438.hs:6:11) - g :: r2 -> r2 (bound at T10438.hs:6:9) - f :: r (bound at T10438.hs:5:5) - foo :: r -> forall r1. r1 -> r1 (bound at T10438.hs:5:1) + x :: t2 (bound at T10438.hs:8:17) + r :: t2 (bound at T10438.hs:6:11) + g :: t2 -> t2 (bound at T10438.hs:6:9) + f :: t (bound at T10438.hs:5:5) + foo :: t -> forall t1. t1 -> t1 (bound at T10438.hs:5:1) diff --git a/testsuite/tests/partial-sigs/should_compile/T11192.stderr b/testsuite/tests/partial-sigs/should_compile/T11192.stderr index 77b70e3fe2..f2892b7fae 100644 --- a/testsuite/tests/partial-sigs/should_compile/T11192.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T11192.stderr @@ -21,11 +21,11 @@ T11192.hs:7:14: warning: fails :: a (bound at T11192.hs:6:1) T11192.hs:13:14: warning: - • Found type wildcard ‘_’ standing for ‘t -> t1 -> t1’ - Where: ‘t1’ is a rigid type variable bound by - the inferred type of go :: t -> t1 -> t1 at T11192.hs:14:8 - ‘t’ is a rigid type variable bound by - the inferred type of go :: t -> t1 -> t1 at T11192.hs:14:8 + • Found type wildcard ‘_’ standing for ‘t1 -> t -> t’ + Where: ‘t’ is a rigid type variable bound by + the inferred type of go :: t1 -> t -> t at T11192.hs:14:8 + ‘t1’ is a rigid type variable bound by + the inferred type of go :: t1 -> t -> t at T11192.hs:14:8 • In the type signature: go :: _ In the expression: @@ -40,5 +40,5 @@ T11192.hs:13:14: warning: go _ a = a in go (0 :: Int) undefined • Relevant bindings include - go :: t -> t1 -> t1 (bound at T11192.hs:14:8) + go :: t1 -> t -> t (bound at T11192.hs:14:8) succeeds :: a (bound at T11192.hs:12:1) diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 9c3daa71b1..13ac9b8286 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -603,12 +603,13 @@ test('T9020', [(wordsize(32), 343005716, 10), # Original: 381360728 # 2014-07-31: 343005716 (Windows) (general round of updates) - (wordsize(64), 786189008, 10)]) + (wordsize(64), 698401736, 10)]) # prev: 795469104 # 2014-07-17: 728263536 (general round of updates) # 2014-09-10: 785871680 post-AMP-cleanup # 2014-11-03: 680162056 Further Applicative and Monad adjustments # 2015-10-21: 786189008 Make stronglyConnCompFromEdgedVertices deterministic + # 2016-01-26: 698401736 improvement from using ExpTypes instead of ReturnTvs ], compile,['']) diff --git a/testsuite/tests/polykinds/T7438.stderr b/testsuite/tests/polykinds/T7438.stderr index 46b7181840..d3ed001879 100644 --- a/testsuite/tests/polykinds/T7438.stderr +++ b/testsuite/tests/polykinds/T7438.stderr @@ -1,19 +1,19 @@ T7438.hs:6:14: error: - • Couldn't match expected type ‘r1’ with actual type ‘r’ - ‘r1’ is untouchable + • Couldn't match expected type ‘t3’ with actual type ‘t2’ + ‘t3’ is untouchable inside the constraints: t1 ~ t bound by a pattern with constructor: Nil :: forall k (a :: k). Thrist a a, in an equation for ‘go’ at T7438.hs:6:4-6 - ‘r1’ is a rigid type variable bound by - the inferred type of go :: Thrist t t1 -> r -> r1 at T7438.hs:6:1 - ‘r’ is a rigid type variable bound by - the inferred type of go :: Thrist t t1 -> r -> r1 at T7438.hs:6:1 + ‘t3’ is a rigid type variable bound by + the inferred type of go :: Thrist t t1 -> t2 -> t3 at T7438.hs:6:1 + ‘t2’ is a rigid type variable bound by + the inferred type of go :: Thrist t t1 -> t2 -> t3 at T7438.hs:6:1 Possible fix: add a type signature for ‘go’ • In the expression: acc In an equation for ‘go’: go Nil acc = acc • Relevant bindings include - acc :: r (bound at T7438.hs:6:8) - go :: Thrist t t1 -> r -> r1 (bound at T7438.hs:6:1) + acc :: t2 (bound at T7438.hs:6:8) + go :: Thrist t t1 -> t2 -> t3 (bound at T7438.hs:6:1) diff --git a/testsuite/tests/rebindable/rebindable6.hs b/testsuite/tests/rebindable/rebindable6.hs index ec975e7f37..3ec03477d2 100644 --- a/testsuite/tests/rebindable/rebindable6.hs +++ b/testsuite/tests/rebindable/rebindable6.hs @@ -3,6 +3,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE TypeFamilies #-} module Main where { @@ -88,7 +89,7 @@ module Main where negate :: a; }; - instance HasNegate (a -> a) where + instance (b ~ (a -> a)) => HasNegate b where { negate a = a; -- don't actually negate }; @@ -98,7 +99,7 @@ module Main where (-) :: a; }; - instance HasMinus (a -> a -> a) where + instance (b ~ (a -> a -> a)) => HasMinus b where { (-) x y = y; -- changed function }; diff --git a/testsuite/tests/rebindable/rebindable6.stderr b/testsuite/tests/rebindable/rebindable6.stderr index 0497c9fc61..8d2ea09928 100644 --- a/testsuite/tests/rebindable/rebindable6.stderr +++ b/testsuite/tests/rebindable/rebindable6.stderr @@ -1,18 +1,18 @@ -rebindable6.hs:109:17: error: +rebindable6.hs:110:17: error: • Ambiguous type variable ‘t0’ arising from a do statement prevents the constraint ‘(HasSeq (IO a -> t0 -> IO b))’ from being solved. (maybe you haven't applied a function to enough arguments?) Relevant bindings include - g :: IO (Maybe b) (bound at rebindable6.hs:107:19) - f :: IO a (bound at rebindable6.hs:107:17) + g :: IO (Maybe b) (bound at rebindable6.hs:108:19) + f :: IO a (bound at rebindable6.hs:108:17) test_do :: IO a -> IO (Maybe b) -> IO b - (bound at rebindable6.hs:107:9) + (bound at rebindable6.hs:108:9) Probable fix: use a type annotation to specify what ‘t0’ should be. These potential instance exist: instance HasSeq (IO a -> IO b -> IO b) - -- Defined at rebindable6.hs:55:18 + -- Defined at rebindable6.hs:56:18 • In a stmt of a 'do' block: f In the expression: do { f; @@ -24,7 +24,7 @@ rebindable6.hs:109:17: error: Just (b :: b) <- g; return b } -rebindable6.hs:110:17: error: +rebindable6.hs:111:17: error: • Ambiguous type variable ‘t1’ arising from a do statement with the failable pattern ‘Just (b :: b)’ prevents the constraint ‘(HasFail @@ -33,7 +33,7 @@ rebindable6.hs:110:17: error: Probable fix: use a type annotation to specify what ‘t1’ should be. These potential instance exist: instance HasFail (String -> IO a) - -- Defined at rebindable6.hs:60:18 + -- Defined at rebindable6.hs:61:18 • In a stmt of a 'do' block: Just (b :: b) <- g In the expression: do { f; @@ -45,18 +45,18 @@ rebindable6.hs:110:17: error: Just (b :: b) <- g; return b } -rebindable6.hs:111:17: error: +rebindable6.hs:112:17: error: • Ambiguous type variable ‘t1’ arising from a use of ‘return’ prevents the constraint ‘(HasReturn (b -> t1))’ from being solved. (maybe you haven't applied a function to enough arguments?) Relevant bindings include - b :: b (bound at rebindable6.hs:110:23) - g :: IO (Maybe b) (bound at rebindable6.hs:107:19) + b :: b (bound at rebindable6.hs:111:23) + g :: IO (Maybe b) (bound at rebindable6.hs:108:19) test_do :: IO a -> IO (Maybe b) -> IO b - (bound at rebindable6.hs:107:9) + (bound at rebindable6.hs:108:9) Probable fix: use a type annotation to specify what ‘t1’ should be. These potential instance exist: - instance HasReturn (a -> IO a) -- Defined at rebindable6.hs:45:18 + instance HasReturn (a -> IO a) -- Defined at rebindable6.hs:46:18 • In a stmt of a 'do' block: return b In the expression: do { f; diff --git a/testsuite/tests/rename/should_compile/T3103/GHC/Num.hs b/testsuite/tests/rename/should_compile/T3103/GHC/Num.hs new file mode 100644 index 0000000000..1d403249f2 --- /dev/null +++ b/testsuite/tests/rename/should_compile/T3103/GHC/Num.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE NoImplicitPrelude #-} + +module GHC.Num (fromInteger) where + +import GHC.Base +import GHC.Integer + +fromInteger :: Num a => Integer -> a +fromInteger = fromInteger diff --git a/testsuite/tests/rename/should_compile/T3103/GHC/Word.hs b/testsuite/tests/rename/should_compile/T3103/GHC/Word.hs index 6866e92879..c0172640cd 100644 --- a/testsuite/tests/rename/should_compile/T3103/GHC/Word.hs +++ b/testsuite/tests/rename/should_compile/T3103/GHC/Word.hs @@ -6,10 +6,10 @@ module GHC.Word ( import GHC.Base import GHC.Types +import GHC.Num () import {-# SOURCE #-} GHC.Unicode () instance Num Word where signum 0 = 0 signum _ = 1 - diff --git a/testsuite/tests/th/T11452.hs b/testsuite/tests/th/T11452.hs new file mode 100644 index 0000000000..8d91ee47c9 --- /dev/null +++ b/testsuite/tests/th/T11452.hs @@ -0,0 +1,6 @@ +{-# LANGUAGE RankNTypes, TemplateHaskell #-} + +module T11452 where + +impred :: (forall a. a -> a) -> () +impred = $$( [|| \_ -> () ||] ) diff --git a/testsuite/tests/th/T11452.stderr b/testsuite/tests/th/T11452.stderr new file mode 100644 index 0000000000..f59fcbd7d2 --- /dev/null +++ b/testsuite/tests/th/T11452.stderr @@ -0,0 +1,15 @@ + +T11452.hs:6:14: error: + • Illegal polytype: (forall a. a -> a) -> () + The type of a Typed Template Haskell expression must not have any quantification. + • In the Template Haskell splice $$([|| \ _ -> () ||]) + In the expression: $$([|| \ _ -> () ||]) + In an equation for ‘impred’: impred = $$([|| \ _ -> () ||]) + +T11452.hs:6:14: error: + • Cannot instantiate unification variable ‘t0’ + with a type involving foralls: forall a. a -> a + GHC doesn't yet support impredicative polymorphism + • In the Template Haskell quotation [|| \ _ -> () ||] + In the expression: [|| \ _ -> () ||] + In the Template Haskell splice $$([|| \ _ -> () ||]) diff --git a/testsuite/tests/th/T2222.stderr b/testsuite/tests/th/T2222.stderr index b0a7e9f799..4ddf100bf6 100644 --- a/testsuite/tests/th/T2222.stderr +++ b/testsuite/tests/th/T2222.stderr @@ -1,4 +1,4 @@ -inside b: a_0 +inside b: t_0 inside d: GHC.Types.Bool type of c: GHC.Types.Bool inside f: GHC.Types.Bool diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index db6ee4e399..3d040b6e52 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -398,3 +398,4 @@ test('T11345', normal, compile_and_run, ['-v0 -dsuppress-uniques']) test('TH_finalizer', normal, compile, ['-v0']) test('T10603', normal, compile, ['-ddump-splices -dsuppress-uniques']) +test('T11452', normal, compile_fail, ['-v0']) diff --git a/testsuite/tests/typecheck/should_compile/RebindHR.hs b/testsuite/tests/typecheck/should_compile/RebindHR.hs new file mode 100644 index 0000000000..01a1e042ec --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/RebindHR.hs @@ -0,0 +1,26 @@ +{-# LANGUAGE RebindableSyntax, GADTs, RankNTypes, TypeOperators, ScopedTypeVariables #-} + +module RebindHR where + +import Prelude hiding ( (>>=) ) +import Data.Typeable + +data Exp = Int Int | Plus Exp Exp | Bool Bool +data TExp a where + TInt :: Int -> TExp Int + TPlus :: TExp Int -> TExp Int -> TExp Int + TBool :: Bool -> TExp Bool + +(>>=) :: ((forall t. Typeable t => TExp t -> Maybe r) -> Maybe r) + -> (forall t. Typeable t => TExp t -> Maybe r) + -> Maybe r +x >>= y = x y + +check :: Exp -> (forall t. Typeable t => TExp t -> Maybe r) -> Maybe r +check (Int n) k = k (TInt n) +check (Bool b) k = k (TBool b) +check (Plus e1 e2) k = do te1 :: TExp ty1 <- check e1 + te2 :: TExp ty2 <- check e2 + case (eqT :: Maybe (ty1 :~: Int), eqT :: Maybe (ty2 :~: Int)) of + (Just Refl, Just Refl) -> k (TPlus te1 te2) + _ -> Nothing diff --git a/testsuite/tests/typecheck/should_compile/RebindNegate.hs b/testsuite/tests/typecheck/should_compile/RebindNegate.hs new file mode 100644 index 0000000000..bb5fc49692 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/RebindNegate.hs @@ -0,0 +1,9 @@ +{-# LANGUAGE RebindableSyntax #-} + +module RebindNegate where + +import Prelude ( length ) + +negate = length + +y = - "foo" diff --git a/testsuite/tests/typecheck/should_compile/T11397.hs b/testsuite/tests/typecheck/should_compile/T11397.hs new file mode 100644 index 0000000000..6e8a939472 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11397.hs @@ -0,0 +1,69 @@ +module T11397 where + + +f :: a -> [Maybe a] +f x = + let switch l = [l Nothing, l (Just x)] + in switch id + +u :: a +u = u + +f2 :: a +f2 = let switch l = l u in switch u + + +f3 :: a +f3 = let switch l = l undefined in switch undefined + + +newtype VectorLazy a = VectorLazy a +newtype Vector a = Vector a +newtype Pointer a = Pointer a + +empty :: VectorLazy a +empty = undefined + +cons :: Vector a -> Pointer a +cons = undefined + +unfoldrResult :: (a -> Either c (b, a)) -> a -> (VectorLazy b, c) +unfoldrResult = undefined + +switchL :: b -> (a -> Pointer a -> b) -> Pointer a -> b +switchL = undefined + +inverseFrequencyModulationChunk :: + (Num t, Ord t) => + (s -> Maybe (t,s)) -> (t,s) -> Vector v -> (VectorLazy v, Maybe (t,s)) +inverseFrequencyModulationChunk nextC (phase,cst0) chunk = + let {- + switch :: + (Maybe (t, s) -> r) -> + ((t, v) -> (s, Pointer v) -> r) -> + t -> + (s, Pointer v) -> r + -} + switch l r t (cp0,xp0) = + maybe + (l Nothing) + (\(c1,cp1) -> + switchL + (l (Just (t,cp0))) + (\x1 xp1 -> r (t+c1,x1) (cp1,xp1)) + xp0) + (nextC cp0) + + {- + go :: + (t,v) -> (s, Pointer v) -> + Either (Maybe (t,s)) (v, ((t,v), (s, Pointer v))) + -} + go (c,x) cxp = + if c<1 + then switch Left go c cxp + else Right (x, ((c-1,x),cxp)) + + in switch ((,) empty) + (curry $ unfoldrResult (uncurry go)) + phase (cst0, cons chunk) diff --git a/testsuite/tests/typecheck/should_compile/T11458.hs b/testsuite/tests/typecheck/should_compile/T11458.hs new file mode 100644 index 0000000000..b0f8cfa513 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/T11458.hs @@ -0,0 +1,5 @@ +module T11458 where + +optIntArg f = (f Nothing, f (Just True)) + +optIntArg2 f = (f (Just True), f Nothing) diff --git a/testsuite/tests/typecheck/should_compile/T2683.hs b/testsuite/tests/typecheck/should_compile/T2683.hs index 9f3591af46..d38e590323 100644 --- a/testsuite/tests/typecheck/should_compile/T2683.hs +++ b/testsuite/tests/typecheck/should_compile/T2683.hs @@ -10,7 +10,7 @@ class Transformer t a | t -> a where data EL a = forall l. EL (l a) unEL :: EL a -> (forall l. l a -> b) -> b -unEL = error "unEL" +unEL _ _ = error "unEL" transform' :: (Transformer t a) => t -> EL a -> EL a transform' = error "transform'" diff --git a/testsuite/tests/typecheck/should_compile/T7888.hs b/testsuite/tests/typecheck/should_compile/T7888.hs index 63fe6ab7de..1930f0b92f 100644 --- a/testsuite/tests/typecheck/should_compile/T7888.hs +++ b/testsuite/tests/typecheck/should_compile/T7888.hs @@ -4,8 +4,12 @@ module T7888 where import GHC.Err( undefined )
import GHC.Prim
+{- The fix for #11431 makes this no longer work. But it shouldn't really,
+without impredicativity.
f :: (forall a. a) -> b
f = undefined
+-}
+-- this still had better work, though!
g :: Int -> Int#
g _ = undefined
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 5975ed0fe9..e6f0cfa30e 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -498,3 +498,7 @@ test('T11462', ('T11462.hs', '')], '-dynamic']) test('T11480', normal, compile, ['']) +test('RebindHR', normal, compile, ['']) +test('RebindNegate', normal, compile, ['']) +test('T11397', normal, compile, ['']) +test('T11458', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_compile/tc141.stderr b/testsuite/tests/typecheck/should_compile/tc141.stderr index e0de74c945..15bdad80c3 100644 --- a/testsuite/tests/typecheck/should_compile/tc141.stderr +++ b/testsuite/tests/typecheck/should_compile/tc141.stderr @@ -35,7 +35,7 @@ tc141.hs:13:13: error: in v tc141.hs:15:18: error: - • Couldn't match expected type ‘a1’ with actual type ‘r1’ + • Couldn't match expected type ‘a1’ with actual type ‘t1’ because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: @@ -50,5 +50,5 @@ tc141.hs:15:18: error: in v • Relevant bindings include v :: a1 (bound at tc141.hs:15:14) - b :: r1 (bound at tc141.hs:13:5) - g :: r -> r1 -> forall a. a (bound at tc141.hs:13:1) + b :: t1 (bound at tc141.hs:13:5) + g :: t -> t1 -> forall a. a (bound at tc141.hs:13:1) diff --git a/testsuite/tests/typecheck/should_compile/tc158.hs b/testsuite/tests/typecheck/should_compile/tc158.hs index 1e8b661d10..25879b067d 100644 --- a/testsuite/tests/typecheck/should_compile/tc158.hs +++ b/testsuite/tests/typecheck/should_compile/tc158.hs @@ -9,4 +9,4 @@ type All u = forall x. x->u type All' u = u -> All u all1 :: All u -> (u -> All u) -> All u -all1 = undefined +all1 _ _ = undefined diff --git a/testsuite/tests/typecheck/should_compile/twins.hs b/testsuite/tests/typecheck/should_compile/twins.hs index f87b5a5ea3..3fdc5b80df 100644 --- a/testsuite/tests/typecheck/should_compile/twins.hs +++ b/testsuite/tests/typecheck/should_compile/twins.hs @@ -1,7 +1,7 @@ {-# OPTIONS_GHC -fno-warn-redundant-constraints #-} {-# LANGUAGE RankNTypes, LiberalTypeSynonyms #-} --- This test checks that deep skolemisation and deep +-- This test checks that deep skolemisation and deep -- instanatiation work right. A buggy prototype -- of GHC 7.0, where the type checker generated wrong -- code, sent applyTypeToArgs into a loop. @@ -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"
\ No newline at end of file +orElse = error "urk" diff --git a/testsuite/tests/typecheck/should_fail/FDsFromGivens2.hs b/testsuite/tests/typecheck/should_fail/FDsFromGivens2.hs index 83b6e32ccf..b3e3d2c574 100644 --- a/testsuite/tests/typecheck/should_fail/FDsFromGivens2.hs +++ b/testsuite/tests/typecheck/should_fail/FDsFromGivens2.hs @@ -11,4 +11,5 @@ data KCC where f :: C Char [a] => a -> a f = undefined +bar :: KCC -> a -> a bar (KCC _) = f diff --git a/testsuite/tests/typecheck/should_fail/FDsFromGivens2.stderr b/testsuite/tests/typecheck/should_fail/FDsFromGivens2.stderr index a084b303dd..00e55ea20a 100644 --- a/testsuite/tests/typecheck/should_fail/FDsFromGivens2.stderr +++ b/testsuite/tests/typecheck/should_fail/FDsFromGivens2.stderr @@ -1,14 +1,14 @@ -FDsFromGivens2.hs:14:15: error: - Couldn't match type ‘Char’ with ‘[a]’ - arising from a functional dependency between constraints: - ‘C Char [a]’ arising from a use of ‘f’ at FDsFromGivens2.hs:14:15 - ‘C Char Char’ - arising from a pattern with constructor: - KCC :: C Char Char => () -> KCC, - in an equation for ‘bar’ - at FDsFromGivens2.hs:14:6-10 - In the expression: f - In an equation for ‘bar’: bar (KCC _) = f - Relevant bindings include - bar :: KCC -> a -> a (bound at FDsFromGivens2.hs:14:1) +FDsFromGivens2.hs:15:15: error: + • Couldn't match type ‘Char’ with ‘[a]’ + arising from a functional dependency between constraints: + ‘C Char [a]’ arising from a use of ‘f’ at FDsFromGivens2.hs:15:15 + ‘C Char Char’ + arising from a pattern with constructor: + KCC :: C Char Char => () -> KCC, + in an equation for ‘bar’ + at FDsFromGivens2.hs:15:6-10 + • In the expression: f + In an equation for ‘bar’: bar (KCC _) = f + • Relevant bindings include + bar :: KCC -> a -> a (bound at FDsFromGivens2.hs:15:1) diff --git a/testsuite/tests/typecheck/should_fail/T10619.stderr b/testsuite/tests/typecheck/should_fail/T10619.stderr index 5ed7cfed68..e002759ba0 100644 --- a/testsuite/tests/typecheck/should_fail/T10619.stderr +++ b/testsuite/tests/typecheck/should_fail/T10619.stderr @@ -17,7 +17,7 @@ T10619.hs:9:15: error: else \ y -> y • Relevant bindings include - foo :: r -> (b -> b) -> b -> b (bound at T10619.hs:8:1) + foo :: t -> (b -> b) -> b -> b (bound at T10619.hs:8:1) T10619.hs:14:15: error: • Couldn't match type ‘b’ with ‘a’ @@ -42,7 +42,7 @@ T10619.hs:14:15: error: else ((\ x -> x) :: (forall a. a -> a) -> forall b. b -> b) • Relevant bindings include - bar :: r -> (b -> b) -> b -> b (bound at T10619.hs:12:1) + bar :: t -> (b -> b) -> b -> b (bound at T10619.hs:12:1) T10619.hs:16:13: error: • Couldn't match type ‘forall a. a -> a’ with ‘b -> b’ diff --git a/testsuite/tests/typecheck/should_fail/T3613.stderr b/testsuite/tests/typecheck/should_fail/T3613.stderr index b7ffd671c8..6d3c70346b 100644 --- a/testsuite/tests/typecheck/should_fail/T3613.stderr +++ b/testsuite/tests/typecheck/should_fail/T3613.stderr @@ -9,7 +9,9 @@ T3613.hs:14:20: error: let fooThen m = foo >> m in fooThen (bar >> undefined) T3613.hs:17:24: error: - • Couldn't match expected type ‘Maybe a0’ with actual type ‘IO ()’ + • Couldn't match type ‘IO’ with ‘Maybe’ + Expected type: Maybe () + Actual type: 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/T5570.stderr b/testsuite/tests/typecheck/should_fail/T5570.stderr index 8c4ace5173..710104012d 100644 --- a/testsuite/tests/typecheck/should_fail/T5570.stderr +++ b/testsuite/tests/typecheck/should_fail/T5570.stderr @@ -1,7 +1,6 @@ T5570.hs:7:16: error: - • Couldn't match a lifted type with an unlifted type - When matching the kind of ‘Double#’ + • Expecting a lifted type, but ‘Double#’ is unlifted • In the second argument of ‘($)’, namely ‘D# $ 3.0##’ In the expression: print $ D# $ 3.0## In an equation for ‘main’: main = print $ D# $ 3.0## diff --git a/testsuite/tests/typecheck/should_fail/T7453.stderr b/testsuite/tests/typecheck/should_fail/T7453.stderr index 47bfa78754..bcb2df84c8 100644 --- a/testsuite/tests/typecheck/should_fail/T7453.stderr +++ b/testsuite/tests/typecheck/should_fail/T7453.stderr @@ -1,13 +1,13 @@ T7453.hs:9:15: error: - • Couldn't match type ‘r’ with ‘t’ - because type variable ‘t’ would escape its scope + • Couldn't match type ‘t’ with ‘t1’ + because type variable ‘t1’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: Id t + z :: Id t1 at T7453.hs:8:11-19 - Expected type: Id t - Actual type: Id r + Expected type: Id t1 + Actual type: Id t • In the expression: aux In an equation for ‘z’: z = aux @@ -22,20 +22,20 @@ T7453.hs:9:15: error: where aux = Id v • Relevant bindings include - aux :: Id r (bound at T7453.hs:10:21) - z :: Id t (bound at T7453.hs:9:11) - v :: r (bound at T7453.hs:7:7) - cast1 :: r -> a (bound at T7453.hs:7:1) + aux :: Id t (bound at T7453.hs:10:21) + z :: Id t1 (bound at T7453.hs:9:11) + v :: t (bound at T7453.hs:7:7) + cast1 :: t -> a (bound at T7453.hs:7:1) T7453.hs:15:15: error: - • Couldn't match type ‘r’ with ‘t1’ - because type variable ‘t1’ would escape its scope + • Couldn't match type ‘t’ with ‘t2’ + because type variable ‘t2’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: () -> t1 + z :: () -> t2 at T7453.hs:14:11-22 - Expected type: () -> t1 - Actual type: () -> r + Expected type: () -> t2 + Actual type: () -> t • In the expression: aux In an equation for ‘z’: z = aux @@ -50,17 +50,17 @@ T7453.hs:15:15: error: where aux = const v • Relevant bindings include - aux :: forall b. b -> r (bound at T7453.hs:16:21) - z :: () -> t1 (bound at T7453.hs:15:11) - v :: r (bound at T7453.hs:13:7) - cast2 :: r -> t (bound at T7453.hs:13:1) + aux :: forall b. b -> t (bound at T7453.hs:16:21) + z :: () -> t2 (bound at T7453.hs:15:11) + v :: t (bound at T7453.hs:13:7) + cast2 :: t -> t1 (bound at T7453.hs:13:1) T7453.hs:21:15: error: - • Couldn't match expected type ‘t1’ with actual type ‘r’ - because type variable ‘t1’ would escape its scope + • Couldn't match expected type ‘t2’ with actual type ‘t’ + because type variable ‘t2’ would escape its scope This (rigid, skolem) type variable is bound by the type signature for: - z :: t1 + z :: t2 at T7453.hs:20:11-16 • In the expression: v In an equation for ‘z’: @@ -76,7 +76,7 @@ T7453.hs:21:15: error: where aux = const v • Relevant bindings include - aux :: forall b. b -> r (bound at T7453.hs:22:21) - z :: t1 (bound at T7453.hs:21:11) - v :: r (bound at T7453.hs:19:7) - cast3 :: r -> forall t. t (bound at T7453.hs:19:1) + aux :: forall b. b -> t (bound at T7453.hs:22:21) + z :: t2 (bound at T7453.hs:21:11) + v :: t (bound at T7453.hs:19:7) + cast3 :: t -> forall t1. t1 (bound at T7453.hs:19:1) diff --git a/testsuite/tests/typecheck/should_fail/T7734.stderr b/testsuite/tests/typecheck/should_fail/T7734.stderr index 53536d1a13..1b1716bfc5 100644 --- a/testsuite/tests/typecheck/should_fail/T7734.stderr +++ b/testsuite/tests/typecheck/should_fail/T7734.stderr @@ -1,18 +1,18 @@ T7734.hs:4:13: error: - • Occurs check: cannot construct the infinite type: r2 ~ r2 -> r1 + • Occurs check: cannot construct the infinite type: t1 ~ t1 -> t2 • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘f’: x `f` y = x x • Relevant bindings include - x :: r2 -> r1 (bound at T7734.hs:4:1) - f :: (r2 -> r1) -> r -> r1 (bound at T7734.hs:4:1) + x :: t1 -> t2 (bound at T7734.hs:4:1) + f :: (t1 -> t2) -> t -> t2 (bound at T7734.hs:4:3) T7734.hs:5:13: error: - • Occurs check: cannot construct the infinite type: r2 ~ r2 -> r1 + • Occurs check: cannot construct the infinite type: t1 ~ t1 -> t2 • In the first argument of ‘x’, namely ‘x’ In the expression: x x In an equation for ‘&’: (&) x y = x x • Relevant bindings include - x :: r2 -> r1 (bound at T7734.hs:5:5) - (&) :: (r2 -> r1) -> r -> r1 (bound at T7734.hs:5:1) + x :: t1 -> t2 (bound at T7734.hs:5:5) + (&) :: (t1 -> t2) -> t -> t2 (bound at T7734.hs:5:1) diff --git a/testsuite/tests/typecheck/should_fail/T8603.stderr b/testsuite/tests/typecheck/should_fail/T8603.stderr index 53d4e422cb..baf3264734 100644 --- a/testsuite/tests/typecheck/should_fail/T8603.stderr +++ b/testsuite/tests/typecheck/should_fail/T8603.stderr @@ -5,11 +5,11 @@ T8603.hs:13:10: error: • In the instance declaration for ‘Monad RV’ T8603.hs:29:17: error: - • Couldn't match type ‘RV a0’ with ‘StateT s RV t0’ - Expected type: [Integer] -> StateT s RV t0 - Actual type: (->) ((->) [a0]) (RV a0) + • Couldn't match type ‘RV a1’ with ‘StateT s RV a0’ + Expected type: [Integer] -> StateT s RV a0 + Actual type: (->) ((->) [a1]) (RV a1) • The function ‘lift’ is applied to two arguments, - but its type ‘([a0] -> RV a0) -> (->) ((->) [a0]) (RV a0)’ + but its type ‘([a1] -> RV a1) -> (->) ((->) [a1]) (RV a1)’ has only one In a stmt of a 'do' block: prize <- lift uniform [1, 2, 3] In the expression: diff --git a/testsuite/tests/typecheck/should_fail/T9109.stderr b/testsuite/tests/typecheck/should_fail/T9109.stderr index f13b0fc310..6a08318ac0 100644 --- a/testsuite/tests/typecheck/should_fail/T9109.stderr +++ b/testsuite/tests/typecheck/should_fail/T9109.stderr @@ -1,14 +1,15 @@ T9109.hs:8:13: error: - • Couldn't match expected type ‘r’ with actual type ‘Bool’ - ‘r’ is untouchable + • Couldn't match expected type ‘t1’ with actual type ‘Bool’ + ‘t1’ is untouchable inside the constraints: t ~ Bool bound by a pattern with constructor: GBool :: G Bool, in an equation for ‘foo’ at T9109.hs:8:5-9 - ‘r’ is a rigid type variable bound by - the inferred type of foo :: G t -> r at T9109.hs:8:1 + ‘t1’ is a rigid type variable bound by + the inferred type of foo :: G t -> t1 at T9109.hs:8:1 Possible fix: add a type signature for ‘foo’ • In the expression: True In an equation for ‘foo’: foo GBool = True - • Relevant bindings include foo :: G t -> r (bound at T9109.hs:8:1) + • Relevant bindings include + foo :: G t -> t1 (bound at T9109.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/VtaFail.stderr b/testsuite/tests/typecheck/should_fail/VtaFail.stderr index ea435e4f19..6d11a4a46c 100644 --- a/testsuite/tests/typecheck/should_fail/VtaFail.stderr +++ b/testsuite/tests/typecheck/should_fail/VtaFail.stderr @@ -13,7 +13,7 @@ VtaFail.hs:12:26: error: answer_constraint_fail = addOne @Bool 5 VtaFail.hs:14:17: error: - • Cannot apply expression of type ‘r0 -> r0’ + • Cannot apply expression of type ‘t0 -> t0’ to a visible type argument ‘Int’ • In the expression: (\ x -> x) @Int 12 In an equation for ‘answer_lambda’: diff --git a/testsuite/tests/typecheck/should_fail/tcfail014.stderr b/testsuite/tests/typecheck/should_fail/tcfail014.stderr index 6b88e835ed..a186fb1310 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail014.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail014.stderr @@ -1,9 +1,9 @@ tcfail014.hs:5:33: error: - • Occurs check: cannot construct the infinite type: r8 ~ r8 -> r7 + • Occurs check: cannot construct the infinite type: t7 ~ t7 -> t8 • In the first argument of ‘z’, namely ‘z’ In the expression: z z In an equation for ‘h’: h z = z z • Relevant bindings include - z :: r8 -> r7 (bound at tcfail014.hs:5:27) - h :: (r8 -> r7) -> r7 (bound at tcfail014.hs:5:25) + z :: t7 -> t8 (bound at tcfail014.hs:5:27) + h :: (t7 -> t8) -> t8 (bound at tcfail014.hs:5:25) diff --git a/testsuite/tests/typecheck/should_fail/tcfail016.stderr b/testsuite/tests/typecheck/should_fail/tcfail016.stderr index cb1fa945e7..949cb65855 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail016.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail016.stderr @@ -1,24 +1,7 @@ -tcfail016.hs:9:20: error: +tcfail016.hs:8:1: error: • Couldn't match type ‘(t, Expr t)’ with ‘Expr t’ - Expected type: Expr t - Actual type: AnnExpr t - • In the first argument of ‘g’, namely ‘e1’ - In the first argument of ‘(++)’, namely ‘(g e1)’ - In the expression: (g e1) ++ (g e2) + Expected type: AnnExpr t -> [[Char]] + Actual type: Expr t -> [[Char]] • Relevant bindings include - e2 :: AnnExpr t (bound at tcfail016.hs:9:11) - e1 :: AnnExpr t (bound at tcfail016.hs:9:8) - g :: Expr t -> [[Char]] (bound at tcfail016.hs:8:1) - -tcfail016.hs:9:28: error: - • Couldn't match type ‘(t, Expr t)’ with ‘Expr t’ - Expected type: Expr t - Actual type: AnnExpr t - • In the first argument of ‘g’, namely ‘e2’ - In the second argument of ‘(++)’, namely ‘(g e2)’ - In the expression: (g e1) ++ (g e2) - • Relevant bindings include - e2 :: AnnExpr t (bound at tcfail016.hs:9:11) - e1 :: AnnExpr t (bound at tcfail016.hs:9:8) - g :: Expr t -> [[Char]] (bound at tcfail016.hs:8:1) + g :: AnnExpr t -> [[Char]] (bound at tcfail016.hs:8:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail032.stderr b/testsuite/tests/typecheck/should_fail/tcfail032.stderr index 79ec408274..ce3ce2d018 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail032.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail032.stderr @@ -1,6 +1,6 @@ tcfail032.hs:14:8: error: - • Couldn't match expected type ‘a1 -> Int’ with actual type ‘r’ + • Couldn't match expected type ‘a1 -> Int’ with actual type ‘t’ because type variable ‘a1’ would escape its scope This (rigid, skolem) type variable is bound by an expression type signature: @@ -9,5 +9,5 @@ tcfail032.hs:14:8: error: • In the expression: (x :: (Eq a) => a -> Int) In an equation for ‘f’: f x = (x :: (Eq a) => a -> Int) • Relevant bindings include - x :: r (bound at tcfail032.hs:14:3) - f :: r -> forall a. Eq a => a -> Int (bound at tcfail032.hs:14:1) + x :: t (bound at tcfail032.hs:14:3) + f :: t -> forall a. Eq a => a -> Int (bound at tcfail032.hs:14:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail099.stderr b/testsuite/tests/typecheck/should_fail/tcfail099.stderr index 3ba8165766..f3908f36e4 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail099.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail099.stderr @@ -1,6 +1,6 @@ tcfail099.hs:9:20: error: - • Couldn't match expected type ‘a’ with actual type ‘r’ + • Couldn't match expected type ‘a’ with actual type ‘t’ because type variable ‘a’ would escape its scope This (rigid, skolem) type variable is bound by a pattern with constructor: C :: forall a. (a -> Int) -> DS, @@ -10,6 +10,6 @@ tcfail099.hs:9:20: error: In the expression: f arg In an equation for ‘call’: call (C f) arg = f arg • Relevant bindings include - arg :: r (bound at tcfail099.hs:9:12) + arg :: t (bound at tcfail099.hs:9:12) f :: a -> Int (bound at tcfail099.hs:9:9) - call :: DS -> r -> Int (bound at tcfail099.hs:9:1) + call :: DS -> t -> Int (bound at tcfail099.hs:9:1) diff --git a/testsuite/tests/typecheck/should_fail/tcfail104.stderr b/testsuite/tests/typecheck/should_fail/tcfail104.stderr index b6c21e5e82..a0a6595231 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail104.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail104.stderr @@ -1,11 +1,13 @@ -tcfail104.hs:14:15: error: - • Couldn't match expected type ‘forall a. a -> a’ - with actual type ‘Char -> Char’ - • 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 +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 + • When checking that: (forall a. a -> a) -> forall a. a -> a + is more polymorphic than: (Char -> Char) -> 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) tcfail104.hs:22:15: error: • Couldn't match expected type ‘forall a. a -> a’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail140.stderr b/testsuite/tests/typecheck/should_fail/tcfail140.stderr index b3bf602200..4c3fecec43 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail140.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail140.stderr @@ -9,14 +9,14 @@ tcfail140.hs:10:7: error: • Relevant bindings include bar :: t (bound at tcfail140.hs:10:1) tcfail140.hs:12:10: error: - • Couldn't match expected type ‘Integer -> t’ + • Couldn't match expected type ‘Integer -> t1’ with actual type ‘Int’ • The operator ‘f’ takes two arguments, but its type ‘Int -> Int’ has only one In the expression: 3 `f` 4 In an equation for ‘rot’: rot xs = 3 `f` 4 • Relevant bindings include - rot :: r -> t (bound at tcfail140.hs:12:1) + rot :: t -> t1 (bound at tcfail140.hs:12:1) tcfail140.hs:14:15: error: • Couldn't match expected type ‘t -> b’ with actual type ‘Int’ @@ -31,8 +31,9 @@ tcfail140.hs:14:15: error: tcfail140.hs:16:8: error: • The constructor ‘Just’ should have 1 argument, but has been given none • In the pattern: Just + The lambda expression ‘\ Just x -> x’ has two arguments, + but its type ‘Maybe a -> a’ has only one In the expression: (\ Just x -> x) :: Maybe a -> a - In the expression: ((\ Just x -> x) :: Maybe a -> a) (Just 1) tcfail140.hs:19:1: error: • Couldn't match expected type ‘Int’ with actual type ‘t0 -> Bool’ diff --git a/testsuite/tests/typecheck/should_fail/tcfail159.stderr b/testsuite/tests/typecheck/should_fail/tcfail159.stderr index e28363a707..412ba47d3f 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail159.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail159.stderr @@ -1,7 +1,6 @@ tcfail159.hs:9:11: error: - Couldn't match a lifted type with an unlifted type - When matching the kind of ‘(# Int, Int #)’ - In the pattern: ~(# p, q #) - In a case alternative: ~(# p, q #) -> p - In the expression: case h x of { ~(# p, q #) -> p } + • Expecting a lifted type, but got an unlifted + • In the pattern: ~(# p, q #) + In a case alternative: ~(# p, q #) -> p + In the expression: case h x of { ~(# p, q #) -> p } diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.stderr b/testsuite/tests/typecheck/should_fail/tcfail181.stderr index 6cf22a9f61..a231133fd4 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail181.stderr +++ b/testsuite/tests/typecheck/should_fail/tcfail181.stderr @@ -3,7 +3,7 @@ tcfail181.hs:17:9: error: • Could not deduce (Monad m0) arising from a use of ‘foo’ from the context: Monad m bound by the inferred type of - wog :: Monad m => r -> Something (m Bool) e + wog :: Monad m => t -> Something (m Bool) e at tcfail181.hs:17:1-30 The type variable ‘m0’ is ambiguous These potential instances exist: |