aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-16 19:04:02 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-16 19:04:02 +0100
commit2ede22228c09ca7c2f4ae190ec2086787238ed0a (patch)
tree71cbf08444deeef2289ecae4378828832fe8e92e /src/dotty/tools/dotc
parente1e372cc833e3e9d0d02c1ffa453667f50dbc784 (diff)
downloaddotty-2ede22228c09ca7c2f4ae190ec2086787238ed0a.tar.gz
dotty-2ede22228c09ca7c2f4ae190ec2086787238ed0a.tar.bz2
dotty-2ede22228c09ca7c2f4ae190ec2086787238ed0a.zip
Small tweaks to typer
Diffstat (limited to 'src/dotty/tools/dotc')
-rw-r--r--src/dotty/tools/dotc/core/Decorators.scala1
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala10
2 files changed, 6 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/core/Decorators.scala b/src/dotty/tools/dotc/core/Decorators.scala
index ca601cddf..cd9680e64 100644
--- a/src/dotty/tools/dotc/core/Decorators.scala
+++ b/src/dotty/tools/dotc/core/Decorators.scala
@@ -115,6 +115,7 @@ object Decorators {
implicit class ListOfListDecorator[T](val xss: List[List[T]]) extends AnyVal {
def nestedMap[U](f: T => U): List[List[U]] = xss map (_ map f)
+ def nestedMapconserve[U](f: T => U): List[List[U]] = xss mapconserve (_ mapconserve f)
}
implicit class TextToString(val text: Text) extends AnyVal {
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 6b6252638..b59832602 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -394,7 +394,7 @@ class Typer extends Namer with Applications with Implicits {
def typedNew(tree: untpd.New, pt: Type)(implicit ctx: Context) = track("typedNew") {
tree.tpt match {
- case templ: Template =>
+ case templ: untpd.Template =>
import untpd._
val x = tpnme.ANON_CLASS
val clsDef = TypeDef(Modifiers(Final), x, templ)
@@ -426,7 +426,7 @@ class Typer extends Namer with Applications with Implicits {
cpy.Typed(tree, expr1, tpt1).withType(tpt1.tpe)
}
tree.expr match {
- case id: Ident if (ctx.mode is Mode.Pattern) && isVarPattern(id) =>
+ case id: untpd.Ident if (ctx.mode is Mode.Pattern) && isVarPattern(id) =>
if (id.name == nme.WILDCARD) regularTyped(isWildcard = true)
else {
import untpd._
@@ -759,7 +759,7 @@ class Typer extends Namer with Applications with Implicits {
val DefDef(mods, name, tparams, vparamss, tpt, rhs) = ddef
val mods1 = typedModifiers(mods)
val tparams1 = tparams mapconserve (typed(_).asInstanceOf[TypeDef])
- val vparamss1 = vparamss mapconserve(_ mapconserve (typed(_).asInstanceOf[ValDef]))
+ val vparamss1 = vparamss nestedMapconserve (typed(_).asInstanceOf[ValDef])
val tpt1 = typedType(tpt)
val rhs1 = typedExpr(rhs, tpt1.tpe)
cpy.DefDef(ddef, mods1, name, tparams1, vparamss1, tpt1, rhs1).withType(sym.termRefWithSig)
@@ -930,7 +930,7 @@ class Typer extends Namer with Applications with Implicits {
val nestedCtx = if (exprOwner == ctx.owner) ctx else ctx.fresh.withOwner(exprOwner)
buf += typed(stat)(nestedCtx)
traverse(rest)
- case _ =>
+ case nil =>
buf.toList
}
traverse(stats)
@@ -938,7 +938,7 @@ class Typer extends Namer with Applications with Implicits {
def typedExpr(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree =
typed(tree, pt)(ctx retractMode Mode.PatternOrType)
- def typedType(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree =
+ def typedType(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree = // todo: retract mode between Type and Pattern?
typed(tree, pt)(ctx addMode Mode.Type)
def typedPattern(tree: untpd.Tree, pt: Type = WildcardType)(implicit ctx: Context): Tree =
typed(tree, pt)(ctx addMode Mode.Pattern)