File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,11 @@ object Nullables:
5252 val hiTree = if (hiTpe eq hi.typeOpt) hi else TypeTree (hiTpe)
5353 TypeBoundsTree (lo, hiTree, alias)
5454
55- /** A set of val or var references that are known to be not null,
56- * plus a set of variable references that are once assigned to null.
55+ /** A set of val or var references that are known to be not null
56+ * after the tree finishes executing normally (non-exceptionally),
57+ * plus a set of variable references that are ever assigned to null,
58+ * and may therefore be null if execution of the tree is interrupted
59+ * by an exception.
5760 */
5861 case class NotNullInfo (asserted : Set [TermRef ], retracted : Set [TermRef ]):
5962 def isEmpty = this eq NotNullInfo .empty
Original file line number Diff line number Diff line change @@ -2360,7 +2360,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
23602360 val cases2 = cases2x.asInstanceOf [List [CaseDef ]]
23612361
23622362 // It is possible to have non-exhaustive cases, and some exceptions are thrown and not caught.
2363- // Therefore, the code in the finallizer and after the try block can only rely on the retracted
2363+ // Therefore, the code in the finalizer and after the try block can only rely on the retracted
23642364 // info from the cases' body.
23652365 if cases2.nonEmpty then
23662366 nnInfo = nnInfo.seq(cases2.map(_.notNullInfo.retractedInfo).reduce(_.alt(_)))
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def test4: Int =
3333 case _ => x = " "
3434 x.length // error
3535 // Although the catch block here is exhaustive, it is possible to have non-exhaustive cases,
36- // and some exceptions are thrown and not caught. Therefore, the code in the finallizer and
36+ // and some exceptions are thrown and not caught. Therefore, the code in the finalizer and
3737 // after the try block can only rely on the retracted info from the cases' body.
3838
3939def test5 : Int =
You can’t perform that action at this time.
0 commit comments