Skip to content

Commit a1ff530

Browse files
noti0na1WojciechMazur
authored andcommitted
Make myNotNullInfos field private
[Cherry-picked bc057db]
1 parent 29a9b9f commit a1ff530

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
@@ -782,7 +782,7 @@ class Namer { typer: Typer =>
782782

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

785-
var myNotNullInfos: List[NotNullInfo] | Null = null
785+
private var myNotNullInfos: List[NotNullInfo] | Null = null
786786

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

794+
def setNotNullInfos(infos: List[NotNullInfo]): Unit =
795+
myNotNullInfos = infos
796+
794797
protected def typeSig(sym: Symbol): Type = original match
795798
case original: ValDef =>
796799
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
@@ -3297,11 +3297,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
32973297
mdef.getAttachment(SymOfTree) match {
32983298
case Some(sym) => sym.infoOrCompleter match {
32993299
case completer: Namer#Completer =>
3300-
if (completer.creationContext.notNullInfos ne ctx.notNullInfos)
3300+
if completer.creationContext.notNullInfos ne ctx.notNullInfos then
33013301
// The RHS of a val def should know about not null facts established
33023302
// in preceding statements (unless the DefTree is completed ahead of time,
33033303
// then it is impossible).
3304-
completer.myNotNullInfos = ctx.notNullInfos
3304+
completer.setNotNullInfos(ctx.notNullInfos)
33053305
true
33063306
case _ =>
33073307
// If it has been completed, then it must be because there is a forward reference

0 commit comments

Comments
 (0)