Skip to content
Snippets Groups Projects
Commit 90e99c4c authored by Ryan Scott's avatar Ryan Scott
Browse files

Add tests for #8128 and #8740

Commit 08073e16 (#11066) ended up
fixing these, fortunately enough.
parent 61280373
No related merge requests found
{-# LANGUAGE StandaloneDeriving, GADTs, FlexibleInstances #-}
module T8128 where
data T a where
MkT1 :: T Int
MkT2 :: Bool -> T Bool
deriving instance Show (T Int)
T8128.hs:9:1: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘Int’ with ‘Bool’
Inaccessible code in
a pattern with constructor: MkT2 :: Bool -> T Bool,
in an equation for ‘showsPrec’
• In the pattern: MkT2 b1
In an equation for ‘showsPrec’:
showsPrec a (MkT2 b1)
= showParen (a >= 11) ((.) (showString "MkT2 ") (showsPrec 11 b1))
When typechecking the code for ‘showsPrec’
in a derived instance for ‘Show (T Int)’:
To see the code I am typechecking, use -ddump-deriv
In the instance declaration for ‘Show (T Int)’
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
module T8740 where
data Abstract
data Reified
data Player
data Elect p a where
ElectRefAsTypeOf :: Int -> Elect Abstract a -> Elect Abstract a
ElectHandle :: a -> Elect Reified a
Controller :: Elect Abstract Player
Owner :: Elect Abstract Player
You :: Elect Abstract Player
deriving instance (Eq a) => Eq (Elect p a)
deriving instance (Ord a) => Ord (Elect p a)
T8740.hs:17:1: warning: [-Winaccessible-code (in -Wdefault)]
• Couldn't match type ‘Reified’ with ‘Abstract’
Inaccessible code in
a pattern with constructor:
ElectRefAsTypeOf :: forall a.
Int -> Elect Abstract a -> Elect Abstract a,
in a case alternative
• In the pattern: ElectRefAsTypeOf {}
In a case alternative: ElectRefAsTypeOf {} -> GT
In the expression:
case b of
ElectRefAsTypeOf {} -> GT
ElectHandle b1 -> (a1 `compare` b1)
_ -> LT
When typechecking the code for ‘compare’
in a derived instance for ‘Ord (Elect p a)’:
To see the code I am typechecking, use -ddump-deriv
......@@ -44,11 +44,13 @@ test('T7710', normal, compile, [''])
test('AutoDeriveTypeable', normal, compile, [''])
test('T8128', normal, compile, [''])
test('T8138', reqlib('primitive'), compile, ['-O2'])
test('T8165', normal, compile, [''])
test('T8631', normal, compile, [''])
test('T8758', [], multimod_compile, ['T8758a', '-v0'])
test('T8678', normal, compile, [''])
test('T8740', normal, compile, [''])
test('T8865', normal, compile, [''])
test('T8893', normal, compile, [''])
test('T8950', normal, compile, [''])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment