[commit: ghc] master: Stop -dno-debug-output suppressing -ddump-tc-trace (1c886ea)

git at git.haskell.org git at git.haskell.org
Sun Nov 6 12:48:20 UTC 2016


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1c886eadcfbb593bb06bfff7b8a4914b5349f080/ghc

>---------------------------------------------------------------

commit 1c886eadcfbb593bb06bfff7b8a4914b5349f080
Author: Matthew Pickering <matthewtpickering at gmail.com>
Date:   Sun Nov 6 12:46:40 2016 +0000

    Stop -dno-debug-output suppressing -ddump-tc-trace
    
    Summary:
    The user manual states that -dno-debug-output should suppress
    *unsolicited* debugging output which essentially amounts to calls
    to `pprTrace`. Before I unified the interface of `traceTc` and
    `traceRn`, the flag suppressed calls to `traceTc` but not to `traceRn`
    or any other tracing function already controlled by a flag.
    
    Thus, in order to make the behaviour more uniform, it seemed best to
    remove this one special case.
    
    Reviewers: austin, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2628
    
    GHC Trac Issues: #12691


>---------------------------------------------------------------

1c886eadcfbb593bb06bfff7b8a4914b5349f080
 compiler/typecheck/TcRnMonad.hs                        | 14 +++++++-------
 testsuite/tests/indexed-types/should_fail/T8129.stdout |  2 ++
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/compiler/typecheck/TcRnMonad.hs b/compiler/typecheck/TcRnMonad.hs
index d3ae058..b958cf8 100644
--- a/compiler/typecheck/TcRnMonad.hs
+++ b/compiler/typecheck/TcRnMonad.hs
@@ -662,18 +662,18 @@ updTcRef ref fn = liftIO $ do { old <- readIORef ref
 -- Typechecker trace
 traceTc :: String -> SDoc -> TcRn ()
 traceTc =
-  guardedTraceOptTcRn Opt_D_dump_tc_trace
+  labelledTraceOptTcRn Opt_D_dump_tc_trace
 
 -- Renamer Trace
 traceRn :: String -> SDoc -> TcRn ()
 traceRn =
-  guardedTraceOptTcRn Opt_D_dump_rn_trace
+  labelledTraceOptTcRn Opt_D_dump_rn_trace
 
--- | Do not display a trace if `-dno-debug-output` is on
-guardedTraceOptTcRn :: DumpFlag -> String -> SDoc -> TcRn ()
-guardedTraceOptTcRn flag herald doc = do
-  unless opt_NoDebugOutput
-       ( traceOptTcRn flag (formatTraceMsg herald doc) )
+-- | Trace when a certain flag is enabled. This is like `traceOptTcRn`
+-- but accepts a string as a label and formats the trace message uniformly.
+labelledTraceOptTcRn :: DumpFlag -> String -> SDoc -> TcRn ()
+labelledTraceOptTcRn flag herald doc = do
+   traceOptTcRn flag (formatTraceMsg herald doc)
 
 formatTraceMsg :: String -> SDoc -> SDoc
 formatTraceMsg herald doc = hang (text herald) 2 doc
diff --git a/testsuite/tests/indexed-types/should_fail/T8129.stdout b/testsuite/tests/indexed-types/should_fail/T8129.stdout
index bffa3da..f2bab63 100644
--- a/testsuite/tests/indexed-types/should_fail/T8129.stdout
+++ b/testsuite/tests/indexed-types/should_fail/T8129.stdout
@@ -1 +1,3 @@
     • Could not deduce (C x0 (F x0))
+      • Could not deduce (C x0 (F x0))
+    • Could not deduce (C x0 (F x0))



More information about the ghc-commits mailing list