Raise parse error for `data T where`.
authorHE, Tao <sighingnow@gmail.com>
Tue, 13 Feb 2018 00:55:41 +0000 (19:55 -0500)
committerBen Gamari <ben@smart-cactus.org>
Tue, 13 Feb 2018 22:49:43 +0000 (17:49 -0500)
commit8936ab69d18669bab3ca4edf40458f88ae5903f0
treef793c1a8f115a0956386a78f355d30836805272e
parent0c9777b787d072f9f57e0cdfe44e2e2d48217077
Raise parse error for `data T where`.

Empty GADTs data declarations can't be identified in type checker. This
patch adds additional checks in parser and raise a parse error when
encounter empty GADTs declarations but extension `GADTs` is not enabled.

Only empty declarations are checked in parser to avoid affecting
existing
error messages related to missing GADTs extension.

This patch should fix issue 8258.

Signed-off-by: HE, Tao <sighingnow@gmail.com>
Test Plan: make test TEST="T8258 T8258NoGADTs"

Reviewers: bgamari, mpickering, alanz, RyanGlScott

Reviewed By: bgamari, RyanGlScott

Subscribers: adamse, RyanGlScott, rwbarton, thomie, mpickering, carter

GHC Trac Issues: #8258

Differential Revision: https://phabricator.haskell.org/D4350
compiler/parser/Parser.y
compiler/parser/RdrHsSyn.hs
docs/users_guide/8.6.1-notes.rst
testsuite/tests/parser/should_compile/T8258.hs [new file with mode: 0644]
testsuite/tests/parser/should_compile/all.T
testsuite/tests/parser/should_fail/T8258NoGADTs.hs [new file with mode: 0644]
testsuite/tests/parser/should_fail/T8258NoGADTs.stderr [new file with mode: 0644]
testsuite/tests/parser/should_fail/all.T
testsuite/tests/polykinds/T11640.hs
testsuite/tests/typecheck/should_compile/tc247.hs