summaryrefslogtreecommitdiff
path: root/testsuite/tests/polykinds
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-12-01 17:38:23 +0100
committerBen Gamari <ben@smart-cactus.org>2015-12-01 18:45:23 +0100
commit1e041b7382b6aa329e4ad9625439f811e0f27232 (patch)
tree91f4418553a1e6df072f56f43b5697d40c985b5f /testsuite/tests/polykinds
parentb432e2f39c095d8acbb0cfcc63bd08436c7a3e49 (diff)
downloadhaskell-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/polykinds')
-rw-r--r--testsuite/tests/polykinds/PolyKinds02.stderr10
-rw-r--r--testsuite/tests/polykinds/T10503.stderr31
-rw-r--r--testsuite/tests/polykinds/T10516.stderr2
-rw-r--r--testsuite/tests/polykinds/T6021.stderr9
-rw-r--r--testsuite/tests/polykinds/T6068.hs4
-rw-r--r--testsuite/tests/polykinds/T7224.stderr11
-rw-r--r--testsuite/tests/polykinds/T7230.stderr54
-rw-r--r--testsuite/tests/polykinds/T7278.stderr10
-rw-r--r--testsuite/tests/polykinds/T7328.stderr15
-rw-r--r--testsuite/tests/polykinds/T7438.stderr1
-rw-r--r--testsuite/tests/polykinds/T9222.stderr15
11 files changed, 80 insertions, 82 deletions
diff --git a/testsuite/tests/polykinds/PolyKinds02.stderr b/testsuite/tests/polykinds/PolyKinds02.stderr
index ab646d81c7..7c5716a65e 100644
--- a/testsuite/tests/polykinds/PolyKinds02.stderr
+++ b/testsuite/tests/polykinds/PolyKinds02.stderr
@@ -1,5 +1,5 @@
-
-PolyKinds02.hs:13:16:
- The second argument of ‘Vec’ should have kind ‘Nat’,
- but ‘Nat’ has kind ‘*’
- In the type signature for ‘vec’: vec :: Vec Nat Nat
+
+PolyKinds02.hs:13:16: error:
+ The second argument of ‘Vec’ should have kind ‘Nat’,
+ but ‘Nat’ has kind ‘*’
+ In the type signature: vec :: Vec Nat Nat
diff --git a/testsuite/tests/polykinds/T10503.stderr b/testsuite/tests/polykinds/T10503.stderr
index e2817fe776..071ab5e88e 100644
--- a/testsuite/tests/polykinds/T10503.stderr
+++ b/testsuite/tests/polykinds/T10503.stderr
@@ -1,16 +1,15 @@
-
-T10503.hs:8:6: error:
- Couldn't match kind ‘k’ with ‘*’
- ‘k’ is a rigid type variable bound by
- the type signature for:
- h :: ((Proxy 'KProxy ~ Proxy 'KProxy) => r) -> r
- at T10503.hs:8:6
- Expected type: Proxy 'KProxy
- Actual type: Proxy 'KProxy
- In the ambiguity check for the type signature for ‘h’:
- h :: forall (k :: BOX) r.
- ((Proxy 'KProxy ~ Proxy 'KProxy) => r) -> r
- To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
- In the type signature for ‘h’:
- h :: forall r.
- (Proxy (KProxy :: KProxy k) ~ Proxy (KProxy :: KProxy *) => r) -> r
+
+T10503.hs:8:6: error:
+ Couldn't match kind ‘k’ with ‘*’
+ ‘k’ is a rigid type variable bound by
+ the type signature for:
+ h :: forall (k :: BOX) r.
+ ((Proxy 'KProxy ~ Proxy 'KProxy) => r) -> r
+ at T10503.hs:8:6
+ Expected type: Proxy 'KProxy
+ Actual type: Proxy 'KProxy
+ In the ambiguity check for ‘h’
+ To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
+ In the type signature:
+ h :: forall r.
+ (Proxy (KProxy :: KProxy k) ~ Proxy (KProxy :: KProxy *) => r) -> r
diff --git a/testsuite/tests/polykinds/T10516.stderr b/testsuite/tests/polykinds/T10516.stderr
index 0242722ea5..a6fa52471b 100644
--- a/testsuite/tests/polykinds/T10516.stderr
+++ b/testsuite/tests/polykinds/T10516.stderr
@@ -1,4 +1,4 @@
T10516.hs:8:6: error:
The type synonym ‘App’ should have 2 arguments, but has been given 1
- In the type signature for ‘f’: f :: f a -> X (App f) a
+ In the type signature: f :: f a -> X (App f) a
diff --git a/testsuite/tests/polykinds/T6021.stderr b/testsuite/tests/polykinds/T6021.stderr
index ea3b9e3427..0b7ce77439 100644
--- a/testsuite/tests/polykinds/T6021.stderr
+++ b/testsuite/tests/polykinds/T6021.stderr
@@ -1,4 +1,5 @@
-
-T6021.hs:5:10:
- Kind variable also used as type variable: ‘b’
- In an instance declaration
+
+T6021.hs:5:22: error:
+ Type variable ‘b’ used as a kind
+ In the kind ‘b’
+ In the instance declaration for ‘Panic (a :: b) b’
diff --git a/testsuite/tests/polykinds/T6068.hs b/testsuite/tests/polykinds/T6068.hs
index 0b414a87b9..7b90b4ebaf 100644
--- a/testsuite/tests/polykinds/T6068.hs
+++ b/testsuite/tests/polykinds/T6068.hs
@@ -1,5 +1,5 @@
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
-{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, GADTs, MultiParamTypeClasses,
+{-# LANGUAGE PolyKinds, DataKinds, TypeFamilies, GADTs, MultiParamTypeClasses, KindSignatures,
FunctionalDependencies, FlexibleInstances, UndecidableInstances, ExistentialQuantification #-}
module T6068 where
@@ -23,7 +23,7 @@ class HasSingleton a (kp :: KProxy k) | a -> kp where
class Floop a b | a -> b
-instance forall a (mp :: KProxy (Maybe ak)). Floop a mp => HasSingleton (Maybe a) mp where
+instance Floop a (mp :: KProxy (Maybe ak)) => HasSingleton (Maybe a) mp where
exists Nothing = Exists SNothing
-- instance forall (a ::*) (mp :: KProxy (Maybe ak)). HasSingleton (Maybe ak) (Maybe a) mp where
diff --git a/testsuite/tests/polykinds/T7224.stderr b/testsuite/tests/polykinds/T7224.stderr
index 90ebc0f3ec..b957a1ba65 100644
--- a/testsuite/tests/polykinds/T7224.stderr
+++ b/testsuite/tests/polykinds/T7224.stderr
@@ -1,5 +1,6 @@
-
-T7224.hs:6:19:
- Kind variable ‘i’ used as a type
- In the type ‘a -> m i i a’
- In the class declaration for ‘PMonad'’
+
+T7224.hs:6:19: error:
+ Kind variable ‘i’ used as a type
+ In the type signature:
+ ret' :: a -> m i i a
+ In the class declaration for ‘PMonad'’
diff --git a/testsuite/tests/polykinds/T7230.stderr b/testsuite/tests/polykinds/T7230.stderr
index 0756cd5284..92938bedb1 100644
--- a/testsuite/tests/polykinds/T7230.stderr
+++ b/testsuite/tests/polykinds/T7230.stderr
@@ -1,28 +1,28 @@
-T7230.hs:48:32:
- Could not deduce: (x :<<= x1) ~ 'True
- from the context: Increasing xs ~ 'True
- bound by the type signature for:
- crash :: (Increasing xs ~ 'True) =>
- SList xs -> SBool (Increasing xs)
- at T7230.hs:47:10-68
- or from: xs ~ (x : xs1)
- bound by a pattern with constructor:
- SCons :: forall (k :: BOX) (x :: k) (xs :: [k]).
- Sing x -> Sing xs -> Sing (x : xs),
- in an equation for ‘crash’
- at T7230.hs:48:8-27
- or from: xs1 ~ (x1 : xs2)
- bound by a pattern with constructor:
- SCons :: forall (k :: BOX) (x :: k) (xs :: [k]).
- Sing x -> Sing xs -> Sing (x : xs),
- in an equation for ‘crash’
- at T7230.hs:48:17-26
- Expected type: SBool (Increasing xs)
- Actual type: SBool (x :<<= x1)
- In the expression: x %:<<= y
- In an equation for ‘crash’:
- crash (SCons x (SCons y xs)) = x %:<<= y
- Relevant bindings include
- y :: Sing x1 (bound at T7230.hs:48:23)
- x :: Sing x (bound at T7230.hs:48:14)
+T7230.hs:48:32: error:
+ • Could not deduce: (x :<<= x1) ~ 'True
+ from the context: Increasing xs ~ 'True
+ bound by the type signature for:
+ crash :: (Increasing xs ~ 'True) =>
+ SList xs -> SBool (Increasing xs)
+ at T7230.hs:47:1-68
+ or from: xs ~ (x : xs1)
+ bound by a pattern with constructor:
+ SCons :: forall (k :: BOX) (x :: k) (xs :: [k]).
+ Sing x -> Sing xs -> Sing (x : xs),
+ in an equation for ‘crash’
+ at T7230.hs:48:8-27
+ or from: xs1 ~ (x1 : xs2)
+ bound by a pattern with constructor:
+ SCons :: forall (k :: BOX) (x :: k) (xs :: [k]).
+ Sing x -> Sing xs -> Sing (x : xs),
+ in an equation for ‘crash’
+ at T7230.hs:48:17-26
+ Expected type: SBool (Increasing xs)
+ Actual type: SBool (x :<<= x1)
+ • In the expression: x %:<<= y
+ In an equation for ‘crash’:
+ crash (SCons x (SCons y xs)) = x %:<<= y
+ • Relevant bindings include
+ y :: Sing x1 (bound at T7230.hs:48:23)
+ x :: Sing x (bound at T7230.hs:48:14)
diff --git a/testsuite/tests/polykinds/T7278.stderr b/testsuite/tests/polykinds/T7278.stderr
index 3d615c12f7..f8b2cfface 100644
--- a/testsuite/tests/polykinds/T7278.stderr
+++ b/testsuite/tests/polykinds/T7278.stderr
@@ -1,5 +1,5 @@
-
-T7278.hs:8:43:
- ‘t’ is applied to too many type arguments
- In the type signature for ‘f’:
- f :: (C (t :: k) (TF t)) => TF t p1 p0 -> t p1 p0
+
+T7278.hs:8:43: error:
+ ‘t’ is applied to too many type arguments
+ In the type signature:
+ f :: (C (t :: k) (TF t)) => TF t p1 p0 -> t p1 p0
diff --git a/testsuite/tests/polykinds/T7328.stderr b/testsuite/tests/polykinds/T7328.stderr
index 7fcd8edf90..9e7cbab03a 100644
--- a/testsuite/tests/polykinds/T7328.stderr
+++ b/testsuite/tests/polykinds/T7328.stderr
@@ -1,7 +1,8 @@
-
-T7328.hs:8:34:
- Kind occurs check
- The first argument of ‘Foo’ should have kind ‘k0’,
- but ‘f’ has kind ‘k1 -> k0’
- In the type ‘a ~ f i => Proxy (Foo f)’
- In the class declaration for ‘Foo’
+
+T7328.hs:8:34: error:
+ Kind occurs check
+ The first argument of ‘Foo’ should have kind ‘k0’,
+ but ‘f’ has kind ‘k1 -> k0’
+ In the type signature:
+ foo :: a ~ f i => Proxy (Foo f)
+ In the class declaration for ‘Foo’
diff --git a/testsuite/tests/polykinds/T7438.stderr b/testsuite/tests/polykinds/T7438.stderr
index d87e437b31..ca09383a2d 100644
--- a/testsuite/tests/polykinds/T7438.stderr
+++ b/testsuite/tests/polykinds/T7438.stderr
@@ -17,3 +17,4 @@ T7438.hs:6:14: error:
Relevant bindings include
acc :: t (bound at T7438.hs:6:8)
go :: Thrist t2 t3 -> t -> t1 (bound at T7438.hs:6:1)
+
diff --git a/testsuite/tests/polykinds/T9222.stderr b/testsuite/tests/polykinds/T9222.stderr
index a5b35ee2b1..6a45c4a7fb 100644
--- a/testsuite/tests/polykinds/T9222.stderr
+++ b/testsuite/tests/polykinds/T9222.stderr
@@ -7,18 +7,13 @@ T9222.hs:13:3: error:
(a ~ '(b0, c0)) => Proxy b0
at T9222.hs:13:3
‘b’ is a rigid type variable bound by
- the type of the constructor ‘Want’:
- ((a ~ '(b, c)) => Proxy b) -> Want a
- at T9222.hs:13:3
+ the type of the constructor ‘Want’:
+ forall (k :: BOX) (k1 :: BOX) (a :: (,) k k1) (b :: k) (c :: k1).
+ ((a ~ '(b, c)) => Proxy b) -> Want a
+ at T9222.hs:13:3
Expected type: '(b, c)
Actual type: a
- In the ambiguity check for the type of the constructor ‘Want’:
- Want :: forall (k :: BOX)
- (k1 :: BOX)
- (a :: (,) k k1)
- (b :: k)
- (c :: k1).
- ((a ~ '(b, c)) => Proxy b) -> Want a
+ In the ambiguity check for ‘Want’
To defer the ambiguity check to use sites, enable AllowAmbiguousTypes
In the definition of data constructor ‘Want’
In the data type declaration for ‘Want’