@@ -24,6 +24,7 @@ import scala.reflect.ClassTag
2424import scala .reflect .internal .pickling .PickleBuffer
2525import scala .reflect .internal .util .{BatchSourceFile , FreshNameCreator , NoSourceFile , ScriptSourceFile , SourceFile }
2626import scala .reflect .internal .{Reporter => InternalReporter }
27+ import scala .tools .nsc .Reporting .WarningCategory
2728import scala .tools .nsc .ast .parser ._
2829import scala .tools .nsc .ast .{TreeGen => AstTreeGen , _ }
2930import scala .tools .nsc .backend .jvm .{BackendStats , GenBCode }
@@ -294,7 +295,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
294295 @ inline final def devWarning (pos : Position , msg : => String ): Unit = {
295296 def pos_s = if (pos eq NoPosition ) " " else s " [@ $pos] "
296297 if (isDeveloper)
297- warning(pos, " !!! " + msg)
298+ runReporting. warning(pos, " !!! " + msg, WarningCategory . OtherDebug , site = " " )
298299 else
299300 log(s " !!! $pos_s $msg" ) // such warnings always at least logged
300301 }
@@ -884,7 +885,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
884885 case Some (oldEntry) =>
885886 Some (oldEntry -> ClassPathFactory .newClassPath(dir, settings, closeableRegistry))
886887 case None =>
887- error (s " Error adding entry to classpath. During invalidation, no entry named $path in classpath $classPath" )
888+ globalError (s " Error adding entry to classpath. During invalidation, no entry named $path in classpath $classPath" )
888889 None
889890 }
890891 }
@@ -992,10 +993,11 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
992993
993994 /** The currently active run
994995 */
995- def currentRun : Run = curRun
996- def currentUnit : CompilationUnit = if (currentRun eq null ) NoCompilationUnit else currentRun.currentUnit
997- def currentSource : SourceFile = if (currentUnit.exists) currentUnit.source else lastSeenSourceFile
998- def currentFreshNameCreator = if (curFreshNameCreator == null ) currentUnit.fresh else curFreshNameCreator
996+ def currentRun : Run = curRun
997+ def currentUnit : CompilationUnit = if (currentRun eq null ) NoCompilationUnit else currentRun.currentUnit
998+ def currentSource : SourceFile = if (currentUnit.exists) currentUnit.source else lastSeenSourceFile
999+ def runReporting : PerRunReporting = currentRun.reporting
1000+ def currentFreshNameCreator = if (curFreshNameCreator == null ) currentUnit.fresh else curFreshNameCreator
9991001 private [this ] var curFreshNameCreator : FreshNameCreator = null
10001002 private [scala] def currentFreshNameCreator_= (fresh : FreshNameCreator ): Unit = curFreshNameCreator = fresh
10011003
@@ -1139,9 +1141,9 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
11391141 val isScala300 : Boolean = settings.isScala300
11401142
11411143 // used in sbt
1142- def uncheckedWarnings : List [(Position , String )] = reporting.uncheckedWarnings.map{ case (pos, (msg, since)) => (pos, msg)}
1144+ def uncheckedWarnings : List [(Position , String )] = reporting.uncheckedWarnings
11431145 // used in sbt
1144- def deprecationWarnings : List [(Position , String )] = reporting.deprecationWarnings.map{ case (pos, (msg, since)) => (pos, msg)}
1146+ def deprecationWarnings : List [(Position , String )] = reporting.deprecationWarnings
11451147
11461148 private class SyncedCompilationBuffer { self =>
11471149 private val underlying = new mutable.ArrayBuffer [CompilationUnit ]
@@ -1249,8 +1251,8 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
12491251 val count =
12501252 if (including) first.iterator.count(tester.containsPhase(_))
12511253 else phaseDescriptors.count(pd => tester.contains(pd.phaseName))
1252- if (count == 0 ) warning(s " ' $p' specifies no phase " )
1253- if (count > 1 && ! isSpecial(p)) warning(s " ' $p' selects $count phases " )
1254+ if (count == 0 ) runReporting. warning(NoPosition , s " ' $p' specifies no phase " , WarningCategory . Other , site = " " )
1255+ if (count > 1 && ! isSpecial(p)) runReporting. warning(NoPosition , s " ' $p' selects $count phases " , WarningCategory . Other , site = " " )
12541256 if (! including && isSpecial(p)) globalError(s " -Yskip and -Ystop values must name phases: ' $p' " )
12551257 tester.clear()
12561258 }
@@ -1360,9 +1362,9 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
13601362 private def warnDeprecatedAndConflictingSettings (): Unit = {
13611363 // issue warnings for any usage of deprecated settings
13621364 settings.userSetSettings filter (_.isDeprecated) foreach { s =>
1363- currentRun.reporting. deprecationWarning(NoPosition , s.name + " is deprecated: " + s.deprecationMessage.get, " " )
1365+ runReporting. deprecationWarning(NoPosition , s.name + " is deprecated: " + s.deprecationMessage.get, " " , " " , " " )
13641366 }
1365- settings.conflictWarning.foreach(reporter .warning(NoPosition , _))
1367+ settings.conflictWarning.foreach(runReporting .warning(NoPosition , _, WarningCategory . Other , site = " " ))
13661368 }
13671369
13681370 /* An iterator returning all the units being compiled in this run */
@@ -1542,6 +1544,9 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
15421544 if (settings.YstatisticsEnabled && settings.Ystatistics .contains(phase.name))
15431545 printStatisticsFor(phase)
15441546
1547+ if (! globalPhase.hasNext || reporter.hasErrors)
1548+ runReporting.warnUnusedSuppressions()
1549+
15451550 advancePhase()
15461551 }
15471552 profiler.finished()
0 commit comments