[commit: ghc] master: Test Trac #12968, plus some comments (f97d489)

git at git.haskell.org git at git.haskell.org
Wed Dec 21 14:06:32 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/f97d489911aabd2396f5df87efd7d1d164017142/ghc

>---------------------------------------------------------------

commit f97d489911aabd2396f5df87efd7d1d164017142
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Dec 19 15:05:57 2016 +0000

    Test Trac #12968, plus some comments


>---------------------------------------------------------------

f97d489911aabd2396f5df87efd7d1d164017142
 compiler/rename/RnNames.hs                      |  2 ++
 compiler/typecheck/TcRnDriver.hs                |  3 +++
 testsuite/tests/patsyn/should_compile/T12968.hs | 14 ++++++++++++++
 testsuite/tests/patsyn/should_compile/all.T     |  1 +
 4 files changed, 20 insertions(+)

diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs
index 8da11be..8a7529d 100644
--- a/compiler/rename/RnNames.hs
+++ b/compiler/rename/RnNames.hs
@@ -1147,6 +1147,8 @@ warnUnusedImportDecls gbl_env
          printMinimalImports usage }
 
 -- | Warn the user about top level binders that lack type signatures.
+-- Called /after/ type inference, so that we can report the
+-- inferred type of the function
 warnMissingSignatures :: TcGblEnv -> RnM ()
 warnMissingSignatures gbl_env
   = do { let exports = availsToNameSet (tcg_exports gbl_env)
diff --git a/compiler/typecheck/TcRnDriver.hs b/compiler/typecheck/TcRnDriver.hs
index ad49ca0..a1b559c 100644
--- a/compiler/typecheck/TcRnDriver.hs
+++ b/compiler/typecheck/TcRnDriver.hs
@@ -267,6 +267,9 @@ tcRnModuleTcRnM hsc_env hsc_src
         tcg_env <- return (tcg_env { tcg_doc_hdr = maybe_doc_hdr }) ;
 
                 -- Report unused names
+                -- Do this /after/ type inference, so that when reporting
+                -- a function with no type signature we can give the
+                -- inferred type
         reportUnusedNames export_ies tcg_env ;
 
                 -- add extra source files to tcg_dependent_files
diff --git a/testsuite/tests/patsyn/should_compile/T12968.hs b/testsuite/tests/patsyn/should_compile/T12968.hs
new file mode 100644
index 0000000..9d38500
--- /dev/null
+++ b/testsuite/tests/patsyn/should_compile/T12968.hs
@@ -0,0 +1,14 @@
+{-# LANGUAGE TypeInType, GADTs, ScopedTypeVariables, PatternSynonyms,
+      ViewPatterns #-}
+
+module T12968 where
+
+data TypeRep (a :: k)
+
+data TRAppG (fun :: k2) where
+  TRAppG :: forall k1 (a :: k1 -> k2) (b :: k1) . TypeRep a -> TypeRep b -> TRAppG (a b)
+
+pattern TRApp :: forall k2 (fun :: k2). ()
+              => forall k1 (a :: k1 -> k2) (b :: k1). (fun ~ a b)
+              => TypeRep a -> TypeRep b -> TypeRep fun
+pattern TRApp a b <- ((undefined :: TypeRep fun -> TRAppG fun) -> TRAppG a b)
diff --git a/testsuite/tests/patsyn/should_compile/all.T b/testsuite/tests/patsyn/should_compile/all.T
index 1952672..6bd1461 100644
--- a/testsuite/tests/patsyn/should_compile/all.T
+++ b/testsuite/tests/patsyn/should_compile/all.T
@@ -62,3 +62,4 @@ test('T11987', normal, multimod_compile, ['T11987', '-v0'])
 test('T12615', normal, compile, [''])
 test('T12698', normal, compile, [''])
 test('T12746', normal, multi_compile, ['T12746', [('T12746A.hs', '-c')],'-v0'])
+test('T12968', normal, compile, [''])



More information about the ghc-commits mailing list