Reject import declaration with semicolon in GHCi
authorRik Steenkamp <rik@ewps.nl>
Sat, 9 Jan 2016 17:15:45 +0000 (18:15 +0100)
committerBen Gamari <ben@smart-cactus.org>
Sat, 9 Jan 2016 17:15:56 +0000 (18:15 +0100)
commita84c21ebaa5c56a222d69f245ef4daa77054fdcb
tree8caf065006ea917f0a7407ba7c55258ad2f39fa1
parent0dc230879ae2f8b7f6d97779631ba0847e415f24
Reject import declaration with semicolon in GHCi

Now GHCi rejects input containing an import declaration and semicolon,
and prints an appropriate error message. Before, the stuff after an
import declaration and semicolon got ignored (most of the time), without
telling the user about it. As the default behaviour of GHCi is to reject
multiple commands in a single input, we extend this behaviour to import
commands.

This patch fixes #10663.

(See https://phabricator.haskell.org/D1518 for the introduction of
`is_import` and `is_decl`.)

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: thomie

Differential Revision: https://phabricator.haskell.org/D1726

GHC Trac Issues: #10663
compiler/main/GHC.hs
compiler/main/InteractiveEval.hs
ghc/GHCi/UI.hs
testsuite/tests/ghci/scripts/T10663.script [new file with mode: 0644]
testsuite/tests/ghci/scripts/T10663.stderr [new file with mode: 0644]
testsuite/tests/ghci/scripts/all.T