[Git][ghc/ghc][master] Do not color the diagnostic code in error messages (#24172)

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Fri Dec 29 20:36:53 UTC 2023



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
19328a8c by Xiaoyan Ren at 2023-12-29T15:36:30-05:00
Do not color the diagnostic code in error messages (#24172)

- - - - -


5 changed files:

- compiler/GHC/Types/Error.hs
- + testsuite/tests/ghc-e/should_fail/T24172.hs
- + testsuite/tests/ghc-e/should_fail/T24172.stderr
- testsuite/tests/ghc-e/should_fail/all.T
- testsuite/tests/warnings/should_fail/Colour.stderr


Changes:

=====================================
compiler/GHC/Types/Error.hs
=====================================
@@ -659,7 +659,7 @@ mkLocMessageWarningGroups show_warn_groups msg_class locn msg
 
           code_doc =
             case msg_class of
-              MCDiagnostic _ _ (Just code) -> brackets (coloured msg_colour $ ppr_with_hyperlink code)
+              MCDiagnostic _ _ (Just code) -> brackets (ppr_with_hyperlink code)
               _                            -> empty
 
           flag_msg :: Severity -> DiagnosticReason -> Maybe SDoc


=====================================
testsuite/tests/ghc-e/should_fail/T24172.hs
=====================================
@@ -0,0 +1 @@
+main = print $ 1 + Bool


=====================================
testsuite/tests/ghc-e/should_fail/T24172.stderr
=====================================
@@ -0,0 +1,8 @@
+
+T24172.hs:1:20: error: [GHC-01928]
+    • Illegal term-level use of the type constructor ‘Bool’
+    • imported from ‘Prelude’ at T24172.hs:1:1
+      (and originally defined in ‘GHC.Types’)
+    • In the second argument of ‘(+)’, namely ‘Bool’
+      In the second argument of ‘($)’, namely ‘1 + Bool’
+      In the expression: print $ 1 + Bool


=====================================
testsuite/tests/ghc-e/should_fail/all.T
=====================================
@@ -56,3 +56,5 @@ test('T18441fail18', req_interp, makefile_test, ['T18441fail18'])
 test('T18441fail19', [ignore_stderr, exit_code(1)], run_command, ['{compiler} -e ":cd abcd"'])
 
 test('T23663', req_interp, makefile_test, ['T23663'])
+
+test('T24172', normal, compile_fail, ['-fdiagnostics-color=always'])


=====================================
testsuite/tests/warnings/should_fail/Colour.stderr
=====================================
@@ -1,5 +1,5 @@
 
-Colour.hs:1:8: error: [GHC-83865]
+Colour.hs:1:8: error: [GHC-83865]
     • Couldn't match expected type ‘IO ()’ with actual type ‘()’
     • In the expression: () :: IO ()
       In an equation for ‘main’: main = () :: IO ()



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/19328a8c38a4d55af7d35fcd16debe2e8b474781

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/19328a8c38a4d55af7d35fcd16debe2e8b474781
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231229/93825548/attachment-0001.html>


More information about the ghc-commits mailing list