summaryrefslogtreecommitdiff
path: root/compiler
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-08-11 10:01:24 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-09-01 12:39:36 -0400
commit884245dd29265b7bee12cda8c915da9c916251ce (patch)
treeaa7550b63d3894527ebd01ec22f5348fcbbd1c8e /compiler
parenta8a2568b7b64e5b9fca5b12df7da759de4db39ae (diff)
downloadhaskell-884245dd29265b7bee12cda8c915da9c916251ce.tar.gz
Fix FastString lexicographic ordering (fix #18562)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/GHC/Data/FastString.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/GHC/Data/FastString.hs b/compiler/GHC/Data/FastString.hs
index fbd69d426f..1907ef91c9 100644
--- a/compiler/GHC/Data/FastString.hs
+++ b/compiler/GHC/Data/FastString.hs
@@ -231,10 +231,12 @@ instance Data FastString where
instance NFData FastString where
rnf fs = seq fs ()
+-- | Compare FastString lexicographically
cmpFS :: FastString -> FastString -> Ordering
cmpFS fs1 fs2 =
if uniq fs1 == uniq fs2 then EQ else
- compare (fs_sbs fs1) (fs_sbs fs2)
+ compare (unpackFS fs1) (unpackFS fs2)
+ -- compare as String, not as ShortByteString (cf #18562)
-- -----------------------------------------------------------------------------
-- Construction