aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-17 18:30:31 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-17 18:30:31 +0100
commitd0b09e431ad6974c7ebc0a7734d46050ec712fa1 (patch)
tree9575c74a453147d6a53c1b32c07ecd4b7eff4a14 /src/dotty/tools/dotc/typer/Typer.scala
parentab4ae7ada45201684c91550815f85a2cfab24e34 (diff)
downloaddotty-d0b09e431ad6974c7ebc0a7734d46050ec712fa1.tar.gz
dotty-d0b09e431ad6974c7ebc0a7734d46050ec712fa1.tar.bz2
dotty-d0b09e431ad6974c7ebc0a7734d46050ec712fa1.zip
Two fixes in Typer
Fixes for var x: T = _ super.f(...)
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index df0757da2..456a87ca4 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -353,7 +353,7 @@ class Typer extends Namer with Applications with Implicits {
def typedSuper(tree: untpd.Super, pt: Type)(implicit ctx: Context): Tree = track("typedSuper") {
val mix = tree.mix
val qual1 = typed(tree.qual)
- val cls = qual1.tpe.typeSymbol
+ val cls = qual1.tpe.widen.typeSymbol
def findMixinSuper(site: Type): Type = site.parents filter (_.name == mix) match {
case p :: Nil =>
@@ -740,7 +740,10 @@ class Typer extends Namer with Applications with Implicits {
val ValDef(mods, name, tpt, rhs) = vdef
val mods1 = typedModifiers(mods)
val tpt1 = typedType(tpt)
- val rhs1 = typedExpr(rhs, tpt1.tpe)
+ val rhs1 = rhs match {
+ case Ident(nme.WILDCARD) => rhs withType tpt1.tpe
+ case _ => typedExpr(rhs, tpt1.tpe)
+ }
val refType = if (sym.exists) sym.valRef else NoType
cpy.ValDef(vdef, mods1, name, tpt1, rhs1).withType(refType)
}
@@ -1068,7 +1071,7 @@ class Typer extends Namer with Applications with Implicits {
}
}
adapt(tpd.Apply(tree, args), wtp.resultType)
- case wtp: MethodType if !pt.isInstanceOf[SingletonType] =>
+ case wtp: MethodType if !pt.isInstanceOf[SingletonType] =>
if ((defn.isFunctionType(pt) || (pt eq AnyFunctionProto)) &&
!tree.symbol.isConstructor)
etaExpand(tree, wtp)