diff options
Diffstat (limited to 'testsuite/tests/patsyn/should_fail')
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T14552.hs | 43 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/T14552.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/patsyn/should_fail/all.T | 1 |
3 files changed, 52 insertions, 0 deletions
diff --git a/testsuite/tests/patsyn/should_fail/T14552.hs b/testsuite/tests/patsyn/should_fail/T14552.hs new file mode 100644 index 0000000000..a4a7493530 --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T14552.hs @@ -0,0 +1,43 @@ +{-# Language RankNTypes, ViewPatterns, PatternSynonyms, TypeOperators, ScopedTypeVariables, + KindSignatures, PolyKinds, DataKinds, TypeFamilies, GADTs #-} + +module T14552 where + +import Data.Kind +import Data.Proxy + +data family Sing a + +type a --> b = (a, b) -> Type + +type family F (f::a --> b) (x::a) :: b + +newtype Limit :: (k --> Type) -> Type where + Limit :: (forall xx. Proxy xx -> F f xx) -> Limit f + +data Exp :: [Type] -> Type -> Type where + TLam :: (forall aa. Proxy aa -> Exp xs (F w aa)) + -> Exp xs (Limit w) + +pattern FOO f <- TLam (($ Proxy) -> f) + + +{- +TLam :: forall (xs::[Type]) (b::Type). -- Universal + forall k (w :: k --> Type). -- Existential + (b ~ Limit w) => + => (forall (aa :: k). Proxy aa -> Exp xs (F w aa)) + -> Exp xs b + +-} + +{- +mfoo :: Exp xs b + -> (forall k (w :: k --> Type). + (b ~ Limit w) + => Exp xs (F w aa) + -> r) + -> r +mfoo scrut k = case srcut of + TLam g -> k (g Proxy) +-} diff --git a/testsuite/tests/patsyn/should_fail/T14552.stderr b/testsuite/tests/patsyn/should_fail/T14552.stderr new file mode 100644 index 0000000000..b9b6b8448b --- /dev/null +++ b/testsuite/tests/patsyn/should_fail/T14552.stderr @@ -0,0 +1,8 @@ + +T14552.hs:22:9: error: + • Cannot generalise type; skolem ‘k’ would escape its scope + if I tried to quantify (aa0 :: k) in this type: + forall k (w :: k --> *). Exp a0 (F @k @(*) w aa0) + (Indeed, I sometimes struggle even printing this correctly, + due to its ill-scoped nature.) + • In the declaration for pattern synonym ‘FOO’ diff --git a/testsuite/tests/patsyn/should_fail/all.T b/testsuite/tests/patsyn/should_fail/all.T index 27ebc8bdd4..02cc2cec2c 100644 --- a/testsuite/tests/patsyn/should_fail/all.T +++ b/testsuite/tests/patsyn/should_fail/all.T @@ -46,3 +46,4 @@ test('T15685', normal, compile_fail, ['']) test('T15692', normal, compile, ['']) # It has -fdefer-type-errors inside test('T15694', normal, compile_fail, ['']) test('T16900', normal, compile_fail, ['-fdiagnostics-show-caret']) +test('T14552', normal, compile_fail, ['']) |