From fb3dba1bac13a755d2304928cbd49e7dde6f1bf9 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 7 May 2014 19:06:17 +0200 Subject: 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`. --- src/dotty/tools/dotc/typer/Inferencing.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dotty/tools/dotc/typer/Inferencing.scala') 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 -- cgit v1.2.3