Commit 906ea044 authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Ben Gamari

Print foralls in user format

This fixes Trac #12597: in RnNames.warnMissingSignatures,
use pprSigmaType not pprType

(cherry picked from commit 796f0f2a)
parent cb03d1cc
......@@ -1617,7 +1617,7 @@ warnMissingSignatures gbl_env
= do { env <- tcInitTidyEnv -- Why not use emptyTidyEnv?
; let name = idName id
(_, ty) = tidyOpenType env (idType id)
ty_msg = ppr ty
ty_msg = pprSigmaType ty
; add_warn name $
hang (text "Top-level binding with no type signature:")
2 (pprPrefixName name <+> dcolon <+> ty_msg) }
......
......@@ -2652,6 +2652,8 @@ ppr_fun_tail (ForAllTy (Anon ty1) ty2)
ppr_fun_tail other_ty = [ppr_type TopPrec other_ty]
pprSigmaType :: Type -> SDoc
-- Prints a top-level type for the user; in particular
-- top-level foralls are omitted unless you use -fprint-explicit-foralls
pprSigmaType ty = sdocWithDynFlags $ \dflags ->
eliminateRuntimeRep (ppr_sigma_type dflags False) ty
......
......@@ -17,8 +17,7 @@ werror.hs:10:1: warning: [-Wunused-top-binds (in -Wextra, -Wunused-binds)]
Defined but not used: ‘f’
werror.hs:10:1: warning: [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature:
f :: forall t t1. [t1] -> [t]
Top-level binding with no type signature: f :: [t1] -> [t]
werror.hs:10:1: warning: [-Wincomplete-patterns (in -Wextra)]
Pattern match(es) are non-exhaustive
......
T8889.hs:12:1: warning: [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature:
f :: forall (f :: * -> *) b a.
(C f, C_fmap f a) =>
(a -> b) -> f a -> f b
f :: (C f, C_fmap f a) => (a -> b) -> f a -> f b
read014.hs:4:1: warning: [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature:
ng1 :: forall a t. Num a => t -> a -> a
ng1 :: Num a => t -> a -> a
read014.hs:4:5: warning: [-Wunused-matches (in -Wextra)]
Defined but not used: ‘x’
......
{-# OPTIONS_GHC -Wmissing-signatures #-}
module T12597 where
f x = x
T12597.hs:5:1: warning: [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature: f :: t -> t
......@@ -242,3 +242,4 @@ test('T12127',
multimod_compile,
['T12127', '-v0'])
test('T12533', normal, compile, [''])
test('T12597', normal, compile, [''])
T10971a.hs:7:1: warning: [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature: f :: forall a. [a] -> Int
Top-level binding with no type signature: f :: [a] -> Int
T10971a.hs:7:11: warning: [-Wtype-defaults (in -Wall)]
• Defaulting the following constraint to type ‘[]’
......@@ -11,7 +11,7 @@ T10971a.hs:7:11: warning: [-Wtype-defaults (in -Wall)]
T10971a.hs:8:1: warning: [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature:
g :: forall b a. (a -> b) -> [a] -> [b]
g :: (a -> b) -> [a] -> [b]
T10971a.hs:8:6: warning: [-Wname-shadowing (in -Wall)]
This binding for ‘f’ shadows the existing binding
......@@ -26,7 +26,7 @@ T10971a.hs:8:13: warning: [-Wtype-defaults (in -Wall)]
T10971a.hs:9:1: warning: [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature:
h :: forall b a. (a -> b) -> [a] -> ([b], Int)
h :: (a -> b) -> [a] -> ([b], Int)
T10971a.hs:9:6: warning: [-Wname-shadowing (in -Wall)]
This binding for ‘f’ shadows the existing binding
......
tc243.hs:10:1: warning: [-Wmissing-signatures (in -Wall)]
Top-level binding with no type signature: (.+.) :: forall a. a
Top-level binding with no type signature: (.+.) :: a
T11077.hs:3:1: warning: [-Wmissing-exported-sigs]
Top-level binding with no type signature: foo :: forall a. a
Top-level binding with no type signature: foo :: a
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