Remove duplicates in -ddump-minimial-imports
authorSimon Peyton Jones <simonpj@microsoft.com>
Wed, 5 Dec 2018 10:12:09 +0000 (10:12 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Wed, 5 Dec 2018 10:15:40 +0000 (10:15 +0000)
commit84cba4bce65ffc99e2356b3621cf91258b055cad
treeeb30ca74bf730a1aa9534adc64c1c47f23e7a4b6
parenta8b7cef4d45a5003bf7584e06912f0f632116c71
Remove duplicates in -ddump-minimial-imports

This fixes Trac #15994.

Previously RdrName.gresToAvailInfo assumed that the input list
of GREs had no duplicates. I accidentally broke this precondition
in this refactoring:

    commit 6353efc7694ba8ec86c091918e02595662169ae2
    Date:   Thu Nov 22 14:48:05 2018 -0500

    Fix unused-import warnings

    This patch fixes a fairly long-standing bug (dating back to 2015) in
    RdrName.bestImport, namely

(There was an ASSERT, but it's usually switched off in stage2.  It
tripped when I switched stage2 assertions on.)

The fix is straightforward: account for dups in gresToAvailInfo.
compiler/basicTypes/RdrName.hs
testsuite/tests/rename/should_compile/Makefile
testsuite/tests/rename/should_compile/T15994.hs [new file with mode: 0644]
testsuite/tests/rename/should_compile/T15994.stdout [new file with mode: 0644]
testsuite/tests/rename/should_compile/all.T