Skip to content

Commit 77e2925

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 a754f24 commit 77e2925

File tree

5 files changed

+8
-65
lines changed

5 files changed

+8
-65
lines changed

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

-1
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

+2-6
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

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

@@ -1310,4 +1314,3 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
13101314
errorBadSignature("expected an TypeDef (" + other + ")")
13111315
}
13121316
}
1313-

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

-54
This file was deleted.

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

-1
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)