summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-12-01 21:16:28 +0000
committerPaul Phillips <paulp@improving.org>2010-12-01 21:16:28 +0000
commit1660cfc41e6e58d19db6cfdb6a768831c57033f8 (patch)
tree1d88c2c16d85cc909f90b15c552c98e95e186ad2 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parenta37284fdf7e2b2917c9e894a9b93c02d1defc983 (diff)
downloadscala-1660cfc41e6e58d19db6cfdb6a768831c57033f8.tar.gz
scala-1660cfc41e6e58d19db6cfdb6a768831c57033f8.tar.bz2
scala-1660cfc41e6e58d19db6cfdb6a768831c57033f8.zip
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.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala10
1 files changed, 7 insertions, 3 deletions
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 =>
*/
}
}
+