File tree 3 files changed +12
-9
lines changed
compiler/src/dotty/tools/dotc
3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -1370,13 +1370,6 @@ class Definitions {
1370
1370
else if arity >= 0 then FunctionType (arity)
1371
1371
else NoType
1372
1372
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
-
1380
1373
private val JavaImportFns : List [RootRef ] = List (
1381
1374
RootRef (() => JavaLangPackageVal .termRef)
1382
1375
)
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ object Formatting {
36
36
case _ => ex.getMessage
37
37
s " [cannot display due to $msg, raw string = ${arg.toString}] "
38
38
}
39
- case _ => arg.toString
39
+ case _ => String .valueOf(arg)
40
40
}
41
41
42
42
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
7
7
import config .Printers
8
8
import core .Mode
9
9
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
+ */
10
16
object trace extends TraceSyntax :
11
17
inline def isEnabled = Config .tracingEnabled
12
18
protected val isForced = false
13
19
14
20
object force extends TraceSyntax :
15
21
inline def isEnabled : true = true
16
22
protected val isForced = true
23
+
24
+ object log extends TraceSyntax :
25
+ inline def isEnabled : true = true
26
+ protected val isForced = false
17
27
end trace
18
28
19
29
/** This module is carefully optimized to give zero overhead if Config.tracingEnabled
@@ -73,7 +83,7 @@ trait TraceSyntax:
73
83
var logctx = ctx
74
84
while logctx.reporter.isInstanceOf [StoreReporter ] do logctx = logctx.outer
75
85
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)
77
87
def finalize (msg : String ) =
78
88
if ! finalized then
79
89
ctx.base.indent -= 1
You can’t perform that action at this time.
0 commit comments