aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-04-14 14:31:58 +0200
committerMartin Odersky <odersky@gmail.com>2014-04-14 15:53:39 +0200
commitf39b6249a11cdb35445da8ce0a338911af496695 (patch)
tree17c2090aca09fabbf58f22dbdb4678bdf4feafa7 /src
parente5ae4a707b2bb78f0777660b0661a3162bf646df (diff)
downloaddotty-f39b6249a11cdb35445da8ce0a338911af496695.tar.gz
dotty-f39b6249a11cdb35445da8ce0a338911af496695.tar.bz2
dotty-f39b6249a11cdb35445da8ce0a338911af496695.zip
Members of stable methods
Stable methods are introduced from getters by inserting () parameters. This change makes sure that adding () does not lose the members of an ExprType. Also, avoid spurious stale symbol errors in loadDenot. When something is not a SymDenotation, no use retrying in first phase; current would fail immediately.
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/core/Denotations.scala2
-rw-r--r--src/dotty/tools/dotc/core/Types.scala12
2 files changed, 10 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Denotations.scala b/src/dotty/tools/dotc/core/Denotations.scala
index 63b94efbd..e5f5e6f87 100644
--- a/src/dotty/tools/dotc/core/Denotations.scala
+++ b/src/dotty/tools/dotc/core/Denotations.scala
@@ -512,7 +512,7 @@ object Denotations {
def current(implicit ctx: Context): SingleDenotation = {
val currentPeriod = ctx.period
val valid = myValidFor
- assert(valid.code > 0, s"negative period $valid: ${valid.code}")
+ assert(valid.code > 0)
if (valid.runId != currentPeriod.runId) bringForward.current
else {
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala
index ecad89afc..66f027915 100644
--- a/src/dotty/tools/dotc/core/Types.scala
+++ b/src/dotty/tools/dotc/core/Types.scala
@@ -352,6 +352,12 @@ object Types {
goThis(tp)
case tp: TypeRef =>
tp.denot.findMember(name, pre, excluded)
+ case tp: TermRef =>
+ go (tp.underlying match {
+ case mt: MethodType
+ if mt.paramTypes.isEmpty && (tp.symbol is Stable) => mt.resultType
+ case tp1 => tp1
+ })
case tp: TypeProxy =>
go(tp.underlying)
case tp: ClassInfo =>
@@ -1101,14 +1107,14 @@ object Types {
private def withSig(sig: Signature)(implicit ctx: Context): NamedType =
TermRef.withSig(prefix, name.asTermName, sig)
- protected def loadDenot(implicit ctx: Context) = {
+ protected def loadDenot(implicit ctx: Context): Denotation = {
val d =
if (name.isInheritedName) prefix.nonPrivateMember(name.revertInherited)
else prefix.member(name)
- if (d.exists || ctx.phaseId == FirstPhaseId)
+ if (d.exists || ctx.phaseId == FirstPhaseId || !lastDenotation.isInstanceOf[SymDenotation])
d
else {// name has changed; try load in earlier phase and make current
- val d = denot(ctx.withPhase(ctx.phaseId - 1)).current
+ val d = loadDenot(ctx.withPhase(ctx.phaseId - 1)).current
if (d.exists) d
else throw new Error(s"failure to reload $this")
}