Skip to content

Commit 81f5c30

Browse files
committed
Use symbol signature also for TERMREFin
1 parent 51ebf70 commit 81f5c30

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,22 +174,20 @@ class TreePickler(pickler: TastyPickler) {
174174
case tpe: NamedType =>
175175
val sym = tpe.symbol
176176
def pickleExternalRef(sym: Symbol) = {
177-
def pickleCore() = {
178-
pickleNameAndSig(sym.name, tpe.signature)
179-
pickleType(tpe.prefix)
180-
}
181177
val isShadowedRef =
182178
sym.isClass && tpe.prefix.member(sym.name).symbol != sym
183179
if (sym.is(Flags.Private) || isShadowedRef) {
184180
writeByte(if (tpe.isType) TYPEREFin else TERMREFin)
185181
withLength {
186-
pickleCore()
182+
pickleNameAndSig(sym.name, tpe.symbol.signature)
183+
pickleType(tpe.prefix)
187184
pickleType(sym.owner.typeRef)
188185
}
189186
}
190187
else {
191188
writeByte(if (tpe.isType) TYPEREF else TERMREF)
192-
pickleCore()
189+
pickleNameAndSig(sym.name, tpe.signature)
190+
pickleType(tpe.prefix)
193191
}
194192
}
195193
if (sym.is(Flags.Package)) {

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,12 @@ class TreeUnpickler(reader: TastyReader,
331331
case TERMREFin =>
332332
var sname = readName()
333333
val prefix = readType()
334-
val space = readType()
334+
val owner = readType()
335335
sname match {
336336
case SignedName(name, sig) =>
337-
TermRef(prefix, name, space.decl(name).asSeenFrom(prefix).atSignature(sig))
337+
TermRef(prefix, name, owner.decl(name).atSignature(sig).asSeenFrom(prefix))
338338
case name =>
339-
TermRef(prefix, name, space.decl(name).asSeenFrom(prefix))
339+
TermRef(prefix, name, owner.decl(name).asSeenFrom(prefix))
340340
}
341341
case TYPEREFin =>
342342
val name = readName().toTypeName

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ Standard-Section: "ASTs" TopLevelStat*
123123
TERMREFsymbol sym_ASTRef qual_Type -- A reference `qual.sym` to a local member with prefix `qual`
124124
TERMREFpkg fullyQualified_NameRef -- A reference to a package member with given fully qualified name
125125
TERMREF possiblySigned_NameRef qual_Type -- A reference `qual.name` to a non-local member
126-
TERMREFin Length possiblySigned_NameRef qual_Type namespace_Type -- A reference `qual.name` to a non-local member that's private in `namespace`
126+
TERMREFin Length possiblySigned_NameRef qual_Type owner_Type -- A reference `qual.name` referring to a non-local symbol declared in owner that has the given signature (see note below)
127127
THIS clsRef_Type -- cls.this
128128
RECthis recType_ASTRef -- The `this` in a recursive refined type `recType`.
129129
SHAREDtype path_ASTRef -- link to previously serialized path
@@ -213,9 +213,9 @@ Standard-Section: "ASTs" TopLevelStat*
213213
214214
Annotation = ANNOTATION Length tycon_Type fullAnnotation_Term -- An annotation, given (class) type of constructor, and full application tree
215215
216-
Note: The signature of a SELECTin node is the signature of the selected symbol, not
217-
the signature of the reference. The latter undergoes an asSeenFrom but the former
218-
does not. TODO: Also use symbol signatures in TERMREFin
216+
Note: The signature of a SELECTin or TERMREFin node is the signature of the selected symbol,
217+
not the signature of the reference. The latter undergoes an asSeenFrom but the former
218+
does not.
219219
220220
Note: Tree tags are grouped into 5 categories that determine what follows, and thus allow to compute the size of the tagged tree in a generic way.
221221
@@ -253,7 +253,7 @@ Standard Section: "Comments" Comment*
253253
object TastyFormat {
254254

255255
final val header: Array[Int] = Array(0x5C, 0xA1, 0xAB, 0x1F)
256-
val MajorVersion: Int = 22
256+
val MajorVersion: Int = 23
257257
val MinorVersion: Int = 0
258258

259259
/** Tags used to serialize names, should update [[nameTagToString]] if a new constant is added */

0 commit comments

Comments
 (0)