Skip to content

Commit 8035a85

Browse files
Revert "Add test of pickling positions under -Ytest-pickler"
This reverts commit ed7aeeb. Conflicts: src/dotty/tools/dotc/transform/Pickler.scala
1 parent 9ae51b7 commit 8035a85

File tree

4 files changed

+11
-25
lines changed

4 files changed

+11
-25
lines changed

src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ class ScalaSettings extends Settings.SettingGroup {
164164
val YforceSbtPhases = BooleanSetting("-Yforce-sbt-phases", "Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging.")
165165
val YdumpSbtInc = BooleanSetting("-Ydump-sbt-inc", "For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases.")
166166
val YcheckAllPatmat = BooleanSetting("-Ycheck-all-patmat", "Check exhaustivity and redundancy of all pattern matching (used for testing the algorithm)")
167+
def stop = YstopAfter
167168

168169
/** Area-specific debug output.
169170
*/

src/dotty/tools/dotc/core/Phases.scala

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,8 @@ object Phases {
7979
* Each TreeTransform gets own period,
8080
* whereas a combined TreeTransformer gets period equal to union of periods of it's TreeTransforms
8181
*/
82-
def squashPhases(
83-
phasess: List[List[Phase]],
84-
phasesToSkip: List[String],
85-
stopBeforePhases: List[String],
86-
stopAfterPhases: List[String],
87-
YCheckAfter: List[String]
88-
): List[Phase] = {
82+
def squashPhases(phasess: List[List[Phase]],
83+
phasesToSkip: List[String], stopBeforePhases: List[String], stopAfterPhases: List[String], YCheckAfter: List[String]): List[Phase] = {
8984
val squashedPhases = ListBuffer[Phase]()
9085
var prevPhases: Set[Class[_ <: Phase]] = Set.empty
9186
val YCheckAll = YCheckAfter.contains("all")

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

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import Phases._
1212
import Symbols._
1313
import Flags.Module
1414
import collection.mutable
15-
import util.Positions.Position
1615

1716
/** This phase pickles trees */
1817
class Pickler extends Phase {
@@ -26,7 +25,7 @@ class Pickler extends Phase {
2625
s.close
2726
}
2827

29-
private val beforePickling = new mutable.HashMap[ClassSymbol, (String, Position)]
28+
private val beforePickling = new mutable.HashMap[ClassSymbol, String]
3029

3130
/** Drop any elements of this list that are linked module classes of other elements in the list */
3231
private def dropCompanionModuleClasses(clss: List[ClassSymbol])(implicit ctx: Context): List[ClassSymbol] = {
@@ -41,7 +40,7 @@ class Pickler extends Phase {
4140

4241
for { cls <- dropCompanionModuleClasses(topLevelClasses(unit.tpdTree))
4342
tree <- sliceTopLevel(unit.tpdTree, cls) } {
44-
if (ctx.settings.YtestPickler.value) beforePickling(cls) = (tree.show, tree.pos)
43+
if (ctx.settings.YtestPickler.value) beforePickling(cls) = tree.show
4544
val pickler = new TastyPickler()
4645
unit.picklers += (cls -> pickler)
4746
val treePkl = pickler.treePkl
@@ -74,34 +73,25 @@ class Pickler extends Phase {
7473
private def testUnpickler(units: List[CompilationUnit])(implicit ctx: Context): Unit = {
7574
pickling.println(i"testing unpickler at run ${ctx.runId}")
7675
ctx.initialize()
77-
val unpicklers: List[(ClassSymbol, DottyUnpickler)] =
76+
val unpicklers =
7877
for (unit <- units; (cls, pickler) <- unit.picklers) yield {
7978
val unpickler = new DottyUnpickler(pickler.assembleParts())
8079
unpickler.enter(roots = Set())
8180
cls -> unpickler
8281
}
83-
pickling.println("*********** Entered toplevel ***********")
82+
pickling.println("************* entered toplevel ***********")
8483
for ((cls, unpickler) <- unpicklers) {
85-
val ((unpickled: Tree) :: Nil) = unpickler.body(ctx.addMode(Mode.ReadPositions))
86-
val (beforeShow, beforePos) = beforePickling(cls)
87-
testSameShow(unpickled.show, beforeShow, cls)
88-
testSamePos(unpickled.pos, beforePos, cls)
84+
val unpickled = unpickler.body(ctx.addMode(Mode.ReadPositions))
85+
testSame(i"$unpickled%\n%", beforePickling(cls), cls)
8986
}
9087
}
9188

92-
private def testSameShow(unpickled: String, previous: String, cls: ClassSymbol)(implicit ctx: Context): Unit =
89+
private def testSame(unpickled: String, previous: String, cls: ClassSymbol)(implicit ctx: Context) =
9390
if (previous != unpickled) {
9491
output("before-pickling.txt", previous)
9592
output("after-pickling.txt", unpickled)
9693
ctx.error(i"""pickling difference for ${cls.fullName} in ${cls.sourceFile}, for details:
9794
|
9895
| diff before-pickling.txt after-pickling.txt""")
9996
}
100-
101-
// Ignoring Position#point which are not pickled.
102-
private def testSamePos(unpickled: Position, previous: Position, cls: ClassSymbol)(implicit ctx: Context): Unit =
103-
if (unpickled.start != previous.start || unpickled.end != previous.end) {
104-
ctx.error(i"""pickling difference in ${cls.fullName} in ${cls.sourceFile} positions:
105-
|previous positions $previous unpickled as $unpickled""")
106-
}
10797
}

src/dotty/tools/dotc/util/Positions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import language.implicitConversions
1212
object Positions {
1313

1414
private val StartEndBits = 26
15-
val StartEndMask: Long = (1L << StartEndBits) - 1
15+
val StartEndMask: Long = (1L << StartEndBits) - 1
1616
private val SyntheticPointDelta = (1 << (64 - StartEndBits * 2)) - 1
1717

1818
/** The maximal representable offset in a position */

0 commit comments

Comments
 (0)