Skip to content

Commit a69a407

Browse files
Rewrite: TypeMatcher warning about hack
1 parent 878ab35 commit a69a407

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ case class Scalacollectioncompat_newcollections(index: SemanticdbIndex)
2727
} yield (open, close)
2828

2929
// terms dont give us terms https://github.com/scalameta/scalameta/issues/1212
30+
// WARNING: TOTAL HACK
31+
// this is only to unblock us until Term.tpe is available: https://github.com/scalameta/scalameta/issues/1212
3032
// if we have a simple identifier, we can look at his definition at query it's type
3133
// this should be improved in future version of scalameta
3234
object TypeMatcher {
@@ -37,8 +39,7 @@ case class Scalacollectioncompat_newcollections(index: SemanticdbIndex)
3739
final class TypeMatcher(symbols: Symbol*)(implicit index: SemanticdbIndex) {
3840
def unapply(tree: Tree): Boolean = {
3941
index.denotation(tree)
40-
.map(_.names.headOption.exists(n => symbols.exists(_ == n.symbol)))
41-
.getOrElse(false)
42+
.exists(_.names.headOption.exists(n => symbols.exists(_ == n.symbol)))
4243
}
4344
}
4445

0 commit comments

Comments
 (0)