Skip to content

Commit 56a4055

Browse files
committed
Allow OverloadedSignature in TermRefs
We admit overloaded signatures in term refs.
1 parent c766aa4 commit 56a4055

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@ object Denotations {
558558
final def isType = false
559559
final def signature(implicit ctx: Context) = Signature.OverloadedSignature
560560
def atSignature(sig: Signature, site: Type, relaxed: Boolean)(implicit ctx: Context): Denotation =
561-
derivedUnionDenotation(denot1.atSignature(sig, site, relaxed), denot2.atSignature(sig, site, relaxed))
561+
if (sig eq Signature.OverloadedSignature) this
562+
else derivedUnionDenotation(denot1.atSignature(sig, site, relaxed), denot2.atSignature(sig, site, relaxed))
562563
def current(implicit ctx: Context): Denotation =
563564
derivedUnionDenotation(denot1.current, denot2.current)
564565
def altsWith(p: Symbol => Boolean): List[SingleDenotation] =

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,6 @@ object Types {
15061506
def decompose(designator: Designator): Unit = designator match {
15071507
case DerivedName(underlying, info: SignedName.SignedInfo) =>
15081508
mySig = info.sig
1509-
assert(mySig ne Signature.OverloadedSignature)
15101509
decompose(underlying)
15111510
case designator: Name =>
15121511
myName = designator.asInstanceOf[ThisName]
@@ -1702,7 +1701,7 @@ object Types {
17021701
val adapted =
17031702
if (hasFixedSym)
17041703
this
1705-
else if (signature != denot.signature && denot.signature.ne(Signature.OverloadedSignature))
1704+
else if (signature != denot.signature)
17061705
withSig(denot.signature)
17071706
else if (denot.symbol.isPrivate)
17081707
withNameSpace(denot.symbol.owner.typeRef)
@@ -1752,7 +1751,7 @@ object Types {
17521751
protected def loadDenot(implicit ctx: Context): Denotation = {
17531752
val d = asMemberOf(prefix, allowPrivate = false)
17541753
if (d.exists || ctx.phaseId == FirstPhaseId || !lastDenotation.isInstanceOf[SymDenotation])
1755-
if (mySig != null) d.atSignature(mySig).checkUnique
1754+
if (mySig != null && mySig.ne(Signature.OverloadedSignature)) d.atSignature(mySig).checkUnique
17561755
else d
17571756
else { // name has changed; try load in earlier phase and make current
17581757
val d = loadDenot(ctx.withPhase(ctx.phaseId - 1)).current

0 commit comments

Comments
 (0)