From e343d1d92a47298f139198011437b4a8a368b72c Mon Sep 17 00:00:00 2001 From: kenji yoshida <6b656e6a69@gmail.com> Date: Wed, 30 Oct 2024 18:45:46 +0900 Subject: [PATCH 1/2] delete output/UnusedConstructorParamsTest.scala --- .../main/scala/fix/UnusedConstructorParamsTest.scala | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 output/src/main/scala/fix/UnusedConstructorParamsTest.scala diff --git a/output/src/main/scala/fix/UnusedConstructorParamsTest.scala b/output/src/main/scala/fix/UnusedConstructorParamsTest.scala deleted file mode 100644 index ec6d71d..0000000 --- a/output/src/main/scala/fix/UnusedConstructorParamsTest.scala +++ /dev/null @@ -1,10 +0,0 @@ -package fix - - -class A1(val x: Int) - -class A2(x: Int) - -class A3(`type`: Int) extends A1(`type`) - -class A4(var x: Int) From e3635c6a2e2bbccd34ec4c5460f95745e9d7ef0d Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Wed, 30 Oct 2024 18:57:17 +0900 Subject: [PATCH 2/2] fix UnusedConstructorParams --- .../src/main/scala-3/fix/UnusedConstructorParamsTest2.scala | 6 ++++++ input/src/main/scala/fix/UnusedConstructorParamsTest.scala | 2 ++ rules/src/main/scala/fix/UnusedConstructorParams.scala | 1 + 3 files changed, 9 insertions(+) create mode 100644 input/src/main/scala-3/fix/UnusedConstructorParamsTest2.scala diff --git a/input/src/main/scala-3/fix/UnusedConstructorParamsTest2.scala b/input/src/main/scala-3/fix/UnusedConstructorParamsTest2.scala new file mode 100644 index 0000000..0b9e5b8 --- /dev/null +++ b/input/src/main/scala-3/fix/UnusedConstructorParamsTest2.scala @@ -0,0 +1,6 @@ +/* +rule = UnusedConstructorParams + */ +package fix + +class A6(val x: Int)(using x2: String) diff --git a/input/src/main/scala/fix/UnusedConstructorParamsTest.scala b/input/src/main/scala/fix/UnusedConstructorParamsTest.scala index f0a51cb..96aec0a 100644 --- a/input/src/main/scala/fix/UnusedConstructorParamsTest.scala +++ b/input/src/main/scala/fix/UnusedConstructorParamsTest.scala @@ -10,3 +10,5 @@ class A2(x: Int) // assert: UnusedConstructorParams class A3(`type`: Int) extends A1(`type`) class A4(var x: Int) + +class A5(val x: Int)(implicit x2: String) diff --git a/rules/src/main/scala/fix/UnusedConstructorParams.scala b/rules/src/main/scala/fix/UnusedConstructorParams.scala index edcb83a..2c6ff16 100644 --- a/rules/src/main/scala/fix/UnusedConstructorParams.scala +++ b/rules/src/main/scala/fix/UnusedConstructorParams.scala @@ -21,6 +21,7 @@ class UnusedConstructorParams extends SyntacticRule("UnusedConstructorParams") { case x: Defn.Class if !x.mods.exists(_.is[Mod.Case]) => val params = x.ctor.paramClauses.flatten .filterNot(_.mods.exists(_.is[Mod.Implicit])) + .filterNot(_.mods.exists(_.is[Mod.Using])) .filterNot(_.mods.exists(_.is[Mod.VarParam])) .filterNot(_.mods.exists(_.is[Mod.ValParam])) val allTokens = {