From 2512562e5e1723a890ceb098d25c1b7c7298f813 Mon Sep 17 00:00:00 2001 From: Fengyun Liu Date: Thu, 6 Apr 2023 23:16:51 +0200 Subject: [PATCH] Retain defTree while checking global objects --- compiler/src/dotty/tools/dotc/core/Symbols.scala | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/Symbols.scala b/compiler/src/dotty/tools/dotc/core/Symbols.scala index aa3ae0c3c513..650b13b1dfcf 100644 --- a/compiler/src/dotty/tools/dotc/core/Symbols.scala +++ b/compiler/src/dotty/tools/dotc/core/Symbols.scala @@ -82,8 +82,9 @@ object Symbols { def retainsDefTree(using Context): Boolean = ctx.settings.YretainTrees.value || denot.owner.isTerm || // no risk of leaking memory after a run for these - denot.isOneOf(InlineOrProxy) || // need to keep inline info - ctx.settings.YcheckInit.value // initialization check + denot.isOneOf(InlineOrProxy) || // need to keep inline info + ctx.settings.YcheckInit.value || // initialization check + ctx.settings.YcheckInitGlobal.value // initialization check /** The last denotation of this symbol */ private var lastDenot: SymDenotation = _