Commit 625cb2ec authored by simonpj's avatar simonpj
Browse files

Add two implicit-parameter tests

parent 1363ab44
{-# LANGUAGE ImplicitParams #-}
module IPFail where
f0 :: (?x :: Int) => () -> Bool
f0 () = let ?x = 5 in ?x
IPFail.hs:6:18:
Could not deduce (Num Bool) from the context (?x::Int)
arising from the literal `5'
Possible fix:
add (Num Bool) to the context of the type signature for `f0'
or add an instance declaration for (Num Bool)
In the expression: 5
In the expression: let ?x = 5 in ?x
In an equation for `f0': f0 () = let ?x = 5 in ?x
......@@ -223,6 +223,7 @@ test('T3613', normal, compile_fail, [''])
test('fd-loop', normal, compile_fail, [''])
test('T3950', normal, compile_fail, [''])
test('T3966', normal, compile_fail, [''])
test('IPFail', normal, compile_fail, [''])
test('T3468', extra_clean(['T3468.hi-boot']),
multimod_compile_fail, ['T3468', '-v0'])
{-# LANGUAGE ImplicitParams #-}
module Main where
f0 :: (?x :: Int) => () -> Int
f0 () = let ?x = 5 in ?x
-- Should always return 5
f1 :: (?x :: Int) => () -> Int
f1 = let ?x = 5 in \() -> ?x
-- Should always return 5
f2 () = let ?x = 5 in \() -> ?x
-- Inferred type: (?x::Integer) => () -> () -> Integer
-- should always return 5
f3 :: () -> ((?x :: Int) => Int)
-- Deep skolemisation means that the local x=5 still wins
f3 = let ?x = 5 in \() -> ?x
main = let ?x = 0 in
do { print (f0 ())
; print (f1 ())
; print (f2 () ())
; print (f3 ()) }
......@@ -70,6 +70,7 @@ test('tcrun042', if_compiler_lt('ghc', '6.11', expect_fail), compile_and_run, ['
test('church', normal, compile_and_run, [''])
test('testeq2', normal, compile_and_run, [''])
test('T1624', normal, compile_and_run, [''])
test('IPRun', normal, compile_and_run, [''])
# Support files for T1735 are in directory T1735_Help/
test('T1735', normal, multimod_compile_and_run, ['T1735',''])
......
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