aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/Types.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-08-26 14:53:42 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-26 14:53:42 +0200
commit08c6eacaf59386ed26aeead472e1df2c5944a3fb (patch)
treedff3e1c4ae4d1f1b62e4e3509231f9a5f16024ed /src/dotty/tools/dotc/core/Types.scala
parent97d89afc4769c4badb42284c9b5d97b663f870f6 (diff)
downloaddotty-08c6eacaf59386ed26aeead472e1df2c5944a3fb.tar.gz
dotty-08c6eacaf59386ed26aeead472e1df2c5944a3fb.tar.bz2
dotty-08c6eacaf59386ed26aeead472e1df2c5944a3fb.zip
thisType of a module class is a term ref to the source module.
Module classes now always get the sourceModule term ref as their this type. We would like to eliminate ThisType() of a module class completely, as this hangs on to a symbol which might become stale for globally accessible modules. This commit is the first step. It contains the change to thisType and the necessary fixes to make the test suite pass.
Diffstat (limited to 'src/dotty/tools/dotc/core/Types.scala')
-rw-r--r--src/dotty/tools/dotc/core/Types.scala10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index e59c28ca2..a6ba7d9a0 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -1353,13 +1353,13 @@ object Types {
}
override def newLikeThis(prefix: Type)(implicit ctx: Context): TermRef = {
- if (sig != Signature.NotAMethod &&
- sig != Signature.OverloadedSignature &&
- symbol.exists) {
+ val candidate = TermRef.withSig(prefix, name, sig)
+ if (symbol.exists && !candidate.symbol.exists) { // recompute from previous symbol
val ownSym = symbol
- TermRef.all(prefix, name).withDenot(asMemberOf(prefix).disambiguate(_ eq ownSym))
+ val newd = asMemberOf(prefix)
+ candidate.withDenot(asMemberOf(prefix).suchThat(_ eq ownSym))
}
- else TermRef.withSig(prefix, name, sig)
+ else candidate
}
override def equals(that: Any) = that match {