Skip to content

Commit 4057925

Browse files
Rewrite: TypeMatcher warning about hack
1 parent eec6b8a commit 4057925

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scalafix/rules/src/main/scala/fix/Scalacollectioncompat_newcollections.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import scala.meta._
88
case class Scalacollectioncompat_newcollections(index: SemanticdbIndex)
99
extends SemanticRule(index, "Scalacollectioncompat_newcollections") {
1010

11-
// terms dont give us terms https://github.com/scalameta/scalameta/issues/1212
11+
// WARNING: TOTAL HACK
12+
// this is only to unblock us until Term.tpe is available: https://github.com/scalameta/scalameta/issues/1212
1213
// if we have a simple identifier, we can look at his definition at query it's type
1314
// this should be improved in future version of scalameta
1415
object TypeMatcher {
@@ -19,8 +20,7 @@ case class Scalacollectioncompat_newcollections(index: SemanticdbIndex)
1920
final class TypeMatcher(symbols: Symbol*)(implicit index: SemanticdbIndex) {
2021
def unapply(tree: Tree): Boolean = {
2122
index.denotation(tree)
22-
.map(_.names.headOption.exists(n => symbols.exists(_ == n.symbol)))
23-
.getOrElse(false)
23+
.exists(_.names.headOption.exists(n => symbols.exists(_ == n.symbol)))
2424
}
2525
}
2626

0 commit comments

Comments
 (0)