[commit: ghc] master: Test #14884, #14969 (07abff7)

git at git.haskell.org git at git.haskell.org
Mon Apr 2 13:43:17 UTC 2018


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/07abff7192dcc9ce667d3c5cdb3f34ca8c87f2fb/ghc

>---------------------------------------------------------------

commit 07abff7192dcc9ce667d3c5cdb3f34ca8c87f2fb
Author: Richard Eisenberg <rae at cs.brynmawr.edu>
Date:   Mon Apr 2 09:39:19 2018 -0400

    Test #14884, #14969
    
    These were fixed by faec8d358985e5d0bf363bd96f23fe76c9e281f7
    
    test cases: typecheck/should_fail/T14884
                ghci/scripts/T14969


>---------------------------------------------------------------

07abff7192dcc9ce667d3c5cdb3f34ca8c87f2fb
 testsuite/tests/ghci/scripts/T14969.script         |  1 +
 testsuite/tests/ghci/scripts/T14969.stderr         |  7 ++++
 testsuite/tests/ghci/scripts/all.T                 |  1 +
 testsuite/tests/typecheck/should_fail/T14884.hs    |  4 ++
 .../tests/typecheck/should_fail/T14884.stderr      | 44 ++++++++++++++++++++++
 testsuite/tests/typecheck/should_fail/all.T        |  1 +
 6 files changed, 58 insertions(+)

diff --git a/testsuite/tests/ghci/scripts/T14969.script b/testsuite/tests/ghci/scripts/T14969.script
new file mode 100644
index 0000000..ab6af53
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T14969.script
@@ -0,0 +1 @@
+3 _ 4
diff --git a/testsuite/tests/ghci/scripts/T14969.stderr b/testsuite/tests/ghci/scripts/T14969.stderr
new file mode 100644
index 0000000..b581657
--- /dev/null
+++ b/testsuite/tests/ghci/scripts/T14969.stderr
@@ -0,0 +1,7 @@
+
+<interactive>:1:1: error:
+    • Non type-variable argument
+        in the constraint: Num (t2 -> t1 -> t3)
+      (Use FlexibleContexts to permit this)
+    • When checking the inferred type
+        it :: forall t1 t2 t3. (Num t1, Num (t2 -> t1 -> t3)) => t3
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index f0d90b6..06f1ec4 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -264,3 +264,4 @@ test('T14342', [extra_hc_opts("-XOverloadedStrings -XRebindableSyntax")],
                ghci_script, ['T14342.script'])
 test('T14676', extra_files(['../prog002']), ghci_script, ['T14676.script'])
 test('T14796', normal, ghci_script, ['T14796.script'])
+test('T14969', normal, ghci_script, ['T14969.script'])
diff --git a/testsuite/tests/typecheck/should_fail/T14884.hs b/testsuite/tests/typecheck/should_fail/T14884.hs
new file mode 100644
index 0000000..d5d1545
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T14884.hs
@@ -0,0 +1,4 @@
+module T14884 where
+
+x :: IO ()
+x = _ print "abc"
diff --git a/testsuite/tests/typecheck/should_fail/T14884.stderr b/testsuite/tests/typecheck/should_fail/T14884.stderr
new file mode 100644
index 0000000..5134d85
--- /dev/null
+++ b/testsuite/tests/typecheck/should_fail/T14884.stderr
@@ -0,0 +1,44 @@
+
+T14884.hs:4:5: error:
+    • Found hole: _ :: (a0 -> IO ()) -> [Char] -> IO ()
+      Where: ‘a0’ is an ambiguous type variable
+    • In the expression: _
+      In the expression: _ print "abc"
+      In an equation for ‘x’: x = _ print "abc"
+    • Relevant bindings include x :: IO () (bound at T14884.hs:4:1)
+      Valid substitutions include
+        foldMap :: forall (t :: * -> *).
+                   Foldable t =>
+                   forall m a. Monoid m => (a -> m) -> t a -> m
+          (imported from ‘Prelude’ at T14884.hs:1:8-13
+           (and originally defined in ‘Data.Foldable’))
+        mapM_ :: forall (t :: * -> *) (m :: * -> *) a b.
+                 (Foldable t, Monad m) =>
+                 (a -> m b) -> t a -> m ()
+          (imported from ‘Prelude’ at T14884.hs:1:8-13
+           (and originally defined in ‘Data.Foldable’))
+        ($) :: forall a b. (a -> b) -> a -> b
+          (imported from ‘Prelude’ at T14884.hs:1:8-13
+           (and originally defined in ‘GHC.Base’))
+        ($!) :: forall a b. (a -> b) -> a -> b
+          (imported from ‘Prelude’ at T14884.hs:1:8-13
+           (and originally defined in ‘GHC.Base’))
+        id :: forall a. a -> a
+          (imported from ‘Prelude’ at T14884.hs:1:8-13
+           (and originally defined in ‘GHC.Base’))
+
+T14884.hs:4:7: error:
+    • Ambiguous type variable ‘a0’ arising from a use of ‘print’
+      prevents the constraint ‘(Show a0)’ from being solved.
+      Probable fix: use a type annotation to specify what ‘a0’ should be.
+      These potential instances exist:
+        instance (Show a, Show b) => Show (Either a b)
+          -- Defined in ‘Data.Either’
+        instance Show Ordering -- Defined in ‘GHC.Show’
+        instance Show Integer -- Defined in ‘GHC.Show’
+        ...plus 23 others
+        ...plus 64 instances involving out-of-scope types
+        (use -fprint-potential-instances to see them all)
+    • In the first argument of ‘_’, namely ‘print’
+      In the expression: _ print "abc"
+      In an equation for ‘x’: x = _ print "abc"
diff --git a/testsuite/tests/typecheck/should_fail/all.T b/testsuite/tests/typecheck/should_fail/all.T
index 3f791a7..16fd5de 100644
--- a/testsuite/tests/typecheck/should_fail/all.T
+++ b/testsuite/tests/typecheck/should_fail/all.T
@@ -470,3 +470,4 @@ test('T14607', normal, compile_fail, [''])
 test('T14605', normal, compile_fail, [''])
 test('T14761a', normal, compile_fail, [''])
 test('T14761b', normal, compile_fail, [''])
+test('T14884', normal, compile_fail, [''])



More information about the ghc-commits mailing list