Parenthesise TypeOperator in import hints
authorThomas Winant <thomas.winant@cs.kuleuven.be>
Thu, 23 Jul 2015 09:43:21 +0000 (11:43 +0200)
committerBen Gamari <ben@smart-cactus.org>
Thu, 23 Jul 2015 09:43:22 +0000 (11:43 +0200)
commitb5c94262fa79f735334165c53667f113e07df5e1
treea55de6cc449ba3f4f89e3f73198e2ec7f958824e
parente78841b518ee9c0b92437899c3a4a2307dfd4ac8
Parenthesise TypeOperator in import hints

When a constructor was mistakenly imported directly instead of as a
constructor of a data type, a hint will be shown on how to correctly
import
it. Just like the constructor, the data type should be surrounded in
parentheses if it is an operator (TypeOperator in this case).

Instead of:

    error:
        In module ‘Data.Type.Equality’:
          ‘Refl’ is a data constructor of ‘:~:’
        To import it use
          ‘import’ Data.Type.Equality( :~:( Refl ) )
        or
          ‘import’ Data.Type.Equality( :~:(..) )

Print:

    error:
        In module ‘Data.Type.Equality’:
          ‘Refl’ is a data constructor of ‘(:~:)’
        To import it use
          ‘import’ Data.Type.Equality( (:~:)( Refl ) )
        or
          ‘import’ Data.Type.Equality( (:~:)(..) )

Test Plan: pass new test

Reviewers: austin, bgamari, simonpj

Reviewed By: simonpj

Subscribers: simonpj, thomie

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

GHC Trac Issues: #10668
compiler/rename/RnNames.hs
testsuite/tests/rename/should_fail/T10668.hs [new file with mode: 0644]
testsuite/tests/rename/should_fail/T10668.stderr [new file with mode: 0644]
testsuite/tests/rename/should_fail/all.T