diff --git a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala index df916fc76a3b..37dde1303c18 100644 --- a/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala +++ b/compiler/src/dotty/tools/dotc/transform/CheckUnused.scala @@ -118,7 +118,7 @@ class CheckUnused private (phaseMode: CheckUnused.PhaseMode, suffix: String, _ke override def prepareForDefDef(tree: tpd.DefDef)(using Context): Context = unusedDataApply{ ud => - if !tree.rawMods.is(Private) then + if !tree.symbol.is(Private) then tree.termParamss.flatten.foreach { p => ud.addIgnoredParam(p.symbol) } @@ -403,6 +403,7 @@ object CheckUnused: doNotRegister --= sym.everySymbol def addIgnoredParam(sym: Symbol)(using Context): Unit = + println("Ignoring " + sym) paramsToSkip += sym /** Register an import */ diff --git a/tests/neg-custom-args/fatal-warnings/i15503e.scala b/tests/neg-custom-args/fatal-warnings/i15503e.scala index b1b2e73d51a8..57664cd08dcd 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503e.scala +++ b/tests/neg-custom-args/fatal-warnings/i15503e.scala @@ -8,7 +8,7 @@ object Foo { private def f2(a: Int) = default_val // error private def f3(a: Int)(using Int) = a // OK private def f4(a: Int)(using Int) = default_val // error - private def f6(a: Int)(using Int) = summon[Int] // ok + private def f6(a: Int)(using Int) = summon[Int] // error private def f7(a: Int)(using Int) = summon[Int] + a // OK } @@ -49,7 +49,7 @@ package foo.test.trivial: private def f6(x: Int) = X // OK private def f7(x: Int) = Y // OK private def f8(x: Int): List[C] = Nil // OK - private def f9(x: Int): List[Int] = List(1,2,3,4) // ok + private def f9(x: Int): List[Int] = List(1,2,3,4) // error private def foo:Int = 32 // OK private def f77(x: Int) = foo // error } diff --git a/tests/neg-custom-args/fatal-warnings/i15503f.scala b/tests/neg-custom-args/fatal-warnings/i15503f.scala index f909272af732..1dc16283caa8 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503f.scala +++ b/tests/neg-custom-args/fatal-warnings/i15503f.scala @@ -8,7 +8,7 @@ object Xd { private def f2(a: Int) = 1 // OK private def f3(a: Int)(using Int) = a // OK private def f4(a: Int)(using Int) = default_int // OK - private def f6(a: Int)(using Int) = summon[Int] // OK + private def f6(a: Int)(using Int) = summon[Int] // error private def f7(a: Int)(using Int) = summon[Int] + a // OK private def f8(a: Int)(using foo: Int) = a // error } diff --git a/tests/neg-custom-args/fatal-warnings/i15503g.scala b/tests/neg-custom-args/fatal-warnings/i15503g.scala index da2921351519..2185bfed711d 100644 --- a/tests/neg-custom-args/fatal-warnings/i15503g.scala +++ b/tests/neg-custom-args/fatal-warnings/i15503g.scala @@ -8,7 +8,7 @@ object Foo { private def f2(a: Int) = default_int // error private def f3(a: Int)(using Int) = a // OK private def f4(a: Int)(using Int) = default_int // error - private def f6(a: Int)(using Int) = summon[Int] // ok + private def f6(a: Int)(using Int) = summon[Int] // error private def f7(a: Int)(using Int) = summon[Int] + a // OK /* --- Trivial method check --- */ private def g1(x: Int) = 1 // OK