Skip to content

Commit db35474

Browse files
committed
Address reviewer comments #811.
1 parent a5db9c7 commit db35474

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

src/dotty/tools/dotc/core/unpickleScala2/PickleBuffer.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ object PickleBuffer {
221221
FINAL_PKL -> Final,
222222
METHOD_PKL -> Method,
223223
INTERFACE_PKL -> NoInitsInterface,
224-
MODULE_PKL -> Module,
224+
MODULE_PKL -> (Module | Lazy, Module),
225225
IMPLICIT_PKL -> Implicit,
226226
SEALED_PKL -> Sealed,
227227
CASE_PKL -> Case,
@@ -287,16 +287,13 @@ object PickleBuffer {
287287
val shift = ChunkBits
288288
val mask = ChunkSize - 1
289289
assert(6 * ChunkBits == ScalaFlagEnd)
290-
val t = FlagSet(
290+
FlagSet(
291291
map(0)((sflags >>> (shift * 0)).toInt & mask) |
292292
map(1)((sflags >>> (shift * 1)).toInt & mask) |
293293
map(2)((sflags >>> (shift * 2)).toInt & mask) |
294294
map(3)((sflags >>> (shift * 3)).toInt & mask) |
295295
map(4)((sflags >>> (shift * 4)).toInt & mask) |
296296
map(5)((sflags >>> (shift * 5)).toInt & mask)
297297
)
298-
if (!isType && t.is(Module, Lazy))
299-
t | Lazy // scala2 modules do not always set lazy flag. Dotty modules do
300-
else t
301298
}
302299
}

src/dotty/tools/dotc/transform/ExplicitOuter.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ object ExplicitOuter {
175175
/** Class is always instantiated in the compilation unit where it is defined */
176176
private def hasLocalInstantiation(cls: ClassSymbol)(implicit ctx: Context): Boolean =
177177
// scala2x modules always take an outer pointer(as of 2.11)
178-
cls.owner.isTerm || cls.is(Private) || cls.is(Module, Scala2x)
178+
// dotty modules are always locally instantiated
179+
cls.owner.isTerm || cls.is(Private) || cls.is(Module, butNot = Scala2x)
179180

180181
/** The outer parameter accessor of cass `cls` */
181182
private def outerParamAccessor(cls: ClassSymbol)(implicit ctx: Context): TermSymbol =

src/dotty/tools/dotc/transform/Mixin.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ class Mixin extends MiniPhaseTransform with SymTransformer { thisTransform =>
216216
val rhs =
217217
if (ctx.atPhase(thisTransform)(implicit ctx => getter.is(ParamAccessor))) nextArgument()
218218
else if (isScala2x)
219-
if (getter.is(Lazy, Module)) lazyGetterCall
219+
if (getter.is(Lazy, butNot = Module)) lazyGetterCall
220220
else if (getter.is(Module))
221221
New(getter.info.resultType, List(This(cls)))
222222
else Underscore(getter.info.resultType)

0 commit comments

Comments
 (0)