aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-11-07 21:43:59 +0100
committerMartin Odersky <odersky@gmail.com>2013-11-07 21:43:59 +0100
commit067ef2076cfcf7864b840ddf38c514ff67f52c64 (patch)
tree3b974ba717ecc08ab37d8dfb49c02f4f74d5eb5a /src/dotty/tools/dotc/typer/Typer.scala
parent514801453e240610a0ba68fff7305355a7d204e1 (diff)
downloaddotty-067ef2076cfcf7864b840ddf38c514ff67f52c64.tar.gz
dotty-067ef2076cfcf7864b840ddf38c514ff67f52c64.tar.bz2
dotty-067ef2076cfcf7864b840ddf38c514ff67f52c64.zip
Fixing inference problem and block scope problem
1. Typing blocks: forgot to create new scope. Now fixed. 2. The decitsion whether to interpolate a type variable was made based on the type variable's position and the current tree's position. This is too imprecise, because we might have auto-generated trees where all important parts have the same position. We now check for actual tree containment: A type variable can be interpolated for the type of a tree T if T contains the tree which introduced the type variable.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index e9c6b0d08..08bf6badf 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -833,7 +833,7 @@ class Typer extends Namer with Applications with Implicits {
case tree: untpd.Typed => typedTyped(tree, pt)
case tree: untpd.NamedArg => typedNamedArg(tree, pt)
case tree: untpd.Assign => typedAssign(tree, pt)
- case tree: untpd.Block => typedBlock(desugar.block(tree), pt)
+ case tree: untpd.Block => typedBlock(desugar.block(tree), pt)(ctx.fresh.withNewScope)
case tree: untpd.If => typedIf(tree, pt)
case tree: untpd.Function => typedFunction(tree, pt)
case tree: untpd.Closure => typedClosure(tree, pt)
@@ -933,7 +933,7 @@ class Typer extends Namer with Applications with Implicits {
}
def interpolateAndAdapt(tree: Tree, pt: Type)(implicit ctx: Context) = {
- ctx.interpolateUndetVars(tree.tpe.widen, tree.pos)
+ ctx.interpolateUndetVars(tree)
tree overwriteType tree.tpe.simplified
adapt(tree, pt)
}
@@ -1107,7 +1107,7 @@ class Typer extends Namer with Applications with Implicits {
else {
val tvars = ctx.typerState.withCheckingDisabled {
val tracked = ctx.track(poly)
- ctx.newTypeVars(tracked, tree.pos)
+ ctx.newTypeVars(tracked, tree)
}
adapt(tree appliedToTypes tvars, pt)
}