diff options
author | Martin Odersky <odersky@gmail.com> | 2014-05-07 19:06:17 +0200 |
---|---|---|
committer | Samuel Gruetter <samuel.gruetter@epfl.ch> | 2014-05-20 13:38:49 +0200 |
commit | fb3dba1bac13a755d2304928cbd49e7dde6f1bf9 (patch) | |
tree | a4e712103779decdebc439e33aa2c3f8f16890e8 /src/dotty/tools/dotc/typer/Inferencing.scala | |
parent | f7910005038c188e573e8d1a42ff3e31c69c90c1 (diff) | |
download | dotty-fb3dba1bac13a755d2304928cbd49e7dde6f1bf9.tar.gz dotty-fb3dba1bac13a755d2304928cbd49e7dde6f1bf9.tar.bz2 dotty-fb3dba1bac13a755d2304928cbd49e7dde6f1bf9.zip |
Avoid hoisting of local classes out of method bodies.
Doing so is unsound. We instead approximate local classes by their parents, but
only if the expected type is not fully defined.
This makes the test t2421_delitedsl1.scala in the commit pass. The oter test,
blockEscapesNeg.scala is modified to fail. Previously it failed outright but with the
new rules the nested class Bar is approximated to Object. That means that the block
containing `Foo.Bar` typechecks, but with type `Object` instead of the unreachable `Bar`.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Inferencing.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Inferencing.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Inferencing.scala b/src/dotty/tools/dotc/typer/Inferencing.scala index bd44ccac5..9e34d549a 100644 --- a/src/dotty/tools/dotc/typer/Inferencing.scala +++ b/src/dotty/tools/dotc/typer/Inferencing.scala @@ -58,7 +58,7 @@ trait Inferencing { this: Checking => } private var toMaximize: Boolean = false def apply(x: Boolean, tp: Type): Boolean = tp.dealias match { - case _: WildcardType => + case _: WildcardType | _: ProtoType => false case tvar: TypeVar if !tvar.isInstantiated => if (force == ForceDegree.none) false |