diff options
Diffstat (limited to 'src/dotty/tools/dotc/core')
-rw-r--r-- | src/dotty/tools/dotc/core/Denotations.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Scopes.scala | 6 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 16 |
3 files changed, 16 insertions, 10 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala index 045f74300..4ab911160 100644 --- a/src/dotty/tools/dotc/core/Denotations.scala +++ b/src/dotty/tools/dotc/core/Denotations.scala @@ -8,7 +8,7 @@ import Names.{Name, PreName} import Names.TypeName import Symbols.NoSymbol import Symbols._ -import Types._, Periods._, Flags._, Transformers._ +import Types._, Periods._, Flags._, Transformers._, Decorators._ import printing.Texts._ import printing.Printer import io.AbstractFile @@ -85,6 +85,8 @@ object Denotations { */ val NotAMethod: Signature = List(Names.EmptyTypeName) + val UnknownSignature: Signature = List(" ".toTypeName) + /** A denotation is the result of resolving * a name (either simple identifier or select) during a given period. * diff --git a/src/dotty/tools/dotc/core/Scopes.scala b/src/dotty/tools/dotc/core/Scopes.scala index bd67801e1..46cbee99d 100644 --- a/src/dotty/tools/dotc/core/Scopes.scala +++ b/src/dotty/tools/dotc/core/Scopes.scala @@ -292,8 +292,10 @@ object Scopes { var irefs = new ListBuffer[TermRef] var e = lastEntry while (e ne null) { - if (e.sym is Implicit) - irefs += TermRef.withSym(NoPrefix, e.sym.asTerm).withDenot(e.sym.denot) + if (e.sym is Implicit) { + val d = e.sym.denot + irefs += TermRef.withSig(NoPrefix, e.sym.asTerm.name, d.signature).withDenot(e.sym.denot) + } e = e.prev } irefs.toList diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index efd8f3594..ba8b4f139 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -528,7 +528,7 @@ object Types { memberNames(implicitFilter).toList .flatMap(name => member(name) .altsWith(_ is Implicit) - .map(d => TermRef.withSym(this, d.symbol.asTerm).withDenot(d))) + .map(d => TermRef.withSig(this, d.symbol.asTerm.name, d.signature).withDenot(d))) } /** The info of `sym`, seen as a member of this type. */ @@ -1383,7 +1383,9 @@ object Types { } abstract case class TermRef(override val prefix: Type, name: TermName) extends NamedType with SingletonType { - protected def sig: Signature = NotAMethod + protected def sig: Signature = UnknownSignature + + override def signature(implicit ctx: Context): Signature = denot.signature def isOverloaded(implicit ctx: Context) = denot.isOverloaded @@ -1440,7 +1442,7 @@ object Types { */ final class TermRefWithSignature(prefix: Type, name: TermName, override val sig: Signature) extends TermRef(prefix, name) { - assert(sig != NotAMethod) + assert(sig != UnknownSignature) override def signature(implicit ctx: Context) = sig override def loadDenot(implicit ctx: Context): Denotation = super.loadDenot.atSignature(sig) @@ -1468,7 +1470,7 @@ object Types { def withSym(prefix: Type, sym: TermSymbol)(implicit ctx: Context): TermRef = withSym(prefix, sym.name, sym) def withSig(prefix: Type, name: TermName, sig: Signature)(implicit ctx: Context): TermRef = - if (sig == NotAMethod) apply(prefix, name) + if (sig == UnknownSignature) apply(prefix, name) else unique(new TermRefWithSignature(prefix, name, sig)) } @@ -1666,15 +1668,15 @@ object Types { myIsDependent } - private[this] var _signature: Signature = _ + private[this] var mySignature: Signature = _ private[this] var signatureRunId: Int = NoRunId override def signature(implicit ctx: Context): Signature = { if (ctx.runId != signatureRunId) { - _signature = computeSignature + mySignature = computeSignature signatureRunId = ctx.runId } - _signature + mySignature } private def computeSignature(implicit ctx: Context): Signature = { |