Skip to content
Snippets Groups Projects
Commit 3b3a5dec authored by Ben Gamari's avatar Ben Gamari
Browse files

Don't emit unprintable characters when printing Uniques

When faced with an unprintable tag we now instead print the codepoint
number.

Fixes #25989.

(cherry picked from commit e832b1fa)
parent 2d0ecdc6
No related branches found
No related tags found
No related merge requests found
...@@ -302,8 +302,14 @@ instance Uniquable Unique where ...@@ -302,8 +302,14 @@ instance Uniquable Unique where
showUnique :: Unique -> String showUnique :: Unique -> String
showUnique uniq showUnique uniq
= case unpkUnique uniq of = tagStr ++ w64ToBase62 u
(tag, u) -> tag : w64ToBase62 u where
(tag, u) = unpkUnique uniq
-- Avoid emitting non-printable characters in pretty uniques.
-- See #25989.
tagStr
| tag < 'A' || tag > 'z' = show (ord tag) ++ "_"
| otherwise = [tag]
pprUniqueAlways :: IsLine doc => Unique -> doc pprUniqueAlways :: IsLine doc => Unique -> doc
-- The "always" means regardless of -dsuppress-uniques -- The "always" means regardless of -dsuppress-uniques
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment