From 8ce658f6653bc6fedb7c7f43f9e307fe55847297 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 16 Oct 2009 05:03:45 +0000 Subject: Fix for #2467. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3