Implement BlockArguments (#10843)
authorTakano Akio <tak@anoak.io>
Thu, 1 Feb 2018 02:35:29 +0000 (21:35 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 1 Feb 2018 04:28:48 +0000 (23:28 -0500)
commitbe84823b956f0aa09c58d94d1901f2dff13546b4
tree94b76f4746a8af6748bbfb2f868c9fd98206735f
parent0bff9e677f0569bc8a7207c20cddddfd67e2448f
Implement BlockArguments (#10843)

This patch implements the BlockArguments extension, as proposed at
https://github.com/ghc-proposals/ghc-proposals/pull/90. It also
fixes #10855 as a side-effect.

This patch adds a large number of shift-reduce conflicts to the parser.
All of them concern the ambiguity as to where constructs like `if` and
`let` end. Fortunately they are resolved correctly by preferring shift.

The patch is based on @gibiansky's ArgumentDo implementation (D1219).

Test Plan: ./validate

Reviewers: goldfire, bgamari, alanz, mpickering

Reviewed By: bgamari, mpickering

Subscribers: Wizek, dfeuer, gibiansky, rwbarton, thomie, mpickering, carter

GHC Trac Issues: #10843, #10855

Differential Revision: https://phabricator.haskell.org/D4260
22 files changed:
compiler/main/DynFlags.hs
compiler/parser/Lexer.x
compiler/parser/Parser.y
compiler/parser/RdrHsSyn.hs
docs/users_guide/bugs.rst
docs/users_guide/glasgow_exts.rst
libraries/ghc-boot-th/GHC/LanguageExtensions/Type.hs
testsuite/tests/driver/T4437.hs
testsuite/tests/parser/should_compile/BlockArguments.hs [new file with mode: 0644]
testsuite/tests/parser/should_compile/BlockArgumentsLambdaCase.hs [new file with mode: 0644]
testsuite/tests/parser/should_compile/NoBlockArguments.hs [new file with mode: 0644]
testsuite/tests/parser/should_compile/T10855.hs [new file with mode: 0644]
testsuite/tests/parser/should_compile/all.T
testsuite/tests/parser/should_fail/NoBlockArgumentsFail.hs [new file with mode: 0644]
testsuite/tests/parser/should_fail/NoBlockArgumentsFail.stderr [new file with mode: 0644]
testsuite/tests/parser/should_fail/NoBlockArgumentsFail2.hs [new file with mode: 0644]
testsuite/tests/parser/should_fail/NoBlockArgumentsFail2.stderr [new file with mode: 0644]
testsuite/tests/parser/should_fail/NoBlockArgumentsFail3.hs [new file with mode: 0644]
testsuite/tests/parser/should_fail/NoBlockArgumentsFail3.stderr [new file with mode: 0644]
testsuite/tests/parser/should_fail/ParserNoLambdaCase.stderr
testsuite/tests/parser/should_fail/all.T
testsuite/tests/perf/compiler/all.T