summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index ac3321ba78..3d88493c86 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3258,9 +3258,10 @@ trait Typers { self: Analyzer =>
phase.id <= currentRun.typerPhase.id &&
!sym.isConstructor &&
!(qual.tpe <:< NotNullClass.tpe) && !qual.tpe.isNotNull &&
- (result.symbol != Any_isInstanceOf) // null.isInstanceOf[T] is not a dereference; bug #1356
+ !(List(Any_isInstanceOf, Any_asInstanceOf) contains result.symbol) // null.is/as is not a dereference
}
- if (settings.Xchecknull.value && isPotentialNullDeference)
+ // unit is null here sometimes; how are we to know when unit might be null? (See bug #2467.)
+ if (settings.Xchecknull.value && isPotentialNullDeference && unit != null)
unit.warning(tree.pos, "potential null pointer dereference: "+tree)
result