@@ -81,7 +81,9 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
81
81
import definitions .findNamedMember
82
82
def findMemberFromRoot (fullName : Name ): Symbol = rootMirror.findMemberFromRoot(fullName)
83
83
override def deferredOpenPackageModule (container : Symbol , dest : Symbol ): Unit = {
84
- if (isPast(currentRun.packageobjectsPhase)) {
84
+ // Some compiler runs (e.g. Toolbox and the PC) just initialise Global and then discard the Run
85
+ // such that the scala package object decls never get entered into the scala package
86
+ if ((curRun eq null ) || ! isGlobalInitialized || isPastPackageObjects) {
85
87
super .openPackageModule(container, dest)
86
88
} else {
87
89
analyzer.packageObjects.deferredOpen(dest) = container
@@ -1023,6 +1025,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
1023
1025
)
1024
1026
override def isPastTyper = isPast(currentRun.typerPhase)
1025
1027
def isBeforeErasure = isBefore(currentRun.erasurePhase)
1028
+ def isPastPackageObjects = isPast(currentRun.packageobjectsPhase)
1026
1029
def isPast (phase : Phase ) = (
1027
1030
(curRun ne null )
1028
1031
&& isGlobalInitialized // defense against init order issues
@@ -1655,8 +1658,7 @@ class Global(var currentSettings: Settings, reporter0: Reporter)
1655
1658
compileLate(new CompilationUnit (scripted(getSourceFile(file))))
1656
1659
}
1657
1660
1658
- /** Compile abstract file until `globalPhase`, but at least to phase "namer".
1659
- */
1661
+ /** Compile the unit until `globalPhase`, but at least to phase "typer". */
1660
1662
def compileLate (unit : CompilationUnit ): Unit = {
1661
1663
addUnit(unit)
1662
1664
0 commit comments