Skip to content

Commit 6722aaa

Browse files
committed
Set explicit nulls in CompilationUnitInfo symbols from source
1 parent ada4552 commit 6722aaa

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/src/dotty/tools/dotc/core/CompilationUnitInfo.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ import dotty.tools.tasty.TastyVersion
99
* the class containing this symbol was generated,
1010
* null if not applicable.
1111
* @param tastyVersion The TASTy version (major, minor, experimental)
12-
* @param tastyExplicitNulls Was this compilation unit compiled with explicit nulls?
12+
* @param explicitNulls This compilation unit has explicit nulls enabled?
1313
*/
1414
class CompilationUnitInfo(
1515
val associatedFile: AbstractFile,
1616
val tastyVersion: Option[TastyVersion],
17-
val tastyExplicitNulls: Boolean
17+
val explicitNulls: Boolean
1818
) {
1919

2020
override def toString(): String =
2121
s"CompilationUnitInfo($associatedFile, $tastyVersion)"
2222
}
2323

2424
object CompilationUnitInfo:
25-
def apply(assocFile: AbstractFile | Null): CompilationUnitInfo | Null =
25+
def apply(assocFile: AbstractFile | Null, explicitNulls: Boolean = false): CompilationUnitInfo | Null =
2626
if assocFile == null then null
2727
else new CompilationUnitInfo(
2828
assocFile,
2929
tastyVersion = None,
30-
tastyExplicitNulls = false // TODO track explicit nulls for current compilation units (not only TASTy)
30+
explicitNulls = explicitNulls,
3131
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class Namer { typer: Typer =>
250250
val cls =
251251
createOrRefine[ClassSymbol](tree, name, flags, ctx.owner,
252252
cls => adjustIfModule(new ClassCompleter(cls, tree)(ctx), tree),
253-
newClassSymbol(ctx.owner, name, _, _, _, tree.nameSpan, CompilationUnitInfo(ctx.source.file)))
253+
newClassSymbol(ctx.owner, name, _, _, _, tree.nameSpan, CompilationUnitInfo(ctx.source.file, explicitNulls = ctx.explicitNulls)))
254254
cls.completer.asInstanceOf[ClassCompleter].init()
255255
cls
256256
case tree: MemberDef =>

0 commit comments

Comments
 (0)