Skip to content

Commit e6a2f35

Browse files
committed
Revert TastyFormat changes
Instead use a hack to convert the Into flag into the $into annotation for pickling. This means we can merge the scheme without waiting for the next minor version. When the scheme is stabilized we should revert this commit again to get the cleaner treatment where the Into fag maps to the INTO tag.
1 parent 689062a commit e6a2f35

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,9 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
852852
if (flags.is(ParamAccessor) && sym.isTerm && !sym.isSetter)
853853
flags = flags &~ ParamAccessor // we only generate a tag for parameter setters
854854
pickleFlags(flags, sym.isTerm)
855+
if flags.is(Into) then
856+
// Temporary measure until we can change TastyFormat to include an INTO tag
857+
pickleAnnotation(sym, mdef, Annotation(defn.SilentIntoAnnot, util.Spans.NoSpan))
855858
val annots = sym.annotations.foreach(pickleAnnotation(sym, mdef, _))
856859
}
857860

@@ -905,7 +908,6 @@ class TreePickler(pickler: TastyPickler, attributes: Attributes) {
905908
if (flags.is(Contravariant)) writeModTag(CONTRAVARIANT)
906909
if (flags.is(Opaque)) writeModTag(OPAQUE)
907910
if (flags.is(Open)) writeModTag(OPEN)
908-
if (flags.is(Into)) writeModTag(INTO)
909911
}
910912
}
911913

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

+5-2
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,11 @@ class TreeUnpickler(reader: TastyReader,
667667
}
668668
val annotOwner =
669669
if sym.owner.isClass then newLocalDummy(sym.owner) else sym.owner
670-
val annots = annotFns.map(_(annotOwner))
670+
var annots = annotFns.map(_(annotOwner))
671+
if annots.exists(_.symbol == defn.SilentIntoAnnot) then
672+
// Temporary measure until we can change TastyFormat to include an INTO tag
673+
sym.setFlag(Into)
674+
annots = annots.filterNot(_.symbol == defn.SilentIntoAnnot)
671675
sym.annotations = annots
672676
if sym.isOpaqueAlias then sym.setFlag(Deferred)
673677
val isScala2MacroDefinedInScala3 = flags.is(Macro, butNot = Inline) && flags.is(Erased)
@@ -758,7 +762,6 @@ class TreeUnpickler(reader: TastyReader,
758762
case TRANSPARENT => addFlag(Transparent)
759763
case INFIX => addFlag(Infix)
760764
case TRACKED => addFlag(Tracked)
761-
case INTO => addFlag(Into)
762765
case PRIVATEqualified =>
763766
readByte()
764767
privateWithin = readWithin

tasty/src/dotty/tools/tasty/TastyFormat.scala

+1-6
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ Standard-Section: "ASTs" TopLevelStat*
229229
OPEN -- an open class
230230
INVISIBLE -- invisible during typechecking, except when resolving from TASTy
231231
TRACKED -- a tracked class parameter / a dependent class
232-
INTO -- a trait or class declared with `into`
233232
Annotation
234233
235234
Variance = STABLE -- invariant
@@ -512,7 +511,6 @@ object TastyFormat {
512511
final val EMPTYCLAUSE = 45
513512
final val SPLITCLAUSE = 46
514513
final val TRACKED = 47
515-
final val INTO = 48
516514

517515
// Tree Cat. 2: tag Nat
518516
final val firstNatTreeTag = SHAREDterm
@@ -705,8 +703,7 @@ object TastyFormat {
705703
| ANNOTATION
706704
| PRIVATEqualified
707705
| PROTECTEDqualified
708-
| TRACKED
709-
| INTO => true
706+
| TRACKED => true
710707
case _ => false
711708
}
712709

@@ -766,8 +763,6 @@ object TastyFormat {
766763
case PARAMsetter => "PARAMsetter"
767764
case EXPORTED => "EXPORTED"
768765
case OPEN => "OPEN"
769-
case INTO => "INTO"
770-
case TRACKED => "TRACKED"
771766
case INVISIBLE => "INVISIBLE"
772767
case PARAMalias => "PARAMalias"
773768
case EMPTYCLAUSE => "EMPTYCLAUSE"

0 commit comments

Comments
 (0)