Skip to content

Commit f7a81e2

Browse files
committed
Allow for late initialization of names
Needed because we sometimes form NamedTypes with naked symbols.
1 parent 4d7a736 commit f7a81e2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ object Types {
15041504

15051505
def designatorName: Name = designator.asInstanceOf[Name] // ### todo: remove
15061506

1507-
private[dotc] def init()(implicit ctx: Context): this.type = {
1507+
private[dotc] def init(givenName: Name)(implicit ctx: Context): this.type = {
15081508
(designator: Designator) match { // dotty shortcoming: need the upcast
15091509
case DerivedName(underlying, info: SignedName.SignedInfo) =>
15101510
myName = underlying.asInstanceOf[ThisName]
@@ -1513,8 +1513,7 @@ object Types {
15131513
case designator: Name =>
15141514
myName = designator.asInstanceOf[ThisName]
15151515
case designator: Symbol =>
1516-
assert(designator.exists)
1517-
myName = designator.name.asInstanceOf[ThisName]
1516+
myName = givenName.asInstanceOf[ThisName]
15181517
uncheckedSetSym(designator)
15191518
}
15201519
this

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ object Uniques {
5858
def newType = {
5959
if (designator.isType) new CachedTypeRef(prefix, designator.asType, h)
6060
else new CachedTermRef(prefix, designator.asTerm, h)
61-
}.init()
61+
}.init(null)
6262
if (h == NotCached) newType
6363
else {
6464
val r = findPrevious(h, prefix, designator)
@@ -85,7 +85,7 @@ object Uniques {
8585
def newType = {
8686
if (name.isTypeName) new TypeRefWithFixedSym(prefix, name.asTypeName, sym.asInstanceOf[TypeSymbol], h)
8787
else new TermRefWithFixedSym(prefix, name.asTermName, sym.asInstanceOf[TermSymbol], h)
88-
}.init()
88+
}.init(name)
8989
if (h == NotCached) newType
9090
else {
9191
val r = findPrevious(h, prefix, sym)

0 commit comments

Comments
 (0)