diff options
author | Martin Odersky <odersky@gmail.com> | 2013-08-05 10:52:13 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-08-05 17:20:56 +0200 |
commit | a326e86d7d8389e8049a77b2cd75458f4573e294 (patch) | |
tree | c1daf83a17f692a722bf03eea84b8fb429e4579d /src/dotty/tools/dotc/typer/Inferencing.scala | |
parent | dbb4b3f7923427af4ba6e04f258309421d5ee1ab (diff) | |
download | dotty-a326e86d7d8389e8049a77b2cd75458f4573e294.tar.gz dotty-a326e86d7d8389e8049a77b2cd75458f4573e294.tar.bz2 dotty-a326e86d7d8389e8049a77b2cd75458f4573e294.zip |
Type checking function trees and closures.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Inferencing.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index 5c9c86c0c..ff38ef997 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -21,20 +21,20 @@ object Inferencing { * - the overall result of `isFullYDefined` is `true`. * Variables that are succesfully minimized do not count as uninstantiated. */ - def isFullyDefined(tp: Type)(implicit ctx: Context): Boolean = { + def isFullyDefined(tp: Type, forceIt: Boolean = false)(implicit ctx: Context): Boolean = { val nestedCtx = ctx.fresh.withNewTyperState - val result = new IsFullyDefinedAccumulator()(nestedCtx).traverse(tp) + val result = new IsFullyDefinedAccumulator(forceIt)(nestedCtx).traverse(tp) if (result) nestedCtx.typerState.commit() result } - private class IsFullyDefinedAccumulator(implicit ctx: Context) extends TypeAccumulator[Boolean] { + private class IsFullyDefinedAccumulator(forceIt: Boolean)(implicit ctx: Context) extends TypeAccumulator[Boolean] { def traverse(tp: Type): Boolean = apply(true, tp) def apply(x: Boolean, tp: Type) = !x || isOK(tp) && foldOver(x, tp) def isOK(tp: Type): Boolean = tp match { case _: WildcardType => false - case tvar: TypeVar if !tvar.isInstantiated => + case tvar: TypeVar if forceIt && !tvar.isInstantiated => val inst = tvar.instantiate(fromBelow = true) inst != defn.NothingType && inst != defn.NullType case _ => |