summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-12-19 15:05:57 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2016-12-21 12:26:24 +0000
commitf97d489911aabd2396f5df87efd7d1d164017142 (patch)
treea2df022d5e3b50526fe98b40452491ced559332f
parent1771da25fee524c58973c3e6bfbd721f708769c7 (diff)
downloadhaskell-f97d489911aabd2396f5df87efd7d1d164017142.tar.gz
Test Trac #12968, plus some comments
-rw-r--r--compiler/rename/RnNames.hs2
-rw-r--r--compiler/typecheck/TcRnDriver.hs3
-rw-r--r--testsuite/tests/patsyn/should_compile/T12968.hs14
-rw-r--r--testsuite/tests/patsyn/should_compile/all.T1
4 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rename/RnNames.hs b/compiler/rename/RnNames.hs
index 8da11bed1c..8a7529da1c 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 ad49ca0601..a1b559c176 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 0000000000..9d38500d67
--- /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 1952672a99..6bd1461efc 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, [''])