From 910481a0f4fe671f3f4d8965eac61870596970e1 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Sat, 20 Feb 2016 15:31:11 +0100 Subject: Do not create companions that will be dropped later. Fix blocker bug reported in #1114 I dislike this fix as now phase needs to know in advance if it will ever need a companion for the class. On the bright side, this change makes it clear which phases need companions --- src/dotty/tools/dotc/core/Phases.scala | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/dotty/tools/dotc/core/Phases.scala') diff --git a/src/dotty/tools/dotc/core/Phases.scala b/src/dotty/tools/dotc/core/Phases.scala index 83ac64d53..b60f437d5 100644 --- a/src/dotty/tools/dotc/core/Phases.scala +++ b/src/dotty/tools/dotc/core/Phases.scala @@ -4,6 +4,7 @@ package core import Periods._ import Contexts._ import dotty.tools.backend.jvm.{LabelDefs, GenBCode} +import dotty.tools.dotc.core.Symbols.ClassSymbol import util.DotClass import DenotTransformers._ import Denotations._ @@ -347,6 +348,10 @@ object Phases { override def toString = phaseName } + trait NeedsCompanions { + def isCompanionNeeded(cls: ClassSymbol)(implicit ctx: Context): Boolean + } + /** Replace all instances of `oldPhaseClass` in `current` phases * by the result of `newPhases` applied to the old phase. */ -- cgit v1.2.3