Skip to content

Fix #810: initialization of inner objects of traits. #811

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

Merged
merged 5 commits into from
Oct 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ object PickleBuffer {
FINAL_PKL -> Final,
METHOD_PKL -> Method,
INTERFACE_PKL -> NoInitsInterface,
MODULE_PKL -> Module,
MODULE_PKL -> (Module | Lazy, Module),
IMPLICIT_PKL -> Implicit,
SEALED_PKL -> Sealed,
CASE_PKL -> Case,
Expand Down
6 changes: 3 additions & 3 deletions src/dotty/tools/dotc/transform/ExplicitOuter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ class ExplicitOuter extends MiniPhaseTransform with InfoTransformer { thisTransf
object ExplicitOuter {
import ast.tpd._

private val LocalInstantiationSite = Module | Private

/** Ensure that class `cls` has outer accessors */
def ensureOuterAccessors(cls: ClassSymbol)(implicit ctx: Context): Unit = {
//todo: implementing #165 would simplify this logic
Expand Down Expand Up @@ -176,7 +174,9 @@ object ExplicitOuter {

/** Class is always instantiated in the compilation unit where it is defined */
private def hasLocalInstantiation(cls: ClassSymbol)(implicit ctx: Context): Boolean =
cls.owner.isTerm || cls.is(LocalInstantiationSite)
// scala2x modules always take an outer pointer(as of 2.11)
// dotty modules are always locally instantiated
cls.owner.isTerm || cls.is(Private) || cls.is(Module, butNot = Scala2x)

/** The outer parameter accessor of cass `cls` */
private def outerParamAccessor(cls: ClassSymbol)(implicit ctx: Context): TermSymbol =
Expand Down
4 changes: 3 additions & 1 deletion src/dotty/tools/dotc/transform/Mixin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
val rhs =
if (ctx.atPhase(thisTransform)(implicit ctx => getter.is(ParamAccessor))) nextArgument()
else if (isScala2x)
if (getter.is(Lazy)) lazyGetterCall
if (getter.is(Lazy, butNot = Module)) lazyGetterCall
else if (getter.is(Module))
New(getter.info.resultType, List(This(cls)))
else Underscore(getter.info.resultType)
else transformFollowing(superRef(initializer(getter)).appliedToNone)
// transformFollowing call is needed to make memoize & lazy vals run
Expand Down
2 changes: 0 additions & 2 deletions src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ import util.Stats.{track, record}
import config.Printers._
import language.implicitConversions

trait TyperContextOps { ctx: Context => }

object Typer {

/** The precedence of bindings which determines which of several bindings will be
Expand Down