Commit 277d20af authored by Sebastian Graf's avatar Sebastian Graf Committed by Marge Bot
Browse files

Add regression tests for #18371

They have been fixed by !3959, I believe.
Fixes #18371.
parent 0d6519d9
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wincomplete-patterns #-}
module Bug where
import Data.Kind
import Unsafe.Coerce
type family Sing :: k -> Type
class SingI a where
sing :: Sing a
data SingInstance :: forall k. k -> Type where
SingInstance :: SingI a => SingInstance a
newtype DI (a :: k) = Don'tInstantiate (SingI a => SingInstance a)
singInstance :: forall k (a :: k). Sing a -> SingInstance a
singInstance s = with_sing_i SingInstance
where
with_sing_i :: (SingI a => SingInstance a) -> SingInstance a
with_sing_i si = unsafeCoerce (Don'tInstantiate si) s
{-# COMPLETE Sing #-}
pattern Sing :: forall k (a :: k). () => SingI a => Sing a
pattern Sing <- (singInstance -> SingInstance)
where Sing = sing
-----
data SBool :: Bool -> Type where
SFalse :: SBool False
STrue :: SBool True
type instance Sing = SBool
f :: SBool b -> ()
f Sing = ()
g :: Sing (b :: Bool) -> ()
g Sing = ()
{-# OPTIONS_GHC -Wincomplete-patterns -fforce-recomp #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE TypeFamilies #-}
module Lib where
type family T
pattern P :: T
pattern P <- _
{-# COMPLETE P #-}
data U = U
type instance T = U
f :: U -> ()
f P = ()
......@@ -140,6 +140,10 @@ test('T18273', normal, compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T18341', normal, compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T18371', normal, compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T18371b', normal, compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T18478', collect_compiler_stats('bytes allocated',10), compile,
['-fwarn-incomplete-patterns -fwarn-overlapping-patterns'])
test('T18533', normal, compile,
......
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