diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-12-01 17:38:23 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-12-01 18:45:23 +0100 |
commit | 1e041b7382b6aa329e4ad9625439f811e0f27232 (patch) | |
tree | 91f4418553a1e6df072f56f43b5697d40c985b5f /testsuite/tests/partial-sigs/should_compile | |
parent | b432e2f39c095d8acbb0cfcc63bd08436c7a3e49 (diff) | |
download | haskell-1e041b7382b6aa329e4ad9625439f811e0f27232.tar.gz |
Refactor treatment of wildcards
This patch began as a modest refactoring of HsType and friends, to
clarify and tidy up exactly where quantification takes place in types.
Although initially driven by making the implementation of wildcards more
tidy (and fixing a number of bugs), I gradually got drawn into a pretty
big process, which I've been doing on and off for quite a long time.
There is one compiler performance regression as a result of all
this, in perf/compiler/T3064. I still need to look into that.
* The principal driving change is described in Note [HsType binders]
in HsType. Well worth reading!
* Those data type changes drive almost everything else. In particular
we now statically know where
(a) implicit quantification only (LHsSigType),
e.g. in instance declaratios and SPECIALISE signatures
(b) implicit quantification and wildcards (LHsSigWcType)
can appear, e.g. in function type signatures
* As part of this change, HsForAllTy is (a) simplified (no wildcards)
and (b) split into HsForAllTy and HsQualTy. The two contructors
appear when and only when the correponding user-level construct
appears. Again see Note [HsType binders].
HsExplicitFlag disappears altogether.
* Other simplifications
- ExprWithTySig no longer needs an ExprWithTySigOut variant
- TypeSig no longer needs a PostRn name [name] field
for wildcards
- PatSynSig records a LHsSigType rather than the decomposed
pieces
- The mysterious 'GenericSig' is now 'ClassOpSig'
* Renamed LHsTyVarBndrs to LHsQTyVars
* There are some uninteresting knock-on changes in Haddock,
because of the HsSyn changes
I also did a bunch of loosely-related changes:
* We already had type synonyms CoercionN/CoercionR for nominal and
representational coercions. I've added similar treatment for
TcCoercionN/TcCoercionR
mkWpCastN/mkWpCastN
All just type synonyms but jolly useful.
* I record-ised ForeignImport and ForeignExport
* I improved the (poor) fix to Trac #10896, by making
TcTyClsDecls.checkValidTyCl recover from errors, but adding a
harmless, abstract TyCon to the envt if so.
* I did some significant refactoring in RnEnv.lookupSubBndrOcc,
for reasons that I have (embarrassingly) now totally forgotten.
It had to do with something to do with import and export
Updates haddock submodule.
Diffstat (limited to 'testsuite/tests/partial-sigs/should_compile')
13 files changed, 306 insertions, 199 deletions
diff --git a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr index 033dfab13d..7e40fd184b 100644 --- a/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr +++ b/testsuite/tests/partial-sigs/should_compile/Defaulting2MROn.stderr @@ -1,5 +1,5 @@ TYPE SIGNATURES - bravo :: Integer + bravo :: forall t. Num t => t TYPE CONSTRUCTORS COERCION AXIOMS Dependent modules: [] diff --git a/testsuite/tests/partial-sigs/should_compile/ExprSigLocal.hs b/testsuite/tests/partial-sigs/should_compile/ExprSigLocal.hs new file mode 100644 index 0000000000..a15ff5f774 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/ExprSigLocal.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE PartialTypeSignatures, RankNTypes #-} + +module ExprSigLocal where + +-- We expect this to compile fine, +-- reporting that '_' stands 'a' + +y :: forall b. b->b +y = ((\x -> x) :: forall a. a -> _) + +g :: forall a. a -> _ +g x = x diff --git a/testsuite/tests/partial-sigs/should_compile/ExprSigLocal.stderr b/testsuite/tests/partial-sigs/should_compile/ExprSigLocal.stderr new file mode 100644 index 0000000000..7e02028874 --- /dev/null +++ b/testsuite/tests/partial-sigs/should_compile/ExprSigLocal.stderr @@ -0,0 +1,19 @@ + +ExprSigLocal.hs:9:35: warning: + • Found type wildcard ‘_’ standing for ‘a’ + Where: ‘a’ is a rigid type variable bound by + the inferred type of <expression> :: a -> a at ExprSigLocal.hs:9:27 + • In an expression type signature: forall a. a -> _ + In the expression: ((\ x -> x) :: forall a. a -> _) + In an equation for ‘y’: y = ((\ x -> x) :: forall a. a -> _) + • Relevant bindings include + y :: b -> b (bound at ExprSigLocal.hs:9:1) + +ExprSigLocal.hs:11:21: warning: + • Found type wildcard ‘_’ standing for ‘a’ + Where: ‘a’ is a rigid type variable bound by + the inferred type of g :: a -> a at ExprSigLocal.hs:11:13 + • In the type signature: + g :: forall a. a -> _ + • Relevant bindings include + g :: a -> a (bound at ExprSigLocal.hs:12:1) diff --git a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr index 763cd73cb5..965d492754 100644 --- a/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr +++ b/testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.stderr @@ -14,7 +14,7 @@ TYPE SIGNATURES < :: forall a. Ord a => a -> a -> Bool
<= :: forall a. Ord a => a -> a -> Bool
=<< ::
- forall a (m :: * -> *) b. Monad m => (a -> m b) -> m a -> m b
+ forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
== :: forall a. Eq a => a -> a -> Bool
> :: forall a. Ord a => a -> a -> Bool
>= :: forall a. Ord a => a -> a -> Bool
@@ -27,10 +27,10 @@ TYPE SIGNATURES acos :: forall a. Floating a => a -> a
acosh :: forall a. Floating a => a -> a
all ::
- forall a (t :: * -> *). Foldable t => (a -> Bool) -> t a -> Bool
+ forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
and :: forall (t :: * -> *). Foldable t => t Bool -> Bool
any ::
- forall a (t :: * -> *). Foldable t => (a -> Bool) -> t a -> Bool
+ forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
appendFile :: FilePath -> String -> IO ()
asTypeOf :: forall a. a -> a -> a
asin :: forall a. Floating a => a -> a
@@ -43,7 +43,7 @@ TYPE SIGNATURES compare :: forall a. Ord a => a -> a -> Ordering
concat :: forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concatMap ::
- forall a b (t :: * -> *). Foldable t => (a -> [b]) -> t a -> [b]
+ forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
const :: forall a b. a -> b -> a
cos :: forall a. Floating a => a -> a
cosh :: forall a. Floating a => a -> a
@@ -117,11 +117,11 @@ TYPE SIGNATURES lookup :: forall a b. Eq a => a -> [(a, b)] -> Maybe b
map :: forall a b. (a -> b) -> [a] -> [b]
mapM ::
- forall (t :: * -> *) a (m :: * -> *) b.
+ forall (t :: * -> *) (m :: * -> *) a b.
(Monad m, Traversable t) =>
(a -> m b) -> t a -> m (t b)
mapM_ ::
- forall a (m :: * -> *) b (t :: * -> *).
+ forall (t :: * -> *) (m :: * -> *) a b.
(Monad m, Foldable t) =>
(a -> m b) -> t a -> m ()
max :: forall a. Ord a => a -> a -> a
@@ -135,7 +135,7 @@ TYPE SIGNATURES negate :: forall a. Num a => a -> a
not :: Bool -> Bool
notElem ::
- forall a (t :: * -> *). (Eq a, Foldable t) => a -> t a -> Bool
+ forall (t :: * -> *) a. (Eq a, Foldable t) => a -> t a -> Bool
null :: forall (t :: * -> *) a. Foldable t => t a -> Bool
odd :: forall a. Integral a => a -> Bool
or :: forall (t :: * -> *). Foldable t => t Bool -> Bool
diff --git a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.hs b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.hs index 338ae5cae8..393d1d12a4 100644 --- a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.hs +++ b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE PartialTypeSignatures, NamedWildCards #-} +{-# LANGUAGE FlexibleContexts, PartialTypeSignatures, NamedWildCards #-} module SomethingShowable where somethingShowable :: Show _x => _x -> _ diff --git a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr index c087fda438..b0957a0b9b 100644 --- a/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SomethingShowable.stderr @@ -1,7 +1,8 @@ TYPE SIGNATURES - somethingShowable :: Bool -> String + somethingShowable :: Show Bool => Bool -> String TYPE CONSTRUCTORS COERCION AXIOMS Dependent modules: [] Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, integer-gmp-1.0.0.0] + diff --git a/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr b/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr index 1df0b889fd..333a78f97b 100644 --- a/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr +++ b/testsuite/tests/partial-sigs/should_compile/SplicesUsed.stderr @@ -1,82 +1,100 @@ -[1 of 2] Compiling Splices ( Splices.hs, Splices.o )
-[2 of 2] Compiling SplicesUsed ( SplicesUsed.hs, SplicesUsed.o )
-
-SplicesUsed.hs:7:16: warning:
- Found type wildcard ‘_’ standing for ‘Maybe Bool’
- In the type signature for:
- maybeBool :: _
-
-SplicesUsed.hs:8:15: warning:
- Found type wildcard ‘_a’ standing for ‘Maybe Bool’
- In an expression type signature: _a -> _a
- In the expression: id :: _a -> _a
- In the expression: (id :: _a -> _a) (Just True :: Maybe _)
- Relevant bindings include
- maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1)
-
-SplicesUsed.hs:8:27: warning:
- Found type wildcard ‘_’ standing for ‘Bool’
- In an expression type signature: Maybe _
- In the first argument of ‘id :: _a -> _a’, namely
- ‘(Just True :: Maybe _)’
- In the expression: (id :: _a -> _a) (Just True :: Maybe _)
- Relevant bindings include
- maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1)
-
-SplicesUsed.hs:10:17: warning:
- Found type wildcard ‘_’ standing for ‘(Char, a)’
- Where: ‘a’ is a rigid type variable bound by
- the inferred type of charA :: a -> (Char, a)
- at SplicesUsed.hs:10:10
- In the type signature for:
- charA :: a -> (_)
-
-SplicesUsed.hs:13:14: warning:
- Found type wildcard ‘_’ standing for ‘a -> Bool’
- Where: ‘a’ is a rigid type variable bound by
- the inferred type of filter' :: (a -> Bool) -> [a] -> [a]
- at SplicesUsed.hs:14:1
- In the type signature for:
- filter' :: _ -> _ -> _
-
-SplicesUsed.hs:13:14: warning:
- Found type wildcard ‘_’ standing for ‘[a]’
- Where: ‘a’ is a rigid type variable bound by
- the inferred type of filter' :: (a -> Bool) -> [a] -> [a]
- at SplicesUsed.hs:14:1
- In the type signature for:
- filter' :: _ -> _ -> _
-
-SplicesUsed.hs:13:14: warning:
- Found type wildcard ‘_’ standing for ‘[a]’
- Where: ‘a’ is a rigid type variable bound by
- the inferred type of filter' :: (a -> Bool) -> [a] -> [a]
- at SplicesUsed.hs:14:1
- In the type signature for:
- filter' :: _ -> _ -> _
-
-SplicesUsed.hs:16:3: warning:
- Found hole ‘_’ with inferred constraints: Eq a
- In the type signature for:
- foo :: _ => _
-
-SplicesUsed.hs:16:3: warning:
- Found type wildcard ‘_’ standing for ‘a -> a -> Bool’
- Where: ‘a’ is a rigid type variable bound by
- the inferred type of foo :: Eq a => a -> a -> Bool
- at SplicesUsed.hs:16:3
- In the type signature for:
- foo :: _ => _
-
-SplicesUsed.hs:18:3: warning:
- Found type wildcard ‘_a’ standing for ‘Bool’
- In the type signature for:
- bar :: _a -> _b -> (_a, _b)
-
-SplicesUsed.hs:18:3: warning:
- Found type wildcard ‘_b’ standing for ‘t’
- Where: ‘t’ is a rigid type variable bound by
- the inferred type of bar :: Bool -> t -> (Bool, t)
- at SplicesUsed.hs:18:3
- In the type signature for:
- bar :: _a -> _b -> (_a, _b)
+[1 of 2] Compiling Splices ( Splices.hs, Splices.o ) +[2 of 2] Compiling SplicesUsed ( SplicesUsed.hs, SplicesUsed.o ) + +SplicesUsed.hs:7:16: warning: + • Found type wildcard ‘_’ standing for ‘Maybe Bool’ + • In the type signature: + maybeBool :: _ + • Relevant bindings include + maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1) + +SplicesUsed.hs:8:15: warning: + • Found type wildcard ‘_a’ standing for ‘t’ + Where: ‘t’ is a rigid type variable bound by + the inferred type of <expression> :: t -> t at SplicesUsed.hs:8:15 + • In an expression type signature: _a -> _a + In the expression: id :: _a -> _a + In the expression: (id :: _a -> _a) (Just True :: Maybe _) + • Relevant bindings include + maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1) + +SplicesUsed.hs:8:27: warning: + • Found type wildcard ‘_’ standing for ‘Bool’ + • In an expression type signature: Maybe _ + In the first argument of ‘id :: _a -> _a’, namely + ‘(Just True :: Maybe _)’ + In the expression: (id :: _a -> _a) (Just True :: Maybe _) + • Relevant bindings include + maybeBool :: Maybe Bool (bound at SplicesUsed.hs:8:1) + +SplicesUsed.hs:10:17: warning: + • Found type wildcard ‘_’ standing for ‘(Char, a)’ + Where: ‘a’ is a rigid type variable bound by + the inferred type of charA :: a -> (Char, a) + at SplicesUsed.hs:10:10 + • In the type signature: + charA :: a -> (_) + • Relevant bindings include + charA :: a -> (Char, a) (bound at SplicesUsed.hs:11:1) + +SplicesUsed.hs:13:14: warning: + • Found type wildcard ‘_’ standing for ‘a -> Bool’ + Where: ‘a’ is a rigid type variable bound by + the inferred type of filter' :: (a -> Bool) -> [a] -> [a] + at SplicesUsed.hs:14:1 + • In the type signature: + filter' :: _ -> _ -> _ + • Relevant bindings include + filter' :: (a -> Bool) -> [a] -> [a] (bound at SplicesUsed.hs:14:1) + +SplicesUsed.hs:13:14: warning: + • Found type wildcard ‘_’ standing for ‘[a]’ + Where: ‘a’ is a rigid type variable bound by + the inferred type of filter' :: (a -> Bool) -> [a] -> [a] + at SplicesUsed.hs:14:1 + • In the type signature: + filter' :: _ -> _ -> _ + • Relevant bindings include + filter' :: (a -> Bool) -> [a] -> [a] (bound at SplicesUsed.hs:14:1) + +SplicesUsed.hs:13:14: warning: + • Found type wildcard ‘_’ standing for ‘[a]’ + Where: ‘a’ is a rigid type variable bound by + the inferred type of filter' :: (a -> Bool) -> [a] -> [a] + at SplicesUsed.hs:14:1 + • In the type signature: + filter' :: _ -> _ -> _ + • Relevant bindings include + filter' :: (a -> Bool) -> [a] -> [a] (bound at SplicesUsed.hs:14:1) + +SplicesUsed.hs:16:3: warning: + Found constraint wildcard ‘_’ standing for ‘Eq a’ + In the type signature: + foo :: _ => _ + +SplicesUsed.hs:16:3: warning: + • Found type wildcard ‘_’ standing for ‘a -> a -> Bool’ + Where: ‘a’ is a rigid type variable bound by + the inferred type of foo :: Eq a => a -> a -> Bool + at SplicesUsed.hs:16:3 + • In the type signature: + foo :: _ => _ + • Relevant bindings include + foo :: a -> a -> Bool (bound at SplicesUsed.hs:16:3) + +SplicesUsed.hs:18:3: warning: + • Found type wildcard ‘_a’ standing for ‘Bool’ + • In the type signature: + bar :: _a -> _b -> (_a, _b) + • Relevant bindings include + bar :: Bool -> t -> (Bool, t) (bound at SplicesUsed.hs:18:3) + +SplicesUsed.hs:18:3: warning: + • Found type wildcard ‘_b’ standing for ‘t’ + Where: ‘t’ is a rigid type variable bound by + the inferred type of bar :: Bool -> t -> (Bool, t) + at SplicesUsed.hs:18:3 + • In the type signature: + bar :: _a -> _b -> (_a, _b) + • Relevant bindings include + bar :: Bool -> t -> (Bool, t) (bound at SplicesUsed.hs:18:3) diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.hs b/testsuite/tests/partial-sigs/should_compile/T10403.hs index 97cda7ae2b..6610254805 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10403.hs +++ b/testsuite/tests/partial-sigs/should_compile/T10403.hs @@ -17,6 +17,7 @@ h1 :: _ => _ h1 f b = (H . fmap (const ())) (fmap f b) h2 :: _ +-- MR applies -- h2 :: Functor m => (a -> b) -> m a -> H m h2 f b = (H . fmap (const ())) (fmap f b) diff --git a/testsuite/tests/partial-sigs/should_compile/T10403.stderr b/testsuite/tests/partial-sigs/should_compile/T10403.stderr index bfd5367bcd..1a71a3c803 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10403.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10403.stderr @@ -1,39 +1,80 @@ T10403.hs:15:7: warning: - Found hole ‘_’ with inferred constraints: Functor f - In the type signature for: + Found constraint wildcard ‘_’ standing for ‘Functor f’ + In the type signature: h1 :: _ => _ T10403.hs:15:12: warning: - Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’ - Where: ‘b’ is a rigid type variable bound by + • Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’ + Where: ‘b’ is a rigid type variable bound by the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f at T10403.hs:17:1 - ‘a’ is a rigid type variable bound by + ‘a’ is a rigid type variable bound by the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f at T10403.hs:17:1 - ‘f’ is a rigid type variable bound by + ‘f’ is a rigid type variable bound by the inferred type of h1 :: Functor f => (a -> b) -> f a -> H f at T10403.hs:17:1 - In the type signature for: - h1 :: _ => _ + • In the type signature: + h1 :: _ => _ + • Relevant bindings include + h1 :: (a -> b) -> f a -> H f (bound at T10403.hs:17:1) T10403.hs:19:7: warning: - Found type wildcard ‘_’ standing for ‘(a -> b) -> f a -> H f’ - Where: ‘b’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - ‘a’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - ‘f’ is a rigid type variable bound by - the inferred type of h2 :: Functor f => (a -> b) -> f a -> H f - at T10403.hs:21:1 - In the type signature for: - h2 :: _ + • Found type wildcard ‘_’ standing for ‘(a -> b) -> f0 a -> H f0’ + Where: ‘b’ is a rigid type variable bound by + the inferred type of h2 :: (a -> b) -> f0 a -> H f0 + at T10403.hs:22:1 + ‘a’ is a rigid type variable bound by + the inferred type of h2 :: (a -> b) -> f0 a -> H f0 + at T10403.hs:22:1 + ‘f0’ is an ambiguous type variable + • In the type signature: + h2 :: _ + • Relevant bindings include + h2 :: (a -> b) -> f0 a -> H f0 (bound at T10403.hs:22:1) + +T10403.hs:22:15: warning: + • Ambiguous type variable ‘f0’ arising from a use of ‘fmap’ + prevents the constraint ‘(Functor f0)’ from being solved. + Relevant bindings include + b :: f0 a (bound at T10403.hs:22:6) + h2 :: (a -> b) -> f0 a -> H f0 (bound at T10403.hs:22:1) + Probable fix: use a type annotation to specify what ‘f0’ should be. + These potential instances exist: + instance Functor IO -- Defined in ‘GHC.Base’ + instance Functor (B t) -- Defined at T10403.hs:10:10 + instance Functor I -- Defined at T10403.hs:6:10 + ...plus four others + (use -fprint-potential-instances to see them all) + • In the second argument of ‘(.)’, namely ‘fmap (const ())’ + In the expression: H . fmap (const ()) + In the expression: (H . fmap (const ())) (fmap f b) + +T10403.hs:28:8: warning: + • Couldn't match type ‘f0’ with ‘B t’ + because type variable ‘t’ would escape its scope + This (rigid, skolem) type variable is bound by + the type signature for: + app2 :: H (B t) + at T10403.hs:27:1-15 + Expected type: H (B t) + Actual type: H f0 + • In the expression: h2 (H . I) (B ()) + In an equation for ‘app2’: app2 = h2 (H . I) (B ()) + • Relevant bindings include + app2 :: H (B t) (bound at T10403.hs:28:1) -T10403.hs:21:1: warning: - No instance for (Functor f) - When checking that ‘h2’ has the inferred type - h2 :: forall (f :: * -> *) b a. (a -> b) -> f a -> H f - Probable cause: the inferred type is ambiguous +T10403.hs:28:20: warning: + • Couldn't match type ‘f0’ with ‘B t’ + because type variable ‘t’ would escape its scope + This (rigid, skolem) type variable is bound by + the type signature for: + app2 :: H (B t) + at T10403.hs:27:1-15 + Expected type: f0 () + Actual type: B t () + • In the second argument of ‘h2’, namely ‘(B ())’ + In the expression: h2 (H . I) (B ()) + • Relevant bindings include + app2 :: H (B t) (bound at T10403.hs:28:1) diff --git a/testsuite/tests/partial-sigs/should_compile/T10438.stderr b/testsuite/tests/partial-sigs/should_compile/T10438.stderr index 2ae08675f2..f070b3b8a0 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10438.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10438.stderr @@ -1,27 +1,28 @@ -
-T10438.hs:7:22: warning:
- Found type wildcard ‘_’ standing for ‘t2’
- Where: ‘t2’ is a rigid type variable bound by
- the inferred type of g :: t2 -> t2 at T10438.hs:6:9
- In the type signature for:
- x :: _
- In an equation for ‘g’:
- g r
- = x
- where
- x :: _
- x = r
- In an equation for ‘foo’:
- foo f
- = g
- where
- g r
- = x
- where
- x :: _
- x = r
- Relevant bindings include
- r :: t2 (bound at T10438.hs:6:11)
- g :: t2 -> t2 (bound at T10438.hs:6:9)
- f :: t (bound at T10438.hs:5:5)
- foo :: t -> t1 -> t1 (bound at T10438.hs:5:1)
+ +T10438.hs:7:22: warning: + • Found type wildcard ‘_’ standing for ‘t2’ + Where: ‘t2’ is a rigid type variable bound by + the inferred type of g :: t2 -> t2 at T10438.hs:6:9 + • In the type signature: + x :: _ + In an equation for ‘g’: + g r + = x + where + x :: _ + x = r + In an equation for ‘foo’: + foo f + = g + where + g r + = x + where + x :: _ + x = r + • Relevant bindings include + x :: t2 (bound at T10438.hs:8:17) + r :: t2 (bound at T10438.hs:6:11) + g :: t2 -> t2 (bound at T10438.hs:6:9) + f :: t (bound at T10438.hs:5:5) + foo :: t -> t1 -> t1 (bound at T10438.hs:5:1) diff --git a/testsuite/tests/partial-sigs/should_compile/T10519.stderr b/testsuite/tests/partial-sigs/should_compile/T10519.stderr index de53da2d33..d34b06227a 100644 --- a/testsuite/tests/partial-sigs/should_compile/T10519.stderr +++ b/testsuite/tests/partial-sigs/should_compile/T10519.stderr @@ -1,5 +1,5 @@ T10519.hs:5:18: warning:
- Found hole ‘_’ with inferred constraints: Eq a
- In the type signature for:
+ Found constraint wildcard ‘_’ standing for ‘Eq a’
+ In the type signature:
foo :: forall a. _ => a -> a -> Bool
diff --git a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr index df7cbfcbac..def47612d3 100644 --- a/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr +++ b/testsuite/tests/partial-sigs/should_compile/WarningWildcardInstantiations.stderr @@ -1,53 +1,66 @@ -TYPE SIGNATURES
- bar :: forall t t1. t -> (t -> t1) -> t1
- foo :: forall a. (Show a, Enum a) => a -> String
-TYPE CONSTRUCTORS
-COERCION AXIOMS
-Dependent modules: []
-Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0,
- integer-gmp-1.0.0.0]
-
-WarningWildcardInstantiations.hs:5:14: warning:
- Found type wildcard ‘_a’ standing for ‘a’
- Where: ‘a’ is a rigid type variable bound by
- the inferred type of foo :: (Enum a, Show a) => a -> String
- at WarningWildcardInstantiations.hs:6:1
- In the type signature for:
- foo :: (Show _a, _) => _a -> _
-
-WarningWildcardInstantiations.hs:5:18: warning:
- Found hole ‘_’ with inferred constraints: Enum a
- In the type signature for:
- foo :: (Show _a, _) => _a -> _
-
-WarningWildcardInstantiations.hs:5:30: warning:
- Found type wildcard ‘_’ standing for ‘String’
- In the type signature for:
- foo :: (Show _a, _) => _a -> _
-
-WarningWildcardInstantiations.hs:8:8: warning:
- Found type wildcard ‘_’ standing for ‘t’
- Where: ‘t’ is a rigid type variable bound by
- the inferred type of bar :: t -> (t -> t1) -> t1
- at WarningWildcardInstantiations.hs:9:1
- In the type signature for:
- bar :: _ -> _ -> _
-
-WarningWildcardInstantiations.hs:8:13: warning:
- Found type wildcard ‘_’ standing for ‘t -> t1’
- Where: ‘t’ is a rigid type variable bound by
- the inferred type of bar :: t -> (t -> t1) -> t1
- at WarningWildcardInstantiations.hs:9:1
- ‘t1’ is a rigid type variable bound by
- the inferred type of bar :: t -> (t -> t1) -> t1
- at WarningWildcardInstantiations.hs:9:1
- In the type signature for:
- bar :: _ -> _ -> _
-
-WarningWildcardInstantiations.hs:8:18: warning:
- Found type wildcard ‘_’ standing for ‘t1’
- Where: ‘t1’ is a rigid type variable bound by
- the inferred type of bar :: t -> (t -> t1) -> t1
- at WarningWildcardInstantiations.hs:9:1
- In the type signature for:
- bar :: _ -> _ -> _
+TYPE SIGNATURES + bar :: forall t t1. t -> (t -> t1) -> t1 + foo :: forall a. (Show a, Enum a) => a -> String +TYPE CONSTRUCTORS +COERCION AXIOMS +Dependent modules: [] +Dependent packages: [base-4.9.0.0, ghc-prim-0.5.0.0, + integer-gmp-1.0.0.0] + +WarningWildcardInstantiations.hs:5:14: warning: + • Found type wildcard ‘_a’ standing for ‘a’ + Where: ‘a’ is a rigid type variable bound by + the inferred type of foo :: (Enum a, Show a) => a -> String + at WarningWildcardInstantiations.hs:6:1 + • In the type signature: + foo :: (Show _a, _) => _a -> _ + • Relevant bindings include + foo :: a -> String (bound at WarningWildcardInstantiations.hs:6:1) + +WarningWildcardInstantiations.hs:5:18: warning: + Found constraint wildcard ‘_’ standing for ‘Enum a’ + In the type signature: + foo :: (Show _a, _) => _a -> _ + +WarningWildcardInstantiations.hs:5:30: warning: + • Found type wildcard ‘_’ standing for ‘String’ + • In the type signature: + foo :: (Show _a, _) => _a -> _ + • Relevant bindings include + foo :: a -> String (bound at WarningWildcardInstantiations.hs:6:1) + +WarningWildcardInstantiations.hs:8:8: warning: + • Found type wildcard ‘_’ standing for ‘t’ + Where: ‘t’ is a rigid type variable bound by + the inferred type of bar :: t -> (t -> t1) -> t1 + at WarningWildcardInstantiations.hs:9:1 + • In the type signature: + bar :: _ -> _ -> _ + • Relevant bindings include + bar :: t -> (t -> t1) -> t1 + (bound at WarningWildcardInstantiations.hs:9:1) + +WarningWildcardInstantiations.hs:8:13: warning: + • Found type wildcard ‘_’ standing for ‘t -> t1’ + Where: ‘t’ is a rigid type variable bound by + the inferred type of bar :: t -> (t -> t1) -> t1 + at WarningWildcardInstantiations.hs:9:1 + ‘t1’ is a rigid type variable bound by + the inferred type of bar :: t -> (t -> t1) -> t1 + at WarningWildcardInstantiations.hs:9:1 + • In the type signature: + bar :: _ -> _ -> _ + • Relevant bindings include + bar :: t -> (t -> t1) -> t1 + (bound at WarningWildcardInstantiations.hs:9:1) + +WarningWildcardInstantiations.hs:8:18: warning: + • Found type wildcard ‘_’ standing for ‘t1’ + Where: ‘t1’ is a rigid type variable bound by + the inferred type of bar :: t -> (t -> t1) -> t1 + at WarningWildcardInstantiations.hs:9:1 + • In the type signature: + bar :: _ -> _ -> _ + • Relevant bindings include + bar :: t -> (t -> t1) -> t1 + (bound at WarningWildcardInstantiations.hs:9:1) diff --git a/testsuite/tests/partial-sigs/should_compile/all.T b/testsuite/tests/partial-sigs/should_compile/all.T index e99a414b13..142d3318c8 100644 --- a/testsuite/tests/partial-sigs/should_compile/all.T +++ b/testsuite/tests/partial-sigs/should_compile/all.T @@ -56,3 +56,4 @@ test('T10403', normal, compile, ['']) test('T10438', normal, compile, ['']) test('T10519', normal, compile, ['']) test('T10463', normal, compile, ['']) +test('ExprSigLocal', normal, compile, ['']) |