final object ExplicitOuter

Constructors

Members

[+] final class OuterOps

The operations in this class - add outer parameters - pass outer arguments to these parameters - replace outer this references by outer paths. They are ca...

The operations in this class - add outer parameters - pass outer arguments to these parameters - replace outer this references by outer paths. They are called from erasure. There are two constraints which suggest these operations should be done in erasure. - Replacing this references with outer paths loses aliasing information, so programs will not typecheck with unerased types unless a lot of type refinements are added. Therefore, outer paths should be computed no earlier than erasure. - outer parameters should not show up in signatures, so again they cannot be added before erasure. - outer arguments need access to outer parameters as well as to the original type prefixes of types in New expressions. These prefixes get erased during erasure. Therefore, outer arguments have to be passed no later than erasure.

[+] final object OuterOps

The operations in this class - add outer parameters - pass outer arguments to these parameters - replace outer this references by outer paths. They are ca...

The operations in this class - add outer parameters - pass outer arguments to these parameters - replace outer this references by outer paths. They are called from erasure. There are two constraints which suggest these operations should be done in erasure. - Replacing this references with outer paths loses aliasing information, so programs will not typecheck with unerased types unless a lot of type refinements are added. Therefore, outer paths should be computed no earlier than erasure. - outer parameters should not show up in signatures, so again they cannot be added before erasure. - outer arguments need access to outer parameters as well as to the original type prefixes of types in New expressions. These prefixes get erased during erasure. Therefore, outer arguments have to be passed no later than erasure.

private final val Hoistable : FlagSet
def ensureOuterAccessors ( cls: ClassSymbol ) ( implicit ctx: Context ) : Unit

Ensure that class cls has outer accessors

Ensure that class cls has outer accessors

[+] private def fixThis ( tpe: Type ) ( implicit ctx: Context ) : Type

It's possible (i1755.scala gives an example) that the type given by outerPrefix contains a This-reference to a module outside the context where that mod...

It's possible (i1755.scala gives an example) that the type given by outerPrefix contains a This-reference to a module outside the context where that module is defined. This needs to be translated to an access to the module object from the enclosing class or object.

This solution is a bit of a hack; it would be better to avoid such references to the This of a module from outside the module in the first place. I was not yet able to find out how such references arise and how to avoid them.

private def hasLocalInstantiation ( cls: ClassSymbol ) ( implicit ctx: Context ) : Boolean

Class is always instantiated in the compilation unit where it is defined

Class is always instantiated in the compilation unit where it is defined

private def hasOuter ( cls: ClassSymbol ) ( implicit ctx: Context ) : Boolean

Class has an outer accessor. Can be called only after phase ExplicitOuter.

Class has an outer accessor. Can be called only after phase ExplicitOuter.

private def hasOuterParam ( cls: ClassSymbol ) ( implicit ctx: Context ) : Boolean

Class constructor takes an outer argument. Can be called only after phase ExplicitOuter.

Class constructor takes an outer argument. Can be called only after phase ExplicitOuter.

[+] private def needsOuterAlways ( cls: ClassSymbol ) ( implicit ctx: Context ) : Boolean

Class unconditionally needs an outer pointer. This is the case if the class needs an outer pointer if referenced and one of the following holds: - we mi...

Class unconditionally needs an outer pointer. This is the case if the class needs an outer pointer if referenced and one of the following holds: - we might not know at all instantiation sites whether outer is referenced or not - we need to potentially pass along outer to a parent class or trait

def needsOuterIfReferenced ( cls: ClassSymbol ) ( implicit ctx: Context ) : Boolean

Class needs an outer pointer, provided there is a reference to an outer this in it.

Class needs an outer pointer, provided there is a reference to an outer this in it.

private def newOuterAccessor ( owner: ClassSymbol , cls: ClassSymbol ) ( implicit ctx: Context ) : Symbol

A new outer accessor for class cls which is a member of owner

A new outer accessor for class cls which is a member of owner

private def newOuterAccessors ( cls: ClassSymbol ) ( implicit ctx: Context ) : List [ Symbol ]

The outer accessor and potentially outer param accessor needed for class cls

The outer accessor and potentially outer param accessor needed for class cls

private def newOuterParamAccessor ( cls: ClassSymbol ) ( implicit ctx: Context ) : Symbol

A new param accessor for the outer field in class cls

A new param accessor for the outer field in class cls

private def newOuterSym ( owner: ClassSymbol , cls: ClassSymbol , name: TermName , flags: FlagSet ) ( implicit ctx: Context ) : Symbol

A new outer accessor or param accessor

A new outer accessor or param accessor

def outer ( implicit ctx: Context ) : OuterOps
private def outerAccName ( cls: ClassSymbol ) ( implicit ctx: Context ) : TermName
[+] def outerAccessor ( cls: ClassSymbol ) ( implicit ctx: Context ) : Symbol

The outer accessor of class cls. To find it is a bit tricky. The class might have been moved with new owners between ExplicitOuter and Erasure, where th...

The outer accessor of class cls. To find it is a bit tricky. The class might have been moved with new owners between ExplicitOuter and Erasure, where the method is also called. For instance, it might have been part of a by-name argument, and therefore be moved under a closure method by ElimByName. In that case looking up the method again at Erasure with the fully qualified name outerAccName will fail, because the outerAccName's result is phase dependent. In that case we use a backup strategy where we search all definitions in the class to find the one with the OuterAccessor flag.

private def outerParamAccessor ( cls: ClassSymbol ) ( implicit ctx: Context ) : TermSymbol

The outer parameter accessor of cass cls

The outer parameter accessor of cass cls

private def outerPrefix ( tpe: Type ) ( implicit ctx: Context ) : Type

The outer prefix implied by type tpe

The outer prefix implied by type tpe

def referencesOuter ( cls: Symbol , tree: Tree ) ( implicit ctx: Context ) : Boolean

Tree references an outer class of cls which is not a static owner.

Tree references an outer class of cls which is not a static owner.