summaryrefslogtreecommitdiff
path: root/compiler/parser
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/parser')
-rw-r--r--compiler/parser/Parser.y11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/parser/Parser.y b/compiler/parser/Parser.y
index d7aef8d77f..9f43e36984 100644
--- a/compiler/parser/Parser.y
+++ b/compiler/parser/Parser.y
@@ -1059,8 +1059,8 @@ cl_decl :: { LTyClDecl GhcPs }
--
ty_decl :: { LTyClDecl GhcPs }
-- ordinary type synonyms
- : 'type' type '=' ctypedoc
- -- Note ctype, not sigtype, on the right of '='
+ : 'type' type '=' ktypedoc
+ -- Note ktypedoc, not sigtype, on the right of '='
-- We allow an explicit for-all but we don't insert one
-- in type Foo a = (b,b)
-- Instead we just say b is out of scope
@@ -1776,12 +1776,17 @@ unpackedness :: { Located ([AddAnn], SourceText, SrcUnpackedness) }
: '{-# UNPACK' '#-}' { sLL $1 $> ([mo $1, mc $2], getUNPACK_PRAGs $1, SrcUnpack) }
| '{-# NOUNPACK' '#-}' { sLL $1 $> ([mo $1, mc $2], getNOUNPACK_PRAGs $1, SrcNoUnpack) }
--- A ktype is a ctype, possibly with a kind annotation
+-- A ktype/ktypedoc is a ctype/ctypedoc, possibly with a kind annotation
ktype :: { LHsType GhcPs }
: ctype { $1 }
| ctype '::' kind {% ams (sLL $1 $> $ HsKindSig noExt $1 $3)
[mu AnnDcolon $2] }
+ktypedoc :: { LHsType GhcPs }
+ : ctypedoc { $1 }
+ | ctypedoc '::' kind {% ams (sLL $1 $> $ HsKindSig noExt $1 $3)
+ [mu AnnDcolon $2] }
+
-- A ctype is a for-all type
ctype :: { LHsType GhcPs }
: 'forall' tv_bndrs '.' ctype {% hintExplicitForall (getLoc $1) >>