Skip to content

Commit

Permalink
fix UnusedConstructorParams
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwei-k committed Oct 30, 2024
1 parent 93fa995 commit 6a317ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions input/src/main/scala-3/fix/UnusedConstructorParamsTest2.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
rule = UnusedConstructorParams
*/
package fix

class A6(val x: Int)(using x2: String)
2 changes: 2 additions & 0 deletions input/src/main/scala/fix/UnusedConstructorParamsTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions rules/src/main/scala/fix/UnusedConstructorParams.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 6a317ca

Please sign in to comment.