Skip to content

Commit 11efb82

Browse files
committed
Create OverloadedSymbol and OverloadedDenotation
Will be needed to represent overloaded TermRefs
1 parent 286aa4d commit 11efb82

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,18 +1848,21 @@ object SymDenotations {
18481848
}
18491849
}
18501850

1851-
class NoDenotation extends SymDenotation(
1852-
NoSymbol, NoSymbol, "<none>".toTermName, Permanent, NoType) {
1851+
class NoDenotation(sym: Symbol, name: Name, override val isTerm: Boolean)
1852+
extends SymDenotation(sym, NoSymbol, name, Permanent, NoType) {
18531853
override def exists = false
1854-
override def isTerm = false
18551854
override def isType = false
18561855
override def owner: Symbol = throw new AssertionError("NoDenotation.owner")
18571856
override def computeAsSeenFrom(pre: Type)(implicit ctx: Context): SingleDenotation = this
18581857
override def mapInfo(f: Type => Type)(implicit ctx: Context): SingleDenotation = this
18591858
validFor = Period.allInRun(NoRunId)
18601859
}
18611860

1862-
@sharable val NoDenotation = new NoDenotation
1861+
@sharable val NoDenotation =
1862+
new NoDenotation(NoSymbol, "<none>".toTermName, isTerm = false)
1863+
1864+
@sharable val OverloadedDenotation =
1865+
new NoDenotation(OverloadedSymbol, "<overloaded>".toTermName, isTerm = true)
18631866

18641867
// ---- Completion --------------------------------------------------------
18651868

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,12 +643,20 @@ object Symbols {
643643
denot = underlying.denot
644644
}
645645

646-
@sharable object NoSymbol extends Symbol(NoCoord, 0) {
647-
denot = NoDenotation
646+
class NonExistingSymbol extends Symbol(NoCoord, 0) {
648647
override def associatedFile(implicit ctx: Context): AbstractFile = NoSource.file
649648
override def recomputeDenot(lastd: SymDenotation)(implicit ctx: Context): SymDenotation = NoDenotation
650649
}
651650

651+
@sharable object NoSymbol extends NonExistingSymbol {
652+
denot = NoDenotation
653+
}
654+
655+
@sharable object OverloadedSymbol extends NonExistingSymbol {
656+
denot = OverloadedDenotation
657+
type ThisName = TermName
658+
}
659+
652660
implicit class Copier[N <: Name](sym: Symbol { type ThisName = N })(implicit ctx: Context) {
653661
/** Copy a symbol, overriding selective fields */
654662
def copy(

0 commit comments

Comments
 (0)