summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-12-05 13:28:51 +0100
committerJason Zaugg <jzaugg@gmail.com>2012-12-05 13:28:51 +0100
commit8b7f0acb73147b7a779fd79e61485c191740ac4e (patch)
tree09ad11f52cab1536e70a3707b5edd86697a16f77 /src/compiler/scala/tools/nsc/typechecker/Typers.scala
parent327083df40d1854f28c00983aed5734fa6a7e6f9 (diff)
downloadscala-8b7f0acb73147b7a779fd79e61485c191740ac4e.tar.gz
scala-8b7f0acb73147b7a779fd79e61485c191740ac4e.tar.bz2
scala-8b7f0acb73147b7a779fd79e61485c191740ac4e.zip
SI-5361 Refactor in accordance with review comments.
Check for malformed stats in the refinement body in the same place we check for erroneous parents.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index e358917aef..5fc5721175 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -2711,11 +2711,6 @@ trait Typers extends Modes with Adaptations with Tags {
val stats = templ.body
namer.enterSyms(stats)
- // This is also checked later in typedStats, but that is too late for SI-5361, so
- // we eagerly check this here.
- for (stat <- stats if !treeInfo.isDeclarationOrTypeDef(stat))
- OnlyDeclarationsError(stat)
-
// need to delay rest of typedRefinement to avoid cyclic reference errors
unit.toCheck += { () =>
val stats1 = typedStats(stats, NoSymbol)
@@ -5067,7 +5062,13 @@ trait Typers extends Modes with Adaptations with Tags {
def typedCompoundTypeTree(tree: CompoundTypeTree) = {
val templ = tree.templ
val parents1 = templ.parents mapConserve (typedType(_, mode))
- if (parents1 exists (_.isErrorTyped)) tree setType ErrorType
+
+ // This is also checked later in typedStats, but that is too late for SI-5361, so
+ // we eagerly check this here.
+ for (stat <- templ.body if !treeInfo.isDeclarationOrTypeDef(stat))
+ OnlyDeclarationsError(stat)
+
+ if ((parents1 ++ templ.body) exists (_.isErrorTyped)) tree setType ErrorType
else {
val decls = newScope
//Console.println("Owner: " + context.enclClass.owner + " " + context.enclClass.owner.id)