aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-10-24 13:29:40 +0200
committerMartin Odersky <odersky@gmail.com>2013-10-24 13:29:40 +0200
commit44f0976487792760f0dc7fc8aa3dc1ba4ac52b7f (patch)
treefe17e008d4023ebf5d8387d98c9d441735531b71 /src/dotty/tools/dotc/typer
parentde336bccbbd5671f97e7889b5260e963c8317b1d (diff)
downloaddotty-44f0976487792760f0dc7fc8aa3dc1ba4ac52b7f.tar.gz
dotty-44f0976487792760f0dc7fc8aa3dc1ba4ac52b7f.tar.bz2
dotty-44f0976487792760f0dc7fc8aa3dc1ba4ac52b7f.zip
Added forgfeotten withNewScope when typing value definitions.
ValDefs need to open a new scope for anything that's declared on the right hand side.
Diffstat (limited to 'src/dotty/tools/dotc/typer')
-rw-r--r--src/dotty/tools/dotc/typer/Namer.scala5
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala
index 7582b0d0d..79b1750dc 100644
--- a/src/dotty/tools/dotc/typer/Namer.scala
+++ b/src/dotty/tools/dotc/typer/Namer.scala
@@ -89,7 +89,8 @@ class Namer { typer: Typer =>
/** The scope of the typer.
* For nested typers this is a place parameters are entered during completion
- * and where they survive until typechecking.
+ * and where they survive until typechecking. A context with this typer also
+ * has this scope.
*/
val scope = newScope
@@ -278,7 +279,7 @@ class Namer { typer: Typer =>
def typeSig(tree: Tree): Type = tree match {
case tree: ValDef =>
- valOrDefDefSig(tree, sym, identity)(localContext)
+ valOrDefDefSig(tree, sym, identity)(localContext.withNewScope)
case tree: DefDef =>
val typer1 = new Typer
nestedTyper(sym) = typer1
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 840bee467..5b79c62f3 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -806,7 +806,7 @@ class Typer extends Namer with Applications with Implicits {
case tree: untpd.Bind => typedBind(tree, pt)
case tree: untpd.ValDef =>
if (tree.isEmpty) tpd.EmptyValDef
- else typedValDef(tree, sym)(localContext)
+ else typedValDef(tree, sym)(localContext.withNewScope)
case tree: untpd.DefDef =>
val typer1 = nestedTyper.remove(sym).get
typer1.typedDefDef(tree, sym)(localContext.withTyper(typer1))