Commit f3da8ce8 authored by Krzysztof Gogolewski's avatar Krzysztof Gogolewski Committed by Simon Peyton Jones

Tests for nullary type classes (#7642)

parent 50399597
......@@ -39,7 +39,8 @@ expectedGhcOnlyExtensions = [
"TypeHoles",
"OverloadedLists",
"EmptyCase",
"AutoDeriveTypeable"]
"AutoDeriveTypeable",
"NullaryTypeClasses"]
expectedCabalOnlyExtensions :: [String]
expectedCabalOnlyExtensions = ["Generics",
......
module NoNullaryTC where
class A where
f :: a -> a
TcNoNullaryTC.hs:3:1:
No parameters for class ‛A’
(Use -XNullaryTypeClasses to allow no-parameter classes)
In the class declaration for ‛A’
{-# LANGUAGE NullaryTypeClasses #-}
module TcNullaryTCFail where
class A
instance A
instance A
TcNullaryTCFail.hs:5:10:
Duplicate instance declarations:
instance A -- Defined at TcNullaryTCFail.hs:5:10
instance A -- Defined at TcNullaryTCFail.hs:6:10
......@@ -301,3 +301,5 @@ test('T7734', normal, compile_fail, [''])
test('T7697', normal, compile_fail, [''])
test('T7696', normal, compile_fail, [''])
test('T7748a', normal, compile_fail, [''])
test('TcNoNullaryTC', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''])
test('TcNullaryTCFail', when(compiler_lt('ghc', '7.7'), skip), compile_fail, [''])
{-# LANGUAGE NullaryTypeClasses #-}
module Main where
class R where
f :: Int -> Int
g :: a -> a
instance R where
f = (+1)
g = id
main = print (g (f 0))
......@@ -108,3 +108,4 @@ test('T6117', normal, compile_and_run, [''])
test('T5751', normal, compile_and_run, [''])
test('T5913', normal, compile_and_run, [''])
test('T7748', normal, compile_and_run, [''])
test('TcNullaryTC', when(compiler_lt('ghc', '7.7'), skip), compile_and_run, [''])
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