Skip to content

Commit bc057db

Browse files
committed
Make myNotNullInfos field private
1 parent 7936264 commit bc057db

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ class Namer { typer: Typer =>
785785

786786
protected def localContext(owner: Symbol): FreshContext = ctx.fresh.setOwner(owner).setTree(original)
787787

788-
var myNotNullInfos: List[NotNullInfo] | Null = null
788+
private var myNotNullInfos: List[NotNullInfo] | Null = null
789789

790790
/** The context with which this completer was created */
791791
given creationContext[T]: Context =
@@ -794,6 +794,9 @@ class Namer { typer: Typer =>
794794
// make sure testing contexts are not captured by completers
795795
assert(!ictx.reporter.isInstanceOf[ExploringReporter])
796796

797+
def setNotNullInfos(infos: List[NotNullInfo]): Unit =
798+
myNotNullInfos = infos
799+
797800
protected def typeSig(sym: Symbol): Type = original match
798801
case original: ValDef =>
799802
if (sym.is(Module)) moduleValSig(sym)

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,11 +3361,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
33613361
mdef.getAttachment(SymOfTree) match {
33623362
case Some(sym) => sym.infoOrCompleter match {
33633363
case completer: Namer#Completer =>
3364-
if (completer.creationContext.notNullInfos ne ctx.notNullInfos)
3364+
if completer.creationContext.notNullInfos ne ctx.notNullInfos then
33653365
// The RHS of a val def should know about not null facts established
33663366
// in preceding statements (unless the DefTree is completed ahead of time,
33673367
// then it is impossible).
3368-
completer.myNotNullInfos = ctx.notNullInfos
3368+
completer.setNotNullInfos(ctx.notNullInfos)
33693369
true
33703370
case _ =>
33713371
// If it has been completed, then it must be because there is a forward reference

0 commit comments

Comments
 (0)