Skip to content

Commit

Permalink
Silence debug for unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed Feb 22, 2022
1 parent 9b7103b commit c9f380d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions compiler/src/dotty/tools/dotc/core/Contexts.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1044,10 +1044,9 @@ object Contexts:
def unused(using Context): List[(ImportInfo, Symbol, untpd.ImportSelector)] =
var unusages = List.empty[(ImportInfo, Symbol, untpd.ImportSelector)]
if ctx.settings.WunusedHas.imports && !ctx.compilationUnit.isJava then
if ctx.settings.Ydebug.value then
println(importInfos.get(ctx.compilationUnit).map(iss => iss.map((ii, s) => s"${ii.show} ($ii)")).getOrElse(Nil).mkString("Registered ImportInfos\n", "\n", ""))
println(selectors.toList.flatMap((k,v) => v.toList.map(sel => s"${k.show} -> $sel")).mkString("Used selectors\n", "\n", ""))
end if
//if ctx.settings.Ydebug.value then
// println(importInfos.get(ctx.compilationUnit).map(iss => iss.map((ii, s) => s"${ii.show} ($ii)")).getOrElse(Nil).mkString("Registered ImportInfos\n", "\n", ""))
// println(selectors.toList.flatMap((k,v) => v.toList.map(sel => s"${k.show} -> $sel")).mkString("Used selectors\n", "\n", ""))
def checkUsed(info: ImportInfo, owner: Symbol): Unit =
val used = selectors(info)
var needsPatch = false
Expand Down
2 changes: 1 addition & 1 deletion tests/neg/unused-imports.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// scalac: -Wunused:imports -Werror -Ydebug -feature
// scalac: -Wunused:imports -Werror -feature

//import language.future
import language.implicitConversions
Expand Down

0 comments on commit c9f380d

Please sign in to comment.