File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -1370,13 +1370,6 @@ class Definitions {
13701370 else if arity >= 0 then FunctionType (arity)
13711371 else NoType
13721372
1373- val predefClassNames : Set [Name ] =
1374- Set (" Predef$" , " DeprecatedPredef" , " LowPriorityImplicits" ).map(_.toTypeName.unmangleClassName)
1375-
1376- /** Is `cls` the predef module class, or a class inherited by Predef? */
1377- def isPredefClass (cls : Symbol ): Boolean =
1378- (cls.owner eq ScalaPackageClass ) && predefClassNames.contains(cls.name)
1379-
13801373 private val JavaImportFns : List [RootRef ] = List (
13811374 RootRef (() => JavaLangPackageVal .termRef)
13821375 )
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ object Formatting {
3636 case _ => ex.getMessage
3737 s " [cannot display due to $msg, raw string = ${arg.toString}] "
3838 }
39- case _ => arg.toString
39+ case _ => String .valueOf(arg)
4040 }
4141
4242 private def treatArg (arg : Any , suffix : String )(using Context ): (Any , String ) = arg match {
Original file line number Diff line number Diff line change @@ -7,13 +7,23 @@ import config.Config
77import config .Printers
88import core .Mode
99
10+ /** Exposes the {{{ trace("question") { op } }}} syntax.
11+ *
12+ * Traced operations will print indented messages if enabled.
13+ * Tracing depends on [[Config.tracingEnabled ]] and [[dotty.tools.dotc.config.ScalaSettings.Ylog ]].
14+ * Tracing can be forced by replacing [[trace ]] with [[trace.force ]] or [[trace.log ]] (see below).
15+ */
1016object trace extends TraceSyntax :
1117 inline def isEnabled = Config .tracingEnabled
1218 protected val isForced = false
1319
1420 object force extends TraceSyntax :
1521 inline def isEnabled : true = true
1622 protected val isForced = true
23+
24+ object log extends TraceSyntax :
25+ inline def isEnabled : true = true
26+ protected val isForced = false
1727end trace
1828
1929/** This module is carefully optimized to give zero overhead if Config.tracingEnabled
@@ -73,7 +83,7 @@ trait TraceSyntax:
7383 var logctx = ctx
7484 while logctx.reporter.isInstanceOf [StoreReporter ] do logctx = logctx.outer
7585 def margin = ctx.base.indentTab * ctx.base.indent
76- def doLog (s : String ) = if isForced then println(s) else report.log(s)
86+ def doLog (s : String ) = if isForced then println(s) else report.log(s)( using logctx)
7787 def finalize (msg : String ) =
7888 if ! finalized then
7989 ctx.base.indent -= 1
You can’t perform that action at this time.
0 commit comments