summaryrefslogtreecommitdiff
path: root/testsuite/tests/parser
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2018-06-14 15:02:36 -0400
committerRichard Eisenberg <rae@cs.brynmawr.edu>2018-06-14 15:05:32 -0400
commitd650729f9a0f3b6aa5e6ef2d5fba337f6f70fa60 (patch)
treeac224609397d4b7ca7072fc87739d2522be7675b /testsuite/tests/parser
parent4672e2ebf040feffde4e7e2d79c479e4c0c3efaf (diff)
downloadhaskell-d650729f9a0f3b6aa5e6ef2d5fba337f6f70fa60.tar.gz
Embrace -XTypeInType, add -XStarIsType
Summary: Implement the "Embrace Type :: Type" GHC proposal, .../ghc-proposals/blob/master/proposals/0020-no-type-in-type.rst GHC 8.0 included a major change to GHC's type system: the Type :: Type axiom. Though casual users were protected from this by hiding its features behind the -XTypeInType extension, all programs written in GHC 8+ have the axiom behind the scenes. In order to preserve backward compatibility, various legacy features were left unchanged. For example, with -XDataKinds but not -XTypeInType, GADTs could not be used in types. Now these restrictions are lifted and -XTypeInType becomes a redundant flag that will be eventually deprecated. * Incorporate the features currently in -XTypeInType into the -XPolyKinds and -XDataKinds extensions. * Introduce a new extension -XStarIsType to control how to parse * in code and whether to print it in error messages. Test Plan: Validate Reviewers: goldfire, hvr, bgamari, alanz, simonpj Reviewed By: goldfire, simonpj Subscribers: rwbarton, thomie, mpickering, carter GHC Trac Issues: #15195 Differential Revision: https://phabricator.haskell.org/D4748
Diffstat (limited to 'testsuite/tests/parser')
-rw-r--r--testsuite/tests/parser/should_compile/DumpParsedAst.stderr109
-rw-r--r--testsuite/tests/parser/should_compile/DumpRenamedAst.hs2
-rw-r--r--testsuite/tests/parser/should_compile/DumpRenamedAst.stderr62
-rw-r--r--testsuite/tests/parser/should_compile/T10379.hs2
-rw-r--r--testsuite/tests/parser/should_fail/T15209.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/all.T5
-rw-r--r--testsuite/tests/parser/should_fail/readFail036.hs4
-rw-r--r--testsuite/tests/parser/should_fail/readFail036.stderr4
-rw-r--r--testsuite/tests/parser/should_fail/typeops_A.hs1
-rw-r--r--testsuite/tests/parser/should_fail/typeops_A.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/typeops_B.hs1
-rw-r--r--testsuite/tests/parser/should_fail/typeops_B.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/typeops_C.hs1
-rw-r--r--testsuite/tests/parser/should_fail/typeops_C.stderr2
-rw-r--r--testsuite/tests/parser/should_fail/typeops_D.hs1
-rw-r--r--testsuite/tests/parser/should_fail/typeops_D.stderr2
16 files changed, 95 insertions, 107 deletions
diff --git a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
index ea9becb6c5..a1765035fb 100644
--- a/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpParsedAst.stderr
@@ -80,77 +80,56 @@
(HsParTy
(NoExt)
({ DumpParsedAst.hs:8:11-16 }
- (HsAppsTy
+ (HsOpTy
(NoExt)
- [({ DumpParsedAst.hs:8:11 }
- (HsAppPrefix
- (NoExt)
- ({ DumpParsedAst.hs:8:11 }
- (HsTyVar
- (NoExt)
- (NotPromoted)
- ({ DumpParsedAst.hs:8:11 }
- (Unqual
- {OccName: a}))))))
- ,({ DumpParsedAst.hs:8:13 }
- (HsAppInfix
- (NoExt)
- ({ DumpParsedAst.hs:8:13 }
- (Exact
- {Name: :}))))
- ,({ DumpParsedAst.hs:8:15-16 }
- (HsAppPrefix
- (NoExt)
- ({ DumpParsedAst.hs:8:15-16 }
- (HsTyVar
- (NoExt)
- (NotPromoted)
- ({ DumpParsedAst.hs:8:15-16 }
- (Unqual
- {OccName: as}))))))]))))]
- (Prefix)
- ({ DumpParsedAst.hs:8:21-36 }
- (HsAppsTy
- (NoExt)
- [({ DumpParsedAst.hs:8:21-24 }
- (HsAppPrefix
- (NoExt)
- ({ DumpParsedAst.hs:8:21-24 }
+ ({ DumpParsedAst.hs:8:11 }
(HsTyVar
(NoExt)
(NotPromoted)
- ({ DumpParsedAst.hs:8:21-24 }
+ ({ DumpParsedAst.hs:8:11 }
(Unqual
- {OccName: Succ}))))))
- ,({ DumpParsedAst.hs:8:26-36 }
- (HsAppPrefix
- (NoExt)
- ({ DumpParsedAst.hs:8:26-36 }
- (HsParTy
+ {OccName: a}))))
+ ({ DumpParsedAst.hs:8:13 }
+ (Exact
+ {Name: :}))
+ ({ DumpParsedAst.hs:8:15-16 }
+ (HsTyVar
(NoExt)
- ({ DumpParsedAst.hs:8:27-35 }
- (HsAppsTy
- (NoExt)
- [({ DumpParsedAst.hs:8:27-32 }
- (HsAppPrefix
- (NoExt)
- ({ DumpParsedAst.hs:8:27-32 }
- (HsTyVar
- (NoExt)
- (NotPromoted)
- ({ DumpParsedAst.hs:8:27-32 }
- (Unqual
- {OccName: Length}))))))
- ,({ DumpParsedAst.hs:8:34-35 }
- (HsAppPrefix
- (NoExt)
- ({ DumpParsedAst.hs:8:34-35 }
- (HsTyVar
- (NoExt)
- (NotPromoted)
- ({ DumpParsedAst.hs:8:34-35 }
- (Unqual
- {OccName: as}))))))]))))))])))))
+ (NotPromoted)
+ ({ DumpParsedAst.hs:8:15-16 }
+ (Unqual
+ {OccName: as}))))))))]
+ (Prefix)
+ ({ DumpParsedAst.hs:8:21-36 }
+ (HsAppTy
+ (NoExt)
+ ({ DumpParsedAst.hs:8:21-24 }
+ (HsTyVar
+ (NoExt)
+ (NotPromoted)
+ ({ DumpParsedAst.hs:8:21-24 }
+ (Unqual
+ {OccName: Succ}))))
+ ({ DumpParsedAst.hs:8:26-36 }
+ (HsParTy
+ (NoExt)
+ ({ DumpParsedAst.hs:8:27-35 }
+ (HsAppTy
+ (NoExt)
+ ({ DumpParsedAst.hs:8:27-32 }
+ (HsTyVar
+ (NoExt)
+ (NotPromoted)
+ ({ DumpParsedAst.hs:8:27-32 }
+ (Unqual
+ {OccName: Length}))))
+ ({ DumpParsedAst.hs:8:34-35 }
+ (HsTyVar
+ (NoExt)
+ (NotPromoted)
+ ({ DumpParsedAst.hs:8:34-35 }
+ (Unqual
+ {OccName: as})))))))))))))
,({ DumpParsedAst.hs:9:3-24 }
(HsIB
(NoExt)
diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.hs b/testsuite/tests/parser/should_compile/DumpRenamedAst.hs
index 493b736df5..bf3e372461 100644
--- a/testsuite/tests/parser/should_compile/DumpRenamedAst.hs
+++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.hs
@@ -1,5 +1,5 @@
{-# LANGUAGE DataKinds, GADTs, PolyKinds, RankNTypes, TypeOperators,
- TypeFamilies #-}
+ TypeFamilies, StarIsType #-}
module DumpRenamedAst where
diff --git a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
index 4ca996fde0..673b391d7f 100644
--- a/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
+++ b/testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
@@ -69,10 +69,10 @@
{Name: DumpRenamedAst.Peano})
(HsQTvs
(HsQTvsRn
- []
- {NameSet:
- []})
- [])
+ []
+ {NameSet:
+ []})
+ [])
(Prefix)
(HsDataDefn
(NoExt)
@@ -124,8 +124,8 @@
[({ DumpRenamedAst.hs:9:3-36 }
(HsIB
(HsIBRn
- [{Name: a}
- ,{Name: as}]
+ [{Name: a}
+ ,{Name: as}]
(True))
(FamEqn
(NoExt)
@@ -182,7 +182,7 @@
,({ DumpRenamedAst.hs:10:3-24 }
(HsIB
(HsIBRn
- []
+ []
(True))
(FamEqn
(NoExt)
@@ -204,7 +204,7 @@
{Name: DumpRenamedAst.Length})
(HsQTvs
(HsQTvsRn
- [{Name: k}]
+ [{Name: k}]
{NameSet:
[]})
[({ DumpRenamedAst.hs:8:20-30 }
@@ -246,10 +246,10 @@
{Name: DumpRenamedAst.Nat})
(HsQTvs
(HsQTvsRn
- [{Name: k}]
- {NameSet:
- []})
- [])
+ [{Name: k}]
+ {NameSet:
+ []})
+ [])
(Prefix)
({ DumpRenamedAst.hs:12:17-30 }
(KindSig
@@ -273,11 +273,9 @@
({ DumpRenamedAst.hs:12:25 }
{Name: k})))
({ DumpRenamedAst.hs:12:30 }
- (HsTyVar
+ (HsStarTy
(NoExt)
- (NotPromoted)
- ({ DumpRenamedAst.hs:12:30 }
- {Name: GHC.Types.*})))))))))
+ (False)))))))))
(Nothing))))]
[]
[({ DumpRenamedAst.hs:(15,1)-(16,45) }
@@ -286,8 +284,8 @@
(DataFamInstDecl
(HsIB
(HsIBRn
- [{Name: k}
- ,{Name: a}]
+ [{Name: k}
+ ,{Name: a}]
(True))
(FamEqn
(NoExt)
@@ -312,11 +310,9 @@
({ DumpRenamedAst.hs:15:28 }
{Name: k})))
({ DumpRenamedAst.hs:15:33 }
- (HsTyVar
+ (HsStarTy
(NoExt)
- (NotPromoted)
- ({ DumpRenamedAst.hs:15:33 }
- {Name: GHC.Types.*})))))))]
+ (False)))))))]
(Prefix)
(HsDataDefn
(NoExt)
@@ -341,17 +337,13 @@
({ DumpRenamedAst.hs:15:40 }
{Name: k})))
({ DumpRenamedAst.hs:15:45 }
- (HsTyVar
+ (HsStarTy
(NoExt)
- (NotPromoted)
- ({ DumpRenamedAst.hs:15:45 }
- {Name: GHC.Types.*})))))))
+ (False)))))))
({ DumpRenamedAst.hs:15:51 }
- (HsTyVar
+ (HsStarTy
(NoExt)
- (NotPromoted)
- ({ DumpRenamedAst.hs:15:51 }
- {Name: GHC.Types.*}))))))
+ (False))))))
[({ DumpRenamedAst.hs:16:3-45 }
(ConDeclGADT
(NoExt)
@@ -360,11 +352,11 @@
(False)
(HsQTvs
(HsQTvsRn
- [{Name: f}
- ,{Name: g}]
- {NameSet:
- []})
- [])
+ [{Name: f}
+ ,{Name: g}]
+ {NameSet:
+ []})
+ [])
(Nothing)
(PrefixCon
[({ DumpRenamedAst.hs:16:10-34 }
diff --git a/testsuite/tests/parser/should_compile/T10379.hs b/testsuite/tests/parser/should_compile/T10379.hs
index 1eb5f96382..eb231c4415 100644
--- a/testsuite/tests/parser/should_compile/T10379.hs
+++ b/testsuite/tests/parser/should_compile/T10379.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE KindSignatures, GADTs, DataKinds, TypeOperators #-}
+{-# LANGUAGE KindSignatures, GADTs, DataKinds #-}
module Foo where
data Foo1 :: [*] -> * where
diff --git a/testsuite/tests/parser/should_fail/T15209.stderr b/testsuite/tests/parser/should_fail/T15209.stderr
index f5418fab74..9d1e151cf2 100644
--- a/testsuite/tests/parser/should_fail/T15209.stderr
+++ b/testsuite/tests/parser/should_fail/T15209.stderr
@@ -1,2 +1,2 @@
-T15209.hs:6:8: error: Not in scope: type constructor or class ‘~#’
+T15209.hs:6:10: error: Not in scope: type constructor or class ‘~#’
diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T
index 9fcc3ba97d..1e71e40420 100644
--- a/testsuite/tests/parser/should_fail/all.T
+++ b/testsuite/tests/parser/should_fail/all.T
@@ -120,3 +120,8 @@ test('NumericUnderscoresFail1',
grep_errmsg(r'^NumericUnderscoresFail1.hs:'), compile_fail, [''])
test('InfixAppPatErr', normal, compile_fail, [''])
+
+test('typeops_A', normal, compile_fail, [''])
+test('typeops_B', normal, compile_fail, [''])
+test('typeops_C', normal, compile_fail, [''])
+test('typeops_D', normal, compile_fail, [''])
diff --git a/testsuite/tests/parser/should_fail/readFail036.hs b/testsuite/tests/parser/should_fail/readFail036.hs
index 2bb23149dd..15afd980f8 100644
--- a/testsuite/tests/parser/should_fail/readFail036.hs
+++ b/testsuite/tests/parser/should_fail/readFail036.hs
@@ -1,5 +1,5 @@
-
module Foo where
-data Foo (a :: *) = Foo a
+import Data.Kind (Type)
+data Foo (a :: Type) = Foo a
diff --git a/testsuite/tests/parser/should_fail/readFail036.stderr b/testsuite/tests/parser/should_fail/readFail036.stderr
index 0d22eb8363..a66afacacf 100644
--- a/testsuite/tests/parser/should_fail/readFail036.stderr
+++ b/testsuite/tests/parser/should_fail/readFail036.stderr
@@ -1,5 +1,5 @@
-readFail036.hs:4:16:
- Illegal kind signature: ‘*’
+readFail036.hs:5:16: error:
+ Illegal kind signature: ‘Type’
Perhaps you intended to use KindSignatures
In the data type declaration for ‘Foo’
diff --git a/testsuite/tests/parser/should_fail/typeops_A.hs b/testsuite/tests/parser/should_fail/typeops_A.hs
new file mode 100644
index 0000000000..abd7f528c6
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/typeops_A.hs
@@ -0,0 +1 @@
+type X = 1 +
diff --git a/testsuite/tests/parser/should_fail/typeops_A.stderr b/testsuite/tests/parser/should_fail/typeops_A.stderr
new file mode 100644
index 0000000000..69f7aac6be
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/typeops_A.stderr
@@ -0,0 +1,2 @@
+
+typeops_A.hs:1:12: error: Operator applied to too few arguments: +
diff --git a/testsuite/tests/parser/should_fail/typeops_B.hs b/testsuite/tests/parser/should_fail/typeops_B.hs
new file mode 100644
index 0000000000..ac65f872de
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/typeops_B.hs
@@ -0,0 +1 @@
+type X = + 1
diff --git a/testsuite/tests/parser/should_fail/typeops_B.stderr b/testsuite/tests/parser/should_fail/typeops_B.stderr
new file mode 100644
index 0000000000..030516a27f
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/typeops_B.stderr
@@ -0,0 +1,2 @@
+
+typeops_B.hs:1:10: error: Operator applied to too few arguments: +
diff --git a/testsuite/tests/parser/should_fail/typeops_C.hs b/testsuite/tests/parser/should_fail/typeops_C.hs
new file mode 100644
index 0000000000..e55838934a
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/typeops_C.hs
@@ -0,0 +1 @@
+type X = 1 + + 2
diff --git a/testsuite/tests/parser/should_fail/typeops_C.stderr b/testsuite/tests/parser/should_fail/typeops_C.stderr
new file mode 100644
index 0000000000..280323bb67
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/typeops_C.stderr
@@ -0,0 +1,2 @@
+
+typeops_C.hs:1:12: error: Operator applied to too few arguments: +
diff --git a/testsuite/tests/parser/should_fail/typeops_D.hs b/testsuite/tests/parser/should_fail/typeops_D.hs
new file mode 100644
index 0000000000..655b2f15f0
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/typeops_D.hs
@@ -0,0 +1 @@
+type X = +
diff --git a/testsuite/tests/parser/should_fail/typeops_D.stderr b/testsuite/tests/parser/should_fail/typeops_D.stderr
new file mode 100644
index 0000000000..0ce7e29559
--- /dev/null
+++ b/testsuite/tests/parser/should_fail/typeops_D.stderr
@@ -0,0 +1,2 @@
+
+typeops_D.hs:1:10: error: Operator applied to too few arguments: +