Skip to content

Commit 03d3e79

Browse files
committed
Also, fix condition for TypeTestAlwaysDiverges warning message.
This used to also include nulls but that makes no sense: null.isInstanceOf does not diverge, it just returns false. The ok-tostring test shows that always false should not yield a warning, since this might come from inlined code.
1 parent 7951895 commit 03d3e79

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

compiler/src/dotty/tools/dotc/transform/TypeTestsCasts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ object TypeTestsCasts {
257257
if expr.tpe.isNotNull then constant(expr, Literal(Constant(true)))
258258
else expr.testNotNull
259259
else {
260-
if expr.tpe.isBottomType then
260+
if expr.tpe.hasClassSymbol(defn.NothingClass) then
261261
report.warning(TypeTestAlwaysDiverges(expr.tpe, testType), tree.srcPos)
262262
val nestedCtx = ctx.fresh.setNewTyperState()
263263
val foundClsSyms = effectiveClassSymbols(expr.tpe.widen)

0 commit comments

Comments
 (0)