Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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.
  • Loading branch information...
commit 8b7f0acb73147b7a779fd79e61485c191740ac4e 1 parent 327083d
@retronym retronym authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/compiler/scala/tools/nsc/typechecker/Typers.scala
View
13 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)
Please sign in to comment.
Something went wrong with that request. Please try again.