Skip to content

Commit

Permalink
Improve the check for use of extension methods
Browse files Browse the repository at this point in the history
  • Loading branch information
cb372 committed Sep 1, 2020
1 parent 6bca848 commit a1b8d09
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scalafix/rules/src/main/scala/fix/Cats_v2_2_0.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ case class RemoveInstanceImports(index: SemanticdbIndex)
synthetic.names.exists(x => isCatsSyntax(x.symbol))

private def isCatsSyntax(symbol: Symbol) =
symbol.syntax.contains("cats") && symbol.syntax.contains("syntax")
symbol.syntax.contains("cats") && (symbol.syntax.contains("syntax") || symbol.syntax.contains("Ops"))

private def findLexicalBoundary(t: Tree): Tree = {
t.parent match {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
rule = "scala:fix.v2_2_0.RemoveInstanceImports"
*/
package fix
package to2_2_0

import cats._
import cats.implicits._

object RemoveInstanceImportsTests3 {

def doSomethingMonadic[F[_]: Monad](x: F[Int]): F[String] =
for {
a <- x
b <- Monad[F].pure("hi")
c <- Monad[F].pure("hey")
} yield a.toString + b + c

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package fix
package to2_2_0

import cats._
import cats.syntax.all._

object RemoveInstanceImportsTests3 {

def doSomethingMonadic[F[_]: Monad](x: F[Int]): F[String] =
for {
a <- x
b <- Monad[F].pure("hi")
c <- Monad[F].pure("hey")
} yield a.toString + b + c

}

0 comments on commit a1b8d09

Please sign in to comment.