Skip to content

Commit c3be42e

Browse files
committed
Change treatment of signatures in TermRefs
- don't compute members when unpickling termrefs, it caused cyclic reference errors on tasty-bootstrap. - to make this robust, have currentSignature in TermRef return a NotAMethof if not symbol or denotation is known.
1 parent 49b78c3 commit c3be42e

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1535,6 +1535,10 @@ object Types {
15351535
else symbol.asSeenFrom(prefix).signature
15361536
}
15371537

1538+
/** The signature of the current denotation if it is known without forcing.
1539+
* Otherwise the signature of the current symbol if it is known without forcing.
1540+
* Otherwise NotAMethod.
1541+
*/
15381542
private def currentSignature(implicit ctx: Context): Signature =
15391543
if (mySig != null) mySig
15401544
else {
@@ -1543,7 +1547,7 @@ object Types {
15431547
else {
15441548
val sym = currentSymbol
15451549
if (sym.exists) sym.asSeenFrom(prefix).signature
1546-
else null
1550+
else Signature.NotAMethod
15471551
}
15481552
}
15491553

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -296,22 +296,16 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi
296296
readPackageRef().termRef
297297
case TYPEREF =>
298298
val name = readName().toTypeName
299-
if (Config.newScheme) {
300-
val prefix = readType()
301-
TypeRef(prefix, name, prefix.member(name))
302-
}
303-
else TypeRef(readType(), name)
299+
TypeRef(readType(), name)
304300
case TERMREF =>
305301
val sname = readName()
306302
val prefix = readType()
307-
if (Config.newScheme)
308-
sname match {
309-
case SignedName(name, sig) =>
310-
TermRef(prefix, name, prefix.member(name).atSignature(sig))
311-
case name =>
312-
TermRef(prefix, name, prefix.member(name))
313-
}
314-
else TermRef(prefix, sname)
303+
sname match {
304+
case SignedName(name, sig) =>
305+
TermRef(prefix, name, prefix.member(name).atSignature(sig))
306+
case name =>
307+
TermRef(prefix, name)
308+
}
315309
case THIS =>
316310
ThisType.raw(readType().asInstanceOf[TypeRef])
317311
case RECtype =>

0 commit comments

Comments
 (0)