File tree 3 files changed +7
-4
lines changed
compiler/src/dotty/tools/dotc/typer
3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,11 @@ object Nullables:
52
52
val hiTree = if (hiTpe eq hi.typeOpt) hi else TypeTree (hiTpe)
53
53
TypeBoundsTree (lo, hiTree, alias)
54
54
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.
57
60
*/
58
61
case class NotNullInfo (asserted : Set [TermRef ], retracted : Set [TermRef ]):
59
62
def isEmpty = this eq NotNullInfo .empty
Original file line number Diff line number Diff line change @@ -2367,7 +2367,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2367
2367
val cases2 = cases2x.asInstanceOf [List [CaseDef ]]
2368
2368
2369
2369
// It is possible to have non-exhaustive cases, and some exceptions are thrown and not caught.
2370
- // Therefore, the code in the finallizer and after the try block can only rely on the retracted
2370
+ // Therefore, the code in the finalizer and after the try block can only rely on the retracted
2371
2371
// info from the cases' body.
2372
2372
if cases2.nonEmpty then
2373
2373
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 =
33
33
case _ => x = " "
34
34
x.length // error
35
35
// 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
37
37
// after the try block can only rely on the retracted info from the cases' body.
38
38
39
39
def test5 : Int =
You can’t perform that action at this time.
0 commit comments