-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Labels
Description
Reproduction steps
Scala version: 2.13.16
@inline def matches[A](a: A)(pf: PartialFunction[A, Unit]): Boolean = pf.isDefinedAt(a)
def sameTypeAndSameCaseClass = tp1 match {
case tp1: TypeRef => matches(tp2) { case tp2: TypeRef if isSameTypeRef(tp1, tp2) => }
}
Problem
[warn] .../scala/src/reflect/scala/reflect/internal/tpe/TypeComparers.scala:251:62: Name tp2 is already introduced in an enclosing scope as value tp2 at line 205. Did you intend to match it using backquoted `tp2`?
[warn] case tp1: TypeRef => matches(tp2) { case tp2: TypeRef if isSameTypeRef(tp1, tp2) => }
[warn] ^
It would be nice if the lint noticed that value tp2
is an input to the application, much as it recognizes
tp2 match { case tp2: TypeRef => }
where the selector expression is f(tp2)
or just tp2
itself.
He-Pin