diff options
Diffstat (limited to 'testsuite/tests/ado')
-rw-r--r-- | testsuite/tests/ado/T13242a.stderr | 13 | ||||
-rw-r--r-- | testsuite/tests/ado/T14163.hs | 13 | ||||
-rw-r--r-- | testsuite/tests/ado/T14163.stdin | 3 | ||||
-rw-r--r-- | testsuite/tests/ado/T14163.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/ado/ado-optimal.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/ado/ado001.hs | 4 | ||||
-rw-r--r-- | testsuite/tests/ado/ado004.hs | 18 | ||||
-rw-r--r-- | testsuite/tests/ado/ado004.stderr | 28 | ||||
-rw-r--r-- | testsuite/tests/ado/all.T | 1 |
9 files changed, 64 insertions, 21 deletions
diff --git a/testsuite/tests/ado/T13242a.stderr b/testsuite/tests/ado/T13242a.stderr index dc4564f168..f31307df50 100644 --- a/testsuite/tests/ado/T13242a.stderr +++ b/testsuite/tests/ado/T13242a.stderr @@ -1,11 +1,10 @@ T13242a.hs:10:5: error: • Couldn't match expected type ‘a0’ with actual type ‘a’ - because type variable ‘a’ would escape its scope - This (rigid, skolem) type variable is bound by + ‘a’ is a rigid type variable bound by a pattern with constructor: A :: forall a. Eq a => a -> T, in a pattern binding in - 'do' block + a 'do' block at T13242a.hs:10:3-5 • In the expression: do A x <- undefined @@ -28,10 +27,10 @@ T13242a.hs:13:11: error: These potential instances exist: instance Eq Ordering -- Defined in ‘GHC.Classes’ instance Eq Integer - -- Defined in ‘integer-gmp-1.0.0.1:GHC.Integer.Type’ - instance Eq a => Eq (Maybe a) -- Defined in ‘GHC.Base’ - ...plus 22 others - ...plus five instances involving out-of-scope types + -- Defined in ‘integer-gmp-1.0.2.0:GHC.Integer.Type’ + instance Eq () -- Defined in ‘GHC.Classes’ + ...plus 21 others + ...plus six instances involving out-of-scope types (use -fprint-potential-instances to see them all) • In a stmt of a 'do' block: return (x == x) In the expression: diff --git a/testsuite/tests/ado/T14163.hs b/testsuite/tests/ado/T14163.hs new file mode 100644 index 0000000000..9463c1c5fc --- /dev/null +++ b/testsuite/tests/ado/T14163.hs @@ -0,0 +1,13 @@ +{-# language ApplicativeDo #-} + +import GHC.Exts + +readIt :: IO (Int, Int) +readIt = readLn + +main :: IO () +main = do + (_, _) <- readIt + (_, _) <- readIt + (_, _) <- readIt + print "Done" diff --git a/testsuite/tests/ado/T14163.stdin b/testsuite/tests/ado/T14163.stdin new file mode 100644 index 0000000000..0f620463b5 --- /dev/null +++ b/testsuite/tests/ado/T14163.stdin @@ -0,0 +1,3 @@ +(1,2) +(3,4) +(5,6) diff --git a/testsuite/tests/ado/T14163.stdout b/testsuite/tests/ado/T14163.stdout new file mode 100644 index 0000000000..5a32621be4 --- /dev/null +++ b/testsuite/tests/ado/T14163.stdout @@ -0,0 +1 @@ +"Done" diff --git a/testsuite/tests/ado/ado-optimal.hs b/testsuite/tests/ado/ado-optimal.hs index d67aa4fb1a..5e3266e8c2 100644 --- a/testsuite/tests/ado/ado-optimal.hs +++ b/testsuite/tests/ado/ado-optimal.hs @@ -3,7 +3,7 @@ module Main where import Control.Applicative -import Text.PrettyPrint +import Text.PrettyPrint as PP (a:b:c:d:e:f:g:h:_) = map (\c -> doc [c]) ['a'..] @@ -64,7 +64,7 @@ instance Monad M where (Nothing,Nothing) -> (Nothing, b) (Just d, Nothing) -> (Just d, b) (Nothing, Just d) -> (Just d, b) - (Just d1, Just d2) -> (Just (maybeParen p (d1 <> semi <+> d2)), b) + (Just d1, Just d2) -> (Just (maybeParen p (d1 PP.<> semi <+> d2)), b) doc :: String -> M () doc d = M $ \_ -> (Just (text d), ()) diff --git a/testsuite/tests/ado/ado001.hs b/testsuite/tests/ado/ado001.hs index 0d466c5fd1..6abce177e0 100644 --- a/testsuite/tests/ado/ado001.hs +++ b/testsuite/tests/ado/ado001.hs @@ -2,7 +2,7 @@ module Main where import Control.Applicative -import Text.PrettyPrint +import Text.PrettyPrint as PP (a:b:c:d:e:f:g:h:_) = map (\c -> doc [c]) ['a'..] @@ -175,7 +175,7 @@ instance Monad M where (Nothing,Nothing) -> (Nothing, b) (Just d, Nothing) -> (Just d, b) (Nothing, Just d) -> (Just d, b) - (Just d1, Just d2) -> (Just (maybeParen p (d1 <> semi <+> d2)), b) + (Just d1, Just d2) -> (Just (maybeParen p (d1 PP.<> semi <+> d2)), b) doc :: String -> M () doc d = M $ \_ -> (Just (text d), ()) diff --git a/testsuite/tests/ado/ado004.hs b/testsuite/tests/ado/ado004.hs index fa3c7231de..e7166c008e 100644 --- a/testsuite/tests/ado/ado004.hs +++ b/testsuite/tests/ado/ado004.hs @@ -16,6 +16,19 @@ test1a f = do y <- f 4 return $ x + y +-- When one of the statements is a BodyStmt +test1b :: Applicative f => (Int -> f Int) -> f Int +test1b f = do + x <- f 3 + f 4 + return x + +test1c :: Applicative f => (Int -> f Int) -> f Int +test1c f = do + f 3 + x <- f 4 + return x + -- Test we can also infer the Applicative version of the type test2 f = do x <- f 3 @@ -32,6 +45,11 @@ test2c f = do x <- f 3 return $ x + 1 +-- with a BodyStmt +test2d f = do + f 3 + return 4 + -- Test for just one statement test2b f = do return (f 3) diff --git a/testsuite/tests/ado/ado004.stderr b/testsuite/tests/ado/ado004.stderr index 726309d49a..c0f7838b08 100644 --- a/testsuite/tests/ado/ado004.stderr +++ b/testsuite/tests/ado/ado004.stderr @@ -3,38 +3,46 @@ TYPE SIGNATURES forall (f :: * -> *). Applicative f => (Int -> f Int) -> f Int test1a :: forall (f :: * -> *). Applicative f => (Int -> f Int) -> f Int + test1b :: + forall (f :: * -> *). Applicative f => (Int -> f Int) -> f Int + test1c :: + forall (f :: * -> *). Applicative f => (Int -> f Int) -> f Int test2 :: forall (f :: * -> *) t b. - (Num b, Num t, Applicative f) => + (Applicative f, Num t, Num b) => (t -> f b) -> f b test2a :: forall (f :: * -> *) t b. - (Num b, Num t, Functor f) => + (Functor f, Num t, Num b) => (t -> f b) -> f b test2b :: - forall (m :: * -> *) t a. (Num t, Monad m) => (t -> a) -> m a + forall (m :: * -> *) t a. (Monad m, Num t) => (t -> a) -> m a test2c :: forall (f :: * -> *) t b. - (Num b, Num t, Functor f) => + (Functor f, Num t, Num b) => (t -> f b) -> f b + test2d :: + forall (f :: * -> *) t1 b t2. + (Functor f, Num t1, Num b) => + (t1 -> f t2) -> f b test3 :: forall (m :: * -> *) t1 t2 a. - (Num t1, Monad m) => + (Monad m, Num t1) => (t1 -> m t2) -> (t2 -> t2 -> m a) -> m a test4 :: forall (m :: * -> *) t a1 a2. - (Num t, Monad m) => + (Monad m, Num t) => (t -> m a1) -> (a1 -> a1 -> m a2) -> m a2 test5 :: forall (m :: * -> *) t a1 a2. - (Num t, Monad m) => + (Monad m, Num t) => (t -> m a1) -> (a1 -> a1 -> m a2) -> m a2 test6 :: forall (m :: * -> *) a p. - (Num (m a), Monad m) => + (Monad m, Num (m a)) => (m a -> m (m a)) -> p -> m a TYPE CONSTRUCTORS COERCION AXIOMS Dependent modules: [] -Dependent packages: [base-4.10.0.0, ghc-prim-0.5.1.0, - integer-gmp-1.0.0.1] +Dependent packages: [base-4.12.0.0, ghc-prim-0.5.3, + integer-gmp-1.0.2.0] diff --git a/testsuite/tests/ado/all.T b/testsuite/tests/ado/all.T index bb1cc163d1..d88e907315 100644 --- a/testsuite/tests/ado/all.T +++ b/testsuite/tests/ado/all.T @@ -11,3 +11,4 @@ test('T12490', normal, compile, ['']) test('T13242', normal, compile, ['']) test('T13242a', normal, compile_fail, ['']) test('T13875', normal, compile_and_run, ['']) +test('T14163', normal, compile_and_run, ['']) |