Skip to content

Commit 7276641

Browse files
committed
Integrate the remaining job of AugmentScala2Traits into Scala2Unpickler.
This allows to entirely get rid of the phase as well as the `Scala2xAugmented` flag.
1 parent 4432244 commit 7276641

File tree

5 files changed

+8
-65
lines changed

5 files changed

+8
-65
lines changed

compiler/src/dotty/tools/dotc/Compiler.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ class Compiler {
8686
new LiftTry, // Put try expressions that might execute on non-empty stacks into their own methods
8787
new CollectNullableFields, // Collect fields that can be nulled out after use in lazy initialization
8888
new ElimOuterSelect, // Expand outer selections
89-
new AugmentScala2Traits, // Augments Scala2 traits so that super accessors are made non-private
9089
new ResolveSuper, // Implement super accessors
9190
new FunctionXXLForwarders, // Add forwarders for FunctionXXL apply method
9291
new ParamForwarding, // Add forwarders for aliases of superclass parameters

compiler/src/dotty/tools/dotc/core/Flags.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,8 @@ object Flags {
378378
/** Children were queried on this class */
379379
val (_, _, ChildrenQueried @ _) = newFlags(56, "<children-queried>")
380380

381-
/** A module variable (Scala 2.x only)
382-
* /
383-
* A Scala 2.x trait that has been augmented.
384-
* This is set in `AugmentScala2Trait` when the trait is augmented.
385-
*/
386-
val (_, Scala2ModuleVar @ _, Scala2xAugmented @ _) = newFlags(57, "<modulevar>", "<scala-2.x-augmented>")
381+
/** A module variable (Scala 2.x only) */
382+
val (_, Scala2ModuleVar @ _, _) = newFlags(57, "<modulevar>")
387383

388384
/** A macro */
389385
val (Macro @ _, _, _) = newFlags(58, "<macro>")

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,12 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
455455
flags = flags &~ Scala2ExpandedName
456456
}
457457
if (flags.is(Scala2SuperAccessor)) {
458-
name = name.asTermName.unmangle(SuperAccessorName)
459-
flags = flags &~ Scala2SuperAccessor
458+
/* Scala 2 super accessors are pickled as private, but are compiled as public expanded.
459+
* Dotty super accessors, however, are already pickled as public expanded.
460+
* We bridge the gap right now.
461+
*/
462+
name = name.asTermName.unmangle(SuperAccessorName).expandedName(owner)
463+
flags = flags &~ (Scala2SuperAccessor | Private)
460464
}
461465
name = name.mapLast(_.decode)
462466

@@ -1308,4 +1312,3 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
13081312
errorBadSignature("expected an TypeDef (" + other + ")")
13091313
}
13101314
}
1311-

compiler/src/dotty/tools/dotc/transform/AugmentScala2Traits.scala

Lines changed: 0 additions & 54 deletions
This file was deleted.

compiler/src/dotty/tools/dotc/transform/ResolveSuper.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class ResolveSuper extends MiniPhase with IdentityDenotTransformer { thisPhase =
3434
override def phaseName: String = ResolveSuper.name
3535

3636
override def runsAfter: Set[String] = Set(ElimByName.name, // verified empirically, need to figure out what the reason is.
37-
AugmentScala2Traits.name,
3837
PruneErasedDefs.name) // Erased decls make `isCurrent` work incorrectly
3938

4039
override def changesMembers: Boolean = true // the phase adds super accessors

0 commit comments

Comments
 (0)