summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
diff options
context:
space:
mode:
authorteldosas <teldosas@gmail.com>2017-02-01 02:32:10 +0200
committerteldosas <teldosas@gmail.com>2017-02-01 02:32:10 +0200
commit6864d32fbd903ce67d43ef9e0b9f011baabc8695 (patch)
treea18077f9c72ffa80e076fb91b5c5336574b6a37b /src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
parentb9d4089d19ead36d07c2d6cdda283c9b678d515e (diff)
downloadscala-6864d32fbd903ce67d43ef9e0b9f011baabc8695.tar.gz
scala-6864d32fbd903ce67d43ef9e0b9f011baabc8695.tar.bz2
scala-6864d32fbd903ce67d43ef9e0b9f011baabc8695.zip
Add warning about non-sensible equals in anonymous functions
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 296d9c6bca..dcf9ff39c9 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1130,7 +1130,7 @@ abstract class RefChecks extends Transform {
}
/** Sensibility check examines flavors of equals. */
def checkSensible(pos: Position, fn: Tree, args: List[Tree]) = fn match {
- case Select(qual, name @ (nme.EQ | nme.NE | nme.eq | nme.ne)) if args.length == 1 && isObjectOrAnyComparisonMethod(fn.symbol) && !currentOwner.isSynthetic =>
+ case Select(qual, name @ (nme.EQ | nme.NE | nme.eq | nme.ne)) if args.length == 1 && isObjectOrAnyComparisonMethod(fn.symbol) && (!currentOwner.isSynthetic || currentOwner.isAnonymousFunction) =>
checkSensibleEquals(pos, qual, name, fn.symbol, args.head)
case _ =>
}