Skip to content

Commit 99e40f9

Browse files
committed
Use build-in mechanism to get definitions
1 parent d818ea2 commit 99e40f9

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

compiler/src/dotty/tools/dotc/Compiler.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,8 @@ class Compiler {
5858
new CheckReentrant, // Internal use only: Check that compiled program has no data races involving global vars
5959
new ElimPackagePrefixes, // Eliminate references to package prefixes in Select nodes
6060
new CookComments, // Cook the comments: expand variables, doc, etc.
61-
new CheckStatic) :: // Check restrictions that apply to @static members
62-
List(new init.SetDefTree) :: // Attach trees to symbols
63-
List(new init.Checker) :: // Check initialization of objects
61+
new CheckStatic, // Check restrictions that apply to @static members
62+
new init.Checker) :: // Check initialization of objects
6463
List(new CompleteJavaEnums, // Fill in constructors for Java enums
6564
new ElimRepeated, // Rewrite vararg parameters and arguments
6665
new ExpandSAMs, // Expand single abstract method closures to anonymous classes

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,9 @@ object Symbols {
460460
*/
461461
def retainsDefTree(implicit ctx: Context): Boolean =
462462
ctx.settings.YretainTrees.value ||
463-
denot.owner.isTerm || // no risk of leaking memory after a run for these
464-
denot.isOneOf(InlineOrProxy) // need to keep inline info
463+
denot.owner.isTerm || // no risk of leaking memory after a run for these
464+
denot.isOneOf(InlineOrProxy) || // need to keep inline info
465+
ctx.settings.YcheckInit.value // initialization check
465466

466467
/** The last denotation of this symbol */
467468
private var lastDenot: SymDenotation = _

compiler/src/dotty/tools/dotc/transform/init/CheckingPhase.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Checker extends MiniPhase {
2525
// cache of class summary
2626
private val baseEnv = Env(null, mutable.Map.empty)
2727

28-
override val runsAfter = Set(SetDefTree.name)
28+
override val runsAfter = Set(Pickler.name)
2929

3030
override def isEnabled(implicit ctx: Context): Boolean =
3131
super.isEnabled && ctx.settings.YcheckInit.value

compiler/src/dotty/tools/dotc/transform/init/Summarization.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ object Summarization {
198198
case _: TypeDef =>
199199
Summary.empty
200200

201+
case _: Import =>
202+
Summary.empty
203+
201204
case _ =>
202205
throw new Exception("unexpected tree: " + expr.show)
203206
}

0 commit comments

Comments
 (0)