From 1660cfc41e6e58d19db6cfdb6a768831c57033f8 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 1 Dec 2010 21:16:28 +0000 Subject: A patch authored by martin to fix one of the bi... A patch authored by martin to fix one of the big outstanding issues with -Ycheck. The typer had a vision of the world which fell to pieces if presented with a tree from after phase constructors. Now it is wiser: perhaps a bit sadder as well, but every typer must face this day sooner or later. Also removed the various passing tests from test/checker-tests, but still plenty of fascinating failures in there for anyone interested in helping push to the finish line! No review. --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 03c5d2958c..b6e45fe58c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1150,8 +1150,11 @@ trait Typers { self: Analyzer => treeInfo.firstConstructor(templ.body) match { case constr @ DefDef(_, _, _, vparamss, _, cbody @ Block(cstats, cunit)) => // Convert constructor body to block in environment and typecheck it - val cstats1: List[Tree] = cstats map (_.duplicate) - val scall = if (cstats.isEmpty) EmptyTree else cstats.last + val (preSuperStats, rest) = cstats span (!treeInfo.isSuperConstrCall(_)) + val (scall, upToSuperStats) = + if (rest.isEmpty) (EmptyTree, preSuperStats) + else (rest.head, preSuperStats :+ rest.head) + val cstats1: List[Tree] = upToSuperStats map (_.duplicate) val cbody1 = scall match { case Apply(_, _) => treeCopy.Block(cbody, cstats1.init, @@ -4158,7 +4161,7 @@ trait Typers { self: Analyzer => tree.tpe = null if (tree.hasSymbol) tree.symbol = NoSymbol } - printTyping("typing "+tree+", pt = "+pt+", undetparams = "+context.undetparams+", implicits-enabled = "+context.implicitsEnabled+", silent = "+context.reportGeneralErrors) //DEBUG + printTyping("typing "+tree+", pt = "+pt+", undetparams = "+context.undetparams+", implicits-enabled = "+context.implicitsEnabled+", silent = "+context.reportGeneralErrors+", context.owner = "+context.owner) //DEBUG var tree1 = if (tree.tpe ne null) tree else typed1(tree, mode, dropExistential(pt)) printTyping("typed "+tree1+":"+tree1.tpe+(if (isSingleType(tree1.tpe)) " with underlying "+tree1.tpe.widen else "")+", undetparams = "+context.undetparams+", pt = "+pt) //DEBUG @@ -4332,3 +4335,4 @@ trait Typers { self: Analyzer => */ } } + -- cgit v1.2.3