Skip to content

Transform/getters setters #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 58 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
da53cc6
Avoid creating ConstantTypes by TypeAssigner after erasure.
odersky Oct 11, 2014
398b1da
Add possibility to compile all files in a directory and all subdirect…
odersky Oct 11, 2014
1920197
Replace call to unimplemented method runtimeCall
odersky Sep 17, 2014
2b784e1
Facturing out EnclosingMethodTraverser from CapturedVars
odersky Sep 17, 2014
842ba24
Make enteredAfter, installAfter more forgiving as to when they are ca…
odersky Sep 17, 2014
ec5b2ce
Add isProperlyContainedIn method
odersky Sep 17, 2014
0762198
Fix lifting of application:
odersky Sep 18, 2014
b4d5ef2
Replace tree.withName with {tpd|untpd}.rename.tree
odersky Sep 18, 2014
4a8c530
Take receiver into account when selecting default getters.
odersky Sep 18, 2014
ee976b8
Treat @static as a source flag.
odersky Sep 18, 2014
b157b28
Allow relaxed typing of applications
odersky Sep 18, 2014
fe0cea4
Take environment into account when typing a closure.
odersky Sep 18, 2014
ce08c2f
Erasure should keep prefix in termrefs.
odersky Sep 18, 2014
6d03e30
Drop type declarations from erased ClassInfo
odersky Sep 21, 2014
e1be088
Uncurry also in DefDef trees, not just in infos.
odersky Sep 21, 2014
0a04924
Fix handling of type params in secondary constructors
odersky Sep 21, 2014
41f92ae
Fix tree typing to account for trees after constructors is run.
odersky Sep 21, 2014
7d39cbc
New utility methods in SymUtils
odersky Sep 21, 2014
360d10e
Account for PolyProto and IgnoredProto types in expectedTypeStr
odersky Sep 21, 2014
f65f0f4
Fix to primaryConstructor
odersky Sep 21, 2014
0e32cf8
Add constructors phase
odersky Sep 21, 2014
77ad36d
Combine captured vars and constructors into one macro phase.
odersky Sep 21, 2014
2081bd9
Fix rewriting of by-name class parameter accessors.
odersky Sep 23, 2014
40179ca
Completed constructors phase
odersky Sep 23, 2014
88bfdeb
Made TypeVars uncahable keys
odersky Sep 23, 2014
056c7f0
Fix caching logic in baseTypeRef
odersky Sep 23, 2014
eae997c
Added method to help traversing children in a TreeTraverser
odersky Sep 24, 2014
5708b17
Move private fields into constructor
odersky Sep 24, 2014
462eaf1
Fix errors in SymDenotations.isCachable.
DarkDimius Oct 11, 2014
57c110d
After-rebase fix: weaken owner-chain restriction.
DarkDimius Oct 11, 2014
8cbc5b3
ElimByName now handles casts to by-name-parameter TermRefs
odersky Oct 11, 2014
4f4bf41
Merge remote-tracking branch 'staging/transform/constructors' into tr…
odersky Oct 11, 2014
20e500f
Fix tree typing to account for trees after constructors is run.
odersky Sep 21, 2014
535021f
Fix to primaryConstructor
odersky Oct 11, 2014
2a98397
Fix problem in unapply typing.
odersky Oct 11, 2014
561bb9c
Create setters also for private vars
odersky Oct 6, 2014
6158fb5
Fixes to TermRefs and others in TypeErasure.
odersky Oct 7, 2014
13b51c6
rename AddGetters -> GettersSetters
odersky Oct 7, 2014
b6b77bb
Two fixes to TypeComparer
odersky Oct 7, 2014
92cee77
Re-usable method to determine self-ness.
odersky Oct 7, 2014
f9ae83b
More robust printing or trees
odersky Oct 7, 2014
7a4d8d8
SymUtil methods to navigate between setters, getters and fields.
odersky Oct 7, 2014
ec70803
Avoid caching NoDenotations in NamedTypes
odersky Oct 7, 2014
b343f84
Replace typed with typedUnadapted.
odersky Oct 7, 2014
4dcf1ec
Don't adapt to FunProto in TreeChecker.
odersky Oct 7, 2014
eb1c117
Enabled GettersSetters phase.
odersky Oct 11, 2014
b4e4bc5
New tests
odersky Oct 7, 2014
4384b4c
Bring back lost AccessorCreationFlags
odersky Oct 11, 2014
5787b40
Fix typing of _* patterns.
odersky Oct 10, 2014
65eeca1
Make widening ops more systematic & complete
odersky Oct 10, 2014
c426cf9
Fix bug in varianceInType
odersky Oct 11, 2014
da080d0
Moved caseAccessors to SymUtils
odersky Oct 11, 2014
0e910bc
TypeTestCasts should test and cast wrt erased types
odersky Oct 11, 2014
55c8024
Avoid generating Any in erasedLubs
odersky Oct 11, 2014
4f2c3f0
Make Scala2Existentials valid forever
odersky Oct 11, 2014
67c5e65
Avoid capturing an old context in Classfile#typeParamCompleter
odersky Oct 11, 2014
68a11a9
Adaptations to make pattern matcher in new world
odersky Oct 11, 2014
8cf58a2
Added missing files
odersky Oct 12, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions src/dotty/tools/dotc/Compiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ class Compiler {
* all refs to it would become outdated - they could not be dereferenced in the
* new phase.
*
* As an example, addGetters would change a field
*
* val x: T
*
* to a method
*
* def x: T
*
* but this would affect the signature of `x` (goes from NotAMethod to a method
* signature). So we can't do this before erasure.
*
* After erasure, signature changing denot-transformers are OK because erasure
* will make sure that only term refs with fixed SymDenotations survive beyond it. This
* is possible because:
Expand All @@ -57,11 +46,12 @@ class Compiler {
new TailRec),
List(new PatternMatcher,
new ExplicitOuter,
new LazyValsTransform,
// new LazyValTranformContext().transformer, // disabled, awaiting fixes
new Splitter),
List(new ElimByName,
new InterceptedMethods,
new Literalize),
new Literalize,
new GettersSetters),
List(new Erasure),
List(new CapturedVars, new Constructors)/*,
List(new LambdaLift)*/
Expand Down
54 changes: 37 additions & 17 deletions src/dotty/tools/dotc/TypeErasure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import util.DotClass

/** Erased types are:
*
* TypeRefWithFixedSym(denot is ClassDenotation)
* TermRefWithFixedSym(denot is SymDenotation)
* TypeRef(prefix is ignored, denot is ClassDenotation)
* TermRef(prefix is ignored, denot is SymDenotation)
* JavaArrayType
* AnnotatedType
* MethodType
Expand All @@ -31,7 +31,7 @@ object TypeErasure {
*/
def isErasedType(tp: Type)(implicit ctx: Context): Boolean = tp match {
case tp: TypeRef =>
tp.symbol.isClass
tp.symbol.isClass && tp.symbol != defn.AnyClass
case _: TermRef =>
true
case JavaArrayType(elem) =>
Expand Down Expand Up @@ -87,15 +87,36 @@ object TypeErasure {
private val javaSigFn = erasureFn(isJava = true, isSemi = false, isConstructor = false, wildcardOK = true)
private val semiErasureFn = erasureFn(isJava = false, isSemi = true, isConstructor = false, wildcardOK = false)

def erasure(tp: Type)(implicit ctx: Context): Type = scalaErasureFn(tp)
def semiErasure(tp: Type)(implicit ctx: Context): Type = semiErasureFn(tp)
/** The current context with a phase no later than erasure */
private def erasureCtx(implicit ctx: Context) =
if (ctx.erasedTypes) ctx.withPhase(ctx.erasurePhase) else ctx

def erasure(tp: Type)(implicit ctx: Context): Type = scalaErasureFn(tp)(erasureCtx)
def semiErasure(tp: Type)(implicit ctx: Context): Type = semiErasureFn(tp)(erasureCtx)
def sigName(tp: Type, isJava: Boolean)(implicit ctx: Context): TypeName = {
val normTp =
if (tp.isRepeatedParam) tp.translateParameterized(defn.RepeatedParamClass, defn.SeqClass)
else tp
(if (isJava) javaSigFn else scalaSigFn).sigName(normTp)
(if (isJava) javaSigFn else scalaSigFn).sigName(normTp)(erasureCtx)
}

/** The erasure of a top-level reference. Differs from normal erasure in that
* TermRefs are kept instead of being widened away.
*/
def erasedRef(tp: Type)(implicit ctx: Context): Type = tp match {
case tp: TermRef =>
assert(tp.symbol.exists, tp)
TermRef(erasedRef(tp.prefix), tp.symbol.asTerm)
case tp =>
erasure(tp)
}

/** The erasure of a function result type. Differs from normal erasure in that
* Unit is kept instead of being mapped to BoxedUnit.
*/
def eraseResult(tp: Type)(implicit ctx: Context): Type =
scalaErasureFn.eraseResult(tp)(erasureCtx)

/** The symbol's erased info. This is the type's erasure, except for the following symbols:
*
* - For $asInstanceOf : [T]T
Expand All @@ -113,8 +134,8 @@ object TypeErasure {

if ((sym eq defn.Any_asInstanceOf) || (sym eq defn.Any_isInstanceOf)) eraseParamBounds(sym.info.asInstanceOf[PolyType])
else if (sym.isAbstractType) TypeAlias(WildcardType)
else if (sym.isConstructor) outer.addParam(sym.owner.asClass, erase(tp))
else erase(tp)
else if (sym.isConstructor) outer.addParam(sym.owner.asClass, erase(tp)(erasureCtx))
else erase(tp)(erasureCtx)
}

def isUnboundedGeneric(tp: Type)(implicit ctx: Context) = !(
Expand Down Expand Up @@ -147,7 +168,7 @@ object TypeErasure {
def loop(bcs: List[ClassSymbol], bestSoFar: ClassSymbol): ClassSymbol = bcs match {
case bc :: bcs1 =>
if (cls2.derivesFrom(bc))
if (!bc.is(Trait)) bc
if (!bc.is(Trait) && bc != defn.AnyClass) bc
else loop(bcs1, if (bestSoFar.derivesFrom(bc)) bestSoFar else bc)
else
loop(bcs1, bestSoFar)
Expand Down Expand Up @@ -225,7 +246,7 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild
* - For NoType or NoPrefix, the type itself.
* - For any other type, exception.
*/
def apply(tp: Type)(implicit ctx: Context): Type = tp match {
private def apply(tp: Type)(implicit ctx: Context): Type = tp match {
case tp: TypeRef =>
val sym = tp.symbol
if (!sym.isClass) this(tp.info)
Expand All @@ -236,8 +257,7 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild
if (parent isRef defn.ArrayClass) eraseArray(tp)
else this(parent)
case tp: TermRef =>
assert(tp.symbol.exists, tp)
TermRef(this(tp.prefix), tp.symbol.asTerm)
this(tp.widen)
case ThisType(_) | SuperType(_, _) =>
tp
case ExprType(rt) =>
Expand Down Expand Up @@ -270,7 +290,7 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild
if ((cls eq defn.ObjectClass) || cls.isPrimitiveValueClass) Nil
else removeLaterObjects(classParents.mapConserve(eraseTypeRef))
val erasedDecls = decls.filteredScope(d => !d.isType || d.isClass)
tp.derivedClassInfo(NoPrefix, parents, erasedDecls, this(tp.selfType))
tp.derivedClassInfo(NoPrefix, parents, erasedDecls, erasedRef(tp.selfType))
// can't replace selftype by NoType because this would lose the sourceModule link
}
case NoType | NoPrefix | ErrorType | JavaArrayType(_) =>
Expand All @@ -279,7 +299,7 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild
tp
}

def eraseArray(tp: RefinedType)(implicit ctx: Context) = {
private def eraseArray(tp: RefinedType)(implicit ctx: Context) = {
val defn.ArrayType(elemtp) = tp
if (elemtp derivesFrom defn.NullClass) JavaArrayType(defn.ObjectType)
else if (isUnboundedGeneric(elemtp))
Expand Down Expand Up @@ -328,7 +348,7 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild
/** The name of the type as it is used in `Signature`s.
* Need to ensure correspondence with erasure!
*/
def sigName(tp: Type)(implicit ctx: Context): TypeName = tp match {
private def sigName(tp: Type)(implicit ctx: Context): TypeName = tp match {
case tp: TypeRef =>
val sym = tp.symbol
if (!sym.isClass) sigName(tp.info)
Expand All @@ -338,8 +358,8 @@ class TypeErasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wild
sigName(this(tp))
case JavaArrayType(elem) =>
sigName(elem) ++ "[]"
case tp: TypeBounds =>
sigName(tp.hi)
case tp: TermRef =>
sigName(tp.widen)
case ExprType(rt) =>
sigName(defn.FunctionType(Nil, rt))
case tp: TypeProxy =>
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/ast/Desugar.scala
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ object desugar {
def valDef(vdef: ValDef)(implicit ctx: Context): Tree = {
val ValDef(mods, name, tpt, rhs) = vdef
def setterNeeded =
(mods is Mutable) && ctx.owner.isClass && (!(mods is Private) || (ctx.owner is Trait))
(mods is Mutable) && ctx.owner.isClass && (!(mods is PrivateLocal) || (ctx.owner is Trait))
if (setterNeeded) {
// todo: copy of vdef as getter needed?
// val getter = ValDef(mods, name, tpt, rhs) withPos vdef.pos ?
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/ast/Trees.scala
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ object Trees {
}

class EmptyValDef[T >: Untyped] extends ValDef[T](
Modifiers[T](Private), nme.WILDCARD, genericEmptyTree[T], genericEmptyTree[T]) with WithoutTypeOrPos[T] {
Modifiers[T](PrivateLocal), nme.WILDCARD, genericEmptyTree[T], genericEmptyTree[T]) with WithoutTypeOrPos[T] {
override def isEmpty: Boolean = true
}

Expand Down
30 changes: 18 additions & 12 deletions src/dotty/tools/dotc/ast/tpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package dotty.tools
package dotc
package ast

import transform.SymUtils._
import core._
import dotty.tools.dotc.transform.TypeUtils
import util.Positions._, Types._, Contexts._, Constants._, Names._, Flags._
import SymDenotations._, Symbols._, StdNames._, Annotations._, Trees._, Symbols._
import Denotations._, Decorators._
Expand Down Expand Up @@ -44,9 +44,6 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def Apply(fn: Tree, args: List[Tree])(implicit ctx: Context): Apply =
ta.assignType(untpd.Apply(fn, args), fn, args)

def ensureApplied(fn: Tree)(implicit ctx: Context): Tree =
if (fn.tpe.widen.isParameterless) fn else Apply(fn, Nil)

def TypeApply(fn: Tree, args: List[Tree])(implicit ctx: Context): TypeApply =
ta.assignType(untpd.TypeApply(fn, args), fn, args)

Expand Down Expand Up @@ -566,13 +563,6 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {

def appliedToNone(implicit ctx: Context): Apply = appliedToArgs(Nil)

def appliedIfMethod(implicit ctx: Context): Tree = {
tree.tpe.widen match {
case fntpe: MethodType => appliedToArgs(Nil)
case _ => tree
}
}

def appliedToType(targ: Type)(implicit ctx: Context): Tree =
appliedToTypes(targ :: Nil)

Expand All @@ -582,6 +572,9 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def appliedToTypeTrees(targs: List[Tree])(implicit ctx: Context): Tree =
if (targs.isEmpty) tree else TypeApply(tree, targs)

def ensureApplied(implicit ctx: Context): Tree =
if (tree.tpe.widen.isParameterless) tree else tree.appliedToNone

def isInstance(tp: Type)(implicit ctx: Context): Tree =
tree.select(defn.Any_isInstanceOf).appliedToType(tp)

Expand All @@ -599,6 +592,19 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
def or(that: Tree)(implicit ctx: Context): Tree =
tree.select(defn.Boolean_||).appliedTo(that)

def becomes(rhs: Tree)(implicit ctx: Context): Tree =
if (tree.symbol is Method) {
val setr = tree match {
case Ident(_) =>
val setter = tree.symbol.setter
assert(setter.exists, tree.symbol.showLocated)
ref(tree.symbol.setter)
case Select(qual, _) => qual.select(tree.symbol.setter)
}
setr.appliedTo(rhs)
}
else Assign(tree, rhs)

// --- Higher order traversal methods -------------------------------

def foreachSubTree(f: Tree => Unit): Unit = { //TODO should go in tpd.
Expand All @@ -625,7 +631,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
val mname = ("to" + numericCls.name).toTermName
val conversion = tree.tpe member mname
if (conversion.symbol.exists)
ensureApplied(tree.select(conversion.symbol.termRef))
tree.select(conversion.symbol.termRef).ensureApplied
else if (tree.tpe.widen isRef numericCls)
tree
else {
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/ast/untpd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
makeConstructor(Modifiers(), Nil, Nil)

def makeSelfDef(name: TermName, tpt: Tree)(implicit ctx: Context) =
ValDef(Modifiers(Private), name, tpt, EmptyTree)
ValDef(Modifiers(PrivateLocal), name, tpt, EmptyTree)

def makeTupleOrParens(ts: List[Tree])(implicit ctx: Context) = ts match {
case t :: Nil => Parens(t)
Expand Down
2 changes: 1 addition & 1 deletion src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package core

import Types._, Contexts._, Symbols._, Denotations._, SymDenotations._, StdNames._, Names._
import Flags._, Scopes._, Decorators._, NameOps._, util.Positions._
import TypeApplications._
import pickling.UnPickler.ensureConstructor
import scala.annotation.{ switch, meta }
import scala.collection.{ mutable, immutable }
Expand Down Expand Up @@ -192,6 +191,7 @@ class Definitions {
lazy val ScalaStaticsClass = ScalaStaticsModule.moduleClass.asClass

def staticsMethod(name: PreName) = ctx.requiredMethod(ScalaStaticsClass, name)

lazy val DottyPredefModule = ctx.requiredModule("dotty.DottyPredef")
lazy val NilModule = ctx.requiredModule("scala.collection.immutable.Nil")
lazy val PredefConformsClass = ctx.requiredClass("scala.Predef." + tpnme.Conforms)
Expand Down
5 changes: 4 additions & 1 deletion src/dotty/tools/dotc/core/Flags.scala
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@ object Flags {
/** Module classes always have these flags set */
final val ModuleClassCreationFlags = ModuleClass | Final

/** Accessors always have these flags set */
final val AccessorCreationFlags = Method | Accessor

/** The flags of the self symbol */
final val SelfSymFlags = Private | Local | Deferred

Expand Down Expand Up @@ -526,7 +529,7 @@ object Flags {
final val HasDefaultParams = DefaultParameterized | InheritedDefaultParams

/** Is valid forever */
final val ValidForever = Package | Permanent
final val ValidForever = Package | Permanent | Scala2ExistentialCommon

/** Is a default parameter in Scala 2*/
final val DefaultParameter = allOf(Param, DefaultParameterized)
Expand Down
32 changes: 23 additions & 9 deletions src/dotty/tools/dotc/core/NameOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ object NameOps {
def isProtectedAccessorName = name startsWith PROTECTED_PREFIX
def isReplWrapperName = name containsSlice INTERPRETER_IMPORT_WRAPPER
def isSetterName = name endsWith SETTER_SUFFIX
def isTraitSetterName = isSetterName && (name containsSlice TRAIT_SETTER_SEPARATOR)
def isTraitSetterName = isSetterName && (name containsSlice TRAIT_SETTER_PREFIX)
def isSingletonName = name endsWith SINGLETON_SUFFIX
def isModuleClassName = name endsWith MODULE_SUFFIX
def isImportName = name startsWith IMPORT
def isFieldName = name endsWith LOCAL_SUFFIX
def isInheritedName = name.length > 0 && name.head == '(' && name.startsWith(nme.INHERITED)
def isDefaultGetterName = name.isTermName && name.asTermName.defaultGetterIndex >= 0

Expand Down Expand Up @@ -223,23 +224,36 @@ object NameOps {
implicit class TermNameDecorator(val name: TermName) extends AnyVal {
import nme._

/** The expanded setter name of `name` relative to this class `base`
*/
def expandedSetterName(base: Symbol)(implicit ctx: Context): TermName =
name.expandedName(base, separator = TRAIT_SETTER_SEPARATOR)
def traitSetterName: TermName =
nme.TRAIT_SETTER_PREFIX ++ setterName

def setterName: TermName =
if (name.isFieldName) name.fieldToGetter.setterName
else name ++ SETTER_SUFFIX

def getterName: TermName =
if (name.isFieldName) fieldToGetter
else setterToGetter

def setterName: TermName = name ++ SETTER_SUFFIX
def fieldName: TermName =
if (name.isSetterName) getterName.fieldName
else name ++ LOCAL_SUFFIX

def setterToGetter: TermName = {
val p = name.indexOfSlice(TRAIT_SETTER_SEPARATOR)
private def setterToGetter: TermName = {
val p = name.indexOfSlice(TRAIT_SETTER_PREFIX)
if (p >= 0)
(name drop (p + TRAIT_SETTER_SEPARATOR.length)).asTermName.setterToGetter
(name drop (p + TRAIT_SETTER_PREFIX.length)).asTermName.getterName
else {
assert(name.endsWith(SETTER_SUFFIX), name + " is referenced as a setter but has wrong name format")
name.take(name.length - SETTER_SUFFIX.length).asTermName
}
}

def fieldToGetter: TermName = {
assert(name.isFieldName)
name.take(name.length - LOCAL_SUFFIX.length).asTermName
}

/** Nominally, name$default$N, encoded for <init>
* @param Post the parameters position.
* @note Default getter name suffixes start at 1, so `pos` has to be adjusted by +1
Expand Down
6 changes: 4 additions & 2 deletions src/dotty/tools/dotc/core/Phases.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Denotations._
import config.Printers._
import scala.collection.mutable.{ListBuffer, ArrayBuffer}
import dotty.tools.dotc.transform.TreeTransforms.{TreeTransformer, MiniPhase, TreeTransform}
import dotty.tools.dotc.transform.{ExplicitOuter, TreeTransforms, Erasure, Flatten}
import dotty.tools.dotc.transform.{TreeTransforms, ExplicitOuter, Erasure, Flatten, GettersSetters}
import Periods._
import typer.{FrontEnd, RefChecks}
import ast.tpd
Expand Down Expand Up @@ -169,12 +169,14 @@ object Phases {
private val erasureCache = new PhaseCache(classOf[Erasure])
private val flattenCache = new PhaseCache(classOf[Flatten])
private val explicitOuterCache = new PhaseCache(classOf[ExplicitOuter])
private val gettersSettersCache = new PhaseCache(classOf[GettersSetters])

def typerPhase = typerCache.phase
def refchecksPhase = refChecksCache.phase
def erasurePhase = erasureCache.phase
def flattenPhase = flattenCache.phase
def explicitOuter = explicitOuterCache.phase
def explicitOuterPhase = explicitOuterCache.phase
def gettersSettersPhase = gettersSettersCache.phase

def isAfterTyper(phase: Phase): Boolean = phase.id > typerPhase.id
}
Expand Down
Loading