Forbid variables to be parents in import lists.
authorMatthew Pickering <matthewtpickering@gmail.com>
Tue, 10 May 2016 06:41:46 +0000 (08:41 +0200)
committerBen Gamari <ben@smart-cactus.org>
Tue, 10 May 2016 10:02:14 +0000 (12:02 +0200)
commit53f26f5a45f146e1cc988bbcf76a362c877beaa2
tree3f7c270f496f90fe3683f1536bea7ec13dd3dd9d
parent3ca78062968f7ab6efff82122101e6f91b8c2cef
Forbid variables to be parents in import lists.

In the long discussion on #11432, it was decided that when a type
constructor is parsed as a variable ((--.->) is one example) then in
order to export the type constructor then the user should be required to
use the ExplicitNamespaces keyword.

This was implemented in quite an indirect manner in the renamer. It
is much more direct to enforce this in the parser at the expense of
slighty worse error messages. Further to this, the check in the
renamer was actually slightly wrong. If the variable was in scope
then no error was raised, this was causing panics, see #12026 for an
example.

Reviewers: austin, bgamari

Subscribers: davean, skvadrik, thomie

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

GHC Trac Issues: #12026
compiler/parser/RdrHsSyn.hs
compiler/rename/RnEnv.hs
compiler/rename/RnNames.hs
testsuite/tests/module/T11432.stderr
testsuite/tests/module/T11432a.hs [new file with mode: 0644]
testsuite/tests/module/T11432a.stderr [new file with mode: 0644]
testsuite/tests/module/T12026.hs [new file with mode: 0644]
testsuite/tests/module/T12026.stderr [new file with mode: 0644]
testsuite/tests/module/all.T
testsuite/tests/module/mod89.stderr