Commit 07abff71 authored by Richard Eisenberg's avatar Richard Eisenberg

Test #14884, #14969

These were fixed by faec8d35

test cases: typecheck/should_fail/T14884
            ghci/scripts/T14969
parent 1845d1bc
<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
...@@ -264,3 +264,4 @@ test('T14342', [extra_hc_opts("-XOverloadedStrings -XRebindableSyntax")], ...@@ -264,3 +264,4 @@ test('T14342', [extra_hc_opts("-XOverloadedStrings -XRebindableSyntax")],
ghci_script, ['T14342.script']) ghci_script, ['T14342.script'])
test('T14676', extra_files(['../prog002']), ghci_script, ['T14676.script']) test('T14676', extra_files(['../prog002']), ghci_script, ['T14676.script'])
test('T14796', normal, ghci_script, ['T14796.script']) test('T14796', normal, ghci_script, ['T14796.script'])
test('T14969', normal, ghci_script, ['T14969.script'])
module T14884 where
x :: IO ()
x = _ print "abc"
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"
...@@ -470,3 +470,4 @@ test('T14607', normal, compile_fail, ['']) ...@@ -470,3 +470,4 @@ test('T14607', normal, compile_fail, [''])
test('T14605', normal, compile_fail, ['']) test('T14605', normal, compile_fail, [''])
test('T14761a', normal, compile_fail, ['']) test('T14761a', normal, compile_fail, [''])
test('T14761b', normal, compile_fail, ['']) test('T14761b', normal, compile_fail, [''])
test('T14884', normal, compile_fail, [''])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment