aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Namer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-03-10 22:06:13 +0100
committerTobias Schlatter <tobias@meisch.ch>2014-03-20 20:25:05 +0100
commit3ba0931636a5d34ca2da9588f2952af709d41ace (patch)
treecc80be514102bca1203cc6a83a8fd62c7e0ae6c8 /src/dotty/tools/dotc/typer/Namer.scala
parentce466da9fd5b2601c91e351fd1d288099ec380b2 (diff)
downloaddotty-3ba0931636a5d34ca2da9588f2952af709d41ace.tar.gz
dotty-3ba0931636a5d34ca2da9588f2952af709d41ace.tar.bz2
dotty-3ba0931636a5d34ca2da9588f2952af709d41ace.zip
New scheme for TypeTrees that refer to others
Adds a new scheme by which a TypeTree() can refer for its type to the symbol of some other type. Applies the scheme to setter parameters, replacing the previous ad-hoc solution.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index c318ddf36..21b87aee4 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -173,6 +173,11 @@ class Namer { typer: Typer =>
enclosingClassNamed(mods.privateWithin, mods.pos)
def record(sym: Symbol): Symbol = {
+ val refs = tree.attachmentOrElse(desugar.References, Nil)
+ if (refs.nonEmpty) {
+ tree.removeAttachment(desugar.References)
+ refs foreach (_.pushAttachment(desugar.OriginalSymbol, sym))
+ }
tree.pushAttachment(SymOfTree, sym)
sym
}
@@ -516,10 +521,7 @@ class Namer { typer: Typer =>
* NoType if neither case holds.
*/
val inherited =
- if ((sym is Param) && sym.owner.isSetter) // fill in type from getter result type
- defContext(sym.owner)
- .denotNamed(sym.owner.asTerm.name.setterToGetter).info.widenExpr
- else if (sym.owner.isTerm) NoType
+ if (sym.owner.isTerm) NoType
else {
// TODO: Look only at member of supertype instead?
lazy val schema = paramFn(WildcardType)
@@ -578,7 +580,7 @@ class Namer { typer: Typer =>
val rhsCtx = ctx.fresh addMode Mode.InferringReturnType
def rhsType = typedAheadExpr(mdef.rhs, rhsProto)(rhsCtx).tpe.widen.approximateUnion
def lhsType = fullyDefinedType(rhsType, "right-hand side", mdef.pos)
- inherited orElse lhsType
+ inherited orElse lhsType orElse WildcardType
}
paramFn(typedAheadType(mdef.tpt, pt).tpe)
}