Commit 6e4188ab authored by Matthew Pickering's avatar Matthew Pickering

Fix unsafe usage of `is_iloc` selector in Ord instance for ImportSpec

Summary:
This fixes tests rn017, T7672 and closed #12930.

Both these tests were self referential module imports through hs-boot
files. As a result, I am quite suspicious of what the ImpAll constructor is
used for. I had a brief hunt around but couldn't immediately see whether
it was necessary.

Reviewers: austin, bgamari

Subscribers: simonpj, thomie, nomeata

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

GHC Trac Issues: #12930
parent 19ae1423
......@@ -1137,7 +1137,12 @@ instance Eq ImpItemSpec where
p1 == p2 = case p1 `compare` p2 of EQ -> True; _ -> False
instance Ord ImpItemSpec where
compare is1 is2 = is_iloc is1 `compare` is_iloc is2
compare is1 is2 =
case (is1, is2) of
(ImpAll, ImpAll) -> EQ
(ImpAll, _) -> GT
(_, ImpAll) -> LT
(ImpSome _ l1, ImpSome _ l2) -> l1 `compare` l2
bestImport :: [ImportSpec] -> ImportSpec
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment