diff options
author | Martin Odersky <odersky@gmail.com> | 2013-11-07 21:43:59 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-11-07 21:43:59 +0100 |
commit | 067ef2076cfcf7864b840ddf38c514ff67f52c64 (patch) | |
tree | 3b974ba717ecc08ab37d8dfb49c02f4f74d5eb5a /src/dotty/tools/dotc/core/Types.scala | |
parent | 514801453e240610a0ba68fff7305355a7d204e1 (diff) | |
download | dotty-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/core/Types.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index d07bdc6fc..afb1501f5 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -17,6 +17,7 @@ import Periods._ import util.Positions.Position import util.Stats.track import ast.tpd._, printing.Texts._ +import ast.untpd import transform.Erasure import printing.Printer import scala.util.hashing.{ MurmurHash3 => hashing } @@ -1939,12 +1940,10 @@ object Types { * * @param origin The parameter that's tracked by the type variable. * @param creatorState The typer state in which the variable was created. - * @param pos The position of the TypeApply tree that introduces + * @param owningTree The function part of the TypeApply tree tree that introduces * the type variable. */ - final class TypeVar(val origin: PolyParam, creatorState: TyperState, val pos: Position) extends UncachedProxyType with ValueType { - - assert(pos.exists) + final class TypeVar(val origin: PolyParam, creatorState: TyperState, val owningTree: untpd.Tree) extends UncachedProxyType with ValueType { /** The permanent instance type of the the variable, or NoType is none is given yet */ private[core] var inst: Type = NoType |