Test #15076 in dependent/should_compile/T15076*
authorRichard Eisenberg <rae@cs.brynmawr.edu>
Mon, 29 Oct 2018 14:01:15 +0000 (10:01 -0400)
committerRichard Eisenberg <rae@cs.brynmawr.edu>
Mon, 29 Oct 2018 16:12:48 +0000 (12:12 -0400)
testsuite/tests/dependent/should_compile/T15076.hs [new file with mode: 0644]
testsuite/tests/dependent/should_compile/T15076.stderr [new file with mode: 0644]
testsuite/tests/dependent/should_compile/T15076b.hs [new file with mode: 0644]
testsuite/tests/dependent/should_compile/T15076c.hs [new file with mode: 0644]
testsuite/tests/dependent/should_compile/all.T

diff --git a/testsuite/tests/dependent/should_compile/T15076.hs b/testsuite/tests/dependent/should_compile/T15076.hs
new file mode 100644 (file)
index 0000000..0890cf9
--- /dev/null
@@ -0,0 +1,13 @@
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE TypeInType #-}
+{-# LANGUAGE PartialTypeSignatures #-}
+module Bug where
+
+import Data.Kind
+import Data.Proxy
+
+foo :: forall (a :: Type)
+              (f :: forall (x :: a). Proxy x -> Type).
+       Proxy f -> ()
+foo (_ :: _) = ()
diff --git a/testsuite/tests/dependent/should_compile/T15076.stderr b/testsuite/tests/dependent/should_compile/T15076.stderr
new file mode 100644 (file)
index 0000000..43f4772
--- /dev/null
@@ -0,0 +1,12 @@
+
+T15076.hs:13:11: warning: [-Wpartial-type-signatures (in -Wdefault)]
+    • Found type wildcard ‘_’ standing for ‘Proxy f’
+      Where: ‘f’, ‘a’ are rigid type variables bound by
+               the type signature for:
+                 foo :: forall a (f :: forall (x :: a). Proxy x -> *). Proxy f -> ()
+               at T15076.hs:(10,1)-(12,20)
+    • In a pattern type signature: _
+      In the pattern: _ :: _
+      In an equation for ‘foo’: foo (_ :: _) = ()
+    • Relevant bindings include
+        foo :: Proxy f -> () (bound at T15076.hs:13:1)
diff --git a/testsuite/tests/dependent/should_compile/T15076b.hs b/testsuite/tests/dependent/should_compile/T15076b.hs
new file mode 100644 (file)
index 0000000..15fce82
--- /dev/null
@@ -0,0 +1,11 @@
+{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE TypeInType #-}
+module Bug where
+
+import Data.Kind
+import Data.Proxy
+
+foo :: forall (a :: Type)
+              (f :: forall (x :: a). Proxy x -> Type).
+       Proxy f -> ()
+foo _ = ()
diff --git a/testsuite/tests/dependent/should_compile/T15076c.hs b/testsuite/tests/dependent/should_compile/T15076c.hs
new file mode 100644 (file)
index 0000000..b689b5b
--- /dev/null
@@ -0,0 +1,16 @@
+{-# LANGUAGE PolyKinds, MultiParamTypeClasses, GADTs, ScopedTypeVariables,
+             TypeOperators #-}
+{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
+
+module Super where
+
+import Data.Kind
+import Data.Proxy
+import GHC.Prim
+
+class (a ~ b) => C a b
+data SameKind :: k -> k -> Type where
+  SK :: SameKind a b
+
+bar :: forall (a :: Type) (b :: Type). C a b => Proxy a -> Proxy b -> ()
+bar _ _ = const () (undefined :: forall (x :: a) (y :: b). SameKind x y)
index 16c6d13..341a44c 100644 (file)
@@ -61,3 +61,6 @@ test('T14880-2', normal, compile, [''])
 test('T15743', normal, compile, ['-ddump-types -fprint-explicit-foralls'])
 test('InferDependency', normal, compile, [''])
 test('T15743e', normal, compile, ['-ddump-types -fprint-explicit-foralls'])
+test('T15076', normal, compile, [''])
+test('T15076b', normal, compile, [''])
+test('T15076c', normal, compile, [''])