Test #14884, #14969
authorRichard Eisenberg <rae@cs.brynmawr.edu>
Mon, 2 Apr 2018 13:39:19 +0000 (09:39 -0400)
committerRichard Eisenberg <rae@cs.brynmawr.edu>
Mon, 2 Apr 2018 13:42:48 +0000 (09:42 -0400)
These were fixed by faec8d358985e5d0bf363bd96f23fe76c9e281f7

test cases: typecheck/should_fail/T14884
            ghci/scripts/T14969

testsuite/tests/ghci/scripts/T14969.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T14969.stderr [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T
testsuite/tests/typecheck/should_fail/T14884.hs [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/T14884.stderr [new file with mode: 0644]
testsuite/tests/typecheck/should_fail/all.T

diff --git a/testsuite/tests/ghci/scripts/T14969.script b/testsuite/tests/ghci/scripts/T14969.script
new file mode 100644 (file)
index 0000000..ab6af53
--- /dev/null
@@ -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 (file)
index 0000000..b581657
--- /dev/null
@@ -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
index f0d90b6..06f1ec4 100755 (executable)
@@ -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 (file)
index 0000000..d5d1545
--- /dev/null
@@ -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 (file)
index 0000000..5134d85
--- /dev/null
@@ -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"
index 3f791a7..16fd5de 100644 (file)
@@ -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, [''])