Skip to content

Commit f963bc2

Browse files
Rename and join nested if expression
1 parent c552416 commit f963bc2

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,15 @@ class InteractiveDriver(settings: List[String]) extends Driver {
183183
* typed children if the source contains errors.
184184
*/
185185
private def cleanup(tree: tpd.Tree)(implicit ctx: Context): Unit = {
186-
val cleanedTree = mutable.Set.empty[tpd.Tree]
186+
val seen = mutable.Set.empty[tpd.Tree]
187187
def cleanupTree(tree: tpd.Tree): Unit = {
188-
cleanedTree += tree
188+
seen += tree
189189
tree.foreachSubTree { t =>
190-
if (t.hasType) {
191-
if (t.symbol.exists) {
192-
if (!t.symbol.isCompleted) t.symbol.info = UnspecifiedErrorType
193-
t.symbol.annotations.foreach { annot =>
194-
if (!cleanedTree(annot.tree))
195-
cleanupTree(annot.tree)
196-
}
190+
if (t.symbol.exists && t.hasType) {
191+
if (!t.symbol.isCompleted) t.symbol.info = UnspecifiedErrorType
192+
t.symbol.annotations.foreach { annot =>
193+
if (!seen(annot.tree))
194+
cleanupTree(annot.tree)
197195
}
198196
}
199197
t.removeAllAttachments()

0 commit comments

Comments
 (0)