From 1a5f53c6d4f3812835b8b72f36d9d23004b38f1f Mon Sep 17 00:00:00 2001 From: Brandon Chinn <brandonchinn178@gmail.com> Date: Fri, 16 Feb 2024 17:33:47 -0800 Subject: [PATCH] Don't normalize backslashes in characters --- testsuite/driver/testlib.py | 5 +++-- testsuite/tests/parser/should_fail/T21843a.stderr | 2 +- testsuite/tests/parser/should_fail/T21843b.stderr | 2 +- testsuite/tests/parser/should_fail/T21843c.stderr | 4 ++-- testsuite/tests/parser/should_fail/T21843d.stderr | 2 +- testsuite/tests/parser/should_fail/T21843e.stderr | 2 +- testsuite/tests/parser/should_fail/T21843f.stderr | 2 +- 7 files changed, 10 insertions(+), 9 deletions(-) diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 79d2b15eecc7..bb8f5318d0b4 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -2598,8 +2598,9 @@ def normalise_errmsg(s: str) -> str: s = normalise_callstacks(s) s = normalise_type_reps(s) - # normalise slashes, minimise Windows/Unix filename differences - s = re.sub(r'\\', '/', s) + # normalise slashes to minimise Windows/Unix filename differences, + # but don't normalize backslashes in chars + s = re.sub(r"(?!')\\", '/', s) # Normalize the name of the GHC executable. Specifically, # this catches the cases that: diff --git a/testsuite/tests/parser/should_fail/T21843a.stderr b/testsuite/tests/parser/should_fail/T21843a.stderr index 11ad47d94a98..43428042f09c 100644 --- a/testsuite/tests/parser/should_fail/T21843a.stderr +++ b/testsuite/tests/parser/should_fail/T21843a.stderr @@ -1,4 +1,4 @@ T21843a.hs:3:13: [GHC-31623] - Unicode character '“' ('/8220') looks like '"' (Quotation Mark), but it is not + Unicode character '“' ('\8220') looks like '"' (Quotation Mark), but it is not diff --git a/testsuite/tests/parser/should_fail/T21843b.stderr b/testsuite/tests/parser/should_fail/T21843b.stderr index 34c531c3f814..535f1b789b02 100644 --- a/testsuite/tests/parser/should_fail/T21843b.stderr +++ b/testsuite/tests/parser/should_fail/T21843b.stderr @@ -1,3 +1,3 @@ T21843b.hs:3:11: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not diff --git a/testsuite/tests/parser/should_fail/T21843c.stderr b/testsuite/tests/parser/should_fail/T21843c.stderr index 54146a42ebbd..ea832cb3e415 100644 --- a/testsuite/tests/parser/should_fail/T21843c.stderr +++ b/testsuite/tests/parser/should_fail/T21843c.stderr @@ -1,6 +1,6 @@ T21843c.hs:3:19: [GHC-31623] - Unicode character 'â€' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character 'â€' ('\8221') looks like '"' (Quotation Mark), but it is not T21843c.hs:3:20: [GHC-21231] - lexical error in string/character literal at character '/n' + lexical error in string/character literal at character '\n' diff --git a/testsuite/tests/parser/should_fail/T21843d.stderr b/testsuite/tests/parser/should_fail/T21843d.stderr index 4ee47ed8ef23..995bbf8c210c 100644 --- a/testsuite/tests/parser/should_fail/T21843d.stderr +++ b/testsuite/tests/parser/should_fail/T21843d.stderr @@ -1,3 +1,3 @@ T21843d.hs:3:13: [GHC-31623] - Unicode character '’' ('/8217') looks like ''' (Single Quote), but it is not + Unicode character '’' ('\8217') looks like ''' (Single Quote), but it is not diff --git a/testsuite/tests/parser/should_fail/T21843e.stderr b/testsuite/tests/parser/should_fail/T21843e.stderr index c39d573b877c..12877123e77c 100644 --- a/testsuite/tests/parser/should_fail/T21843e.stderr +++ b/testsuite/tests/parser/should_fail/T21843e.stderr @@ -1,3 +1,3 @@ T21843e.hs:3:15: [GHC-31623] - Unicode character 'â€' ('/8221') looks like '"' (Quotation Mark), but it is not + Unicode character 'â€' ('\8221') looks like '"' (Quotation Mark), but it is not diff --git a/testsuite/tests/parser/should_fail/T21843f.stderr b/testsuite/tests/parser/should_fail/T21843f.stderr index 198917937a54..6cd989f67900 100644 --- a/testsuite/tests/parser/should_fail/T21843f.stderr +++ b/testsuite/tests/parser/should_fail/T21843f.stderr @@ -1,3 +1,3 @@ T21843f.hs:3:13: [GHC-31623] - Unicode character '‘' ('/8216') looks like ''' (Single Quote), but it is not + Unicode character '‘' ('\8216') looks like ''' (Single Quote), but it is not -- GitLab