summaryrefslogtreecommitdiff
path: root/testsuite/tests/gadt
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-06-15 13:27:12 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-06-15 17:36:02 +0100
commite368f3265b80aeb337fbac3f6a70ee54ab14edfd (patch)
treec38b396e267a5f8172751daa8f985c22d6f92760 /testsuite/tests/gadt
parent77bb09270c70455bbd547470c4e995707d19f37d (diff)
downloadhaskell-e368f3265b80aeb337fbac3f6a70ee54ab14edfd.tar.gz
Major patch to introduce TyConBinder
Before this patch, following the TypeInType innovations, each TyCon had two lists: - tyConBinders :: [TyBinder] - tyConTyVars :: [TyVar] They were in 1-1 correspondence and contained overlapping information. More broadly, there were many places where we had to pass around this pair of lists, instead of a single list. This commit tidies all that up, by having just one list of binders in a TyCon: - tyConBinders :: [TyConBinder] The new data types look like this: Var.hs: data TyVarBndr tyvar vis = TvBndr tyvar vis data VisibilityFlag = Visible | Specified | Invisible type TyVarBinder = TyVarBndr TyVar VisibilityFlag TyCon.hs: type TyConBinder = TyVarBndr TyVar TyConBndrVis data TyConBndrVis = NamedTCB VisibilityFlag | AnonTCB TyCoRep.hs: data TyBinder = Named TyVarBinder | Anon Type Note that Var.TyVarBdr has moved from TyCoRep and has been made polymorphic in the tyvar and visiblity fields: type TyVarBinder = TyVarBndr TyVar VisibilityFlag -- Used in ForAllTy type TyConBinder = TyVarBndr TyVar TyConBndrVis -- Used in TyCon type IfaceForAllBndr = TyVarBndr IfaceTvBndr VisibilityFlag type IfaceTyConBinder = TyVarBndr IfaceTvBndr TyConBndrVis -- Ditto, in interface files There are a zillion knock-on changes, but everything arises from these types. It was a bit fiddly to get the module loops to work out right! Some smaller points ~~~~~~~~~~~~~~~~~~~ * Nice new functions TysPrim.mkTemplateKiTyVars TysPrim.mkTemplateTyConBinders which help you make the tyvar binders for dependently-typed TyCons. See comments with their definition. * The change showed up a bug in TcGenGenerics.tc_mkRepTy, where the code was making an assumption about the order of the kind variables in the kind of GHC.Generics.(:.:). I fixed this; see TcGenGenerics.mkComp.
Diffstat (limited to 'testsuite/tests/gadt')
-rw-r--r--testsuite/tests/gadt/gadt13.stderr34
-rw-r--r--testsuite/tests/gadt/gadt7.stderr40
2 files changed, 37 insertions, 37 deletions
diff --git a/testsuite/tests/gadt/gadt13.stderr b/testsuite/tests/gadt/gadt13.stderr
index 06b1f9c720..e304430b51 100644
--- a/testsuite/tests/gadt/gadt13.stderr
+++ b/testsuite/tests/gadt/gadt13.stderr
@@ -1,17 +1,17 @@
-
-gadt13.hs:15:13: error:
- • Couldn't match expected type ‘t’
- with actual type ‘String -> [Char]’
- ‘t’ is untouchable
- inside the constraints: t1 ~ Int
- bound by a pattern with constructor: I :: Int -> Term Int,
- in an equation for ‘shw’
- at gadt13.hs:15:6-8
- ‘t’ is a rigid type variable bound by
- the inferred type of shw :: Term t1 -> t at gadt13.hs:15:1-30
- Possible fix: add a type signature for ‘shw’
- • Possible cause: ‘(.)’ is applied to too many arguments
- In the expression: ("I " ++) . shows t
- In an equation for ‘shw’: shw (I t) = ("I " ++) . shows t
- • Relevant bindings include
- shw :: Term t1 -> t (bound at gadt13.hs:15:1)
+
+gadt13.hs:15:13: error:
+ • Couldn't match expected type ‘t’
+ with actual type ‘String -> [Char]’
+ ‘t’ is untouchable
+ inside the constraints: a ~ Int
+ bound by a pattern with constructor: I :: Int -> Term Int,
+ in an equation for ‘shw’
+ at gadt13.hs:15:6-8
+ ‘t’ is a rigid type variable bound by
+ the inferred type of shw :: Term a -> t at gadt13.hs:15:1-30
+ Possible fix: add a type signature for ‘shw’
+ • Possible cause: ‘(.)’ is applied to too many arguments
+ In the expression: ("I " ++) . shows t
+ In an equation for ‘shw’: shw (I t) = ("I " ++) . shows t
+ • Relevant bindings include
+ shw :: Term a -> t (bound at gadt13.hs:15:1)
diff --git a/testsuite/tests/gadt/gadt7.stderr b/testsuite/tests/gadt/gadt7.stderr
index 6e1effa067..e66226eaea 100644
--- a/testsuite/tests/gadt/gadt7.stderr
+++ b/testsuite/tests/gadt/gadt7.stderr
@@ -1,20 +1,20 @@
-
-gadt7.hs:16:38: error:
- • Couldn't match expected type ‘t’ with actual type ‘t1’
- ‘t’ is untouchable
- inside the constraints: t2 ~ Int
- bound by a pattern with constructor: K :: T Int,
- in a case alternative
- at gadt7.hs:16:33
- ‘t’ is a rigid type variable bound by
- the inferred type of i1b :: T t2 -> t1 -> t at gadt7.hs:16:1-44
- ‘t1’ is a rigid type variable bound by
- the inferred type of i1b :: T t2 -> t1 -> t at gadt7.hs:16:1-44
- Possible fix: add a type signature for ‘i1b’
- • In the expression: y1
- In a case alternative: K -> y1
- In the expression: case t1 of { K -> y1 }
- • Relevant bindings include
- y1 :: t1 (bound at gadt7.hs:16:16)
- y :: t1 (bound at gadt7.hs:16:7)
- i1b :: T t2 -> t1 -> t (bound at gadt7.hs:16:1)
+
+gadt7.hs:16:38: error:
+ • Couldn't match expected type ‘t’ with actual type ‘t1’
+ ‘t’ is untouchable
+ inside the constraints: a ~ Int
+ bound by a pattern with constructor: K :: T Int,
+ in a case alternative
+ at gadt7.hs:16:33
+ ‘t’ is a rigid type variable bound by
+ the inferred type of i1b :: T a -> t1 -> t at gadt7.hs:16:1-44
+ ‘t1’ is a rigid type variable bound by
+ the inferred type of i1b :: T a -> t1 -> t at gadt7.hs:16:1-44
+ Possible fix: add a type signature for ‘i1b’
+ • In the expression: y1
+ In a case alternative: K -> y1
+ In the expression: case t1 of { K -> y1 }
+ • Relevant bindings include
+ y1 :: t1 (bound at gadt7.hs:16:16)
+ y :: t1 (bound at gadt7.hs:16:7)
+ i1b :: T a -> t1 -> t (bound at gadt7.hs:16:1)