@@ -2992,43 +2992,35 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
29922992 def includesTargetPos (tree : Tree ) =
29932993 tree.pos.isRange && context.unit.exists && (tree.pos includes context.unit.targetPos)
29942994 val localTarget = stats exists includesTargetPos
2995- def typedStat (stat : Tree ): Tree = {
2996- if (context.owner.isRefinementClass && ! treeInfo.isDeclarationOrTypeDef(stat))
2997- OnlyDeclarationsError (stat)
2998- else
2999- stat match {
3000- case imp @ Import (_, _) =>
3001- imp.symbol.initialize
3002- if (! imp.symbol.isError) {
3003- context = context.make(imp)
3004- typedImport(imp)
3005- } else EmptyTree
3006- case _ =>
3007- if (localTarget && ! includesTargetPos(stat)) {
3008- // skip typechecking of statements in a sequence where some other statement includes
3009- // the targetposition
3010- stat
3011- } else {
3012- val localTyper = if (inBlock || (stat.isDef && ! stat.isInstanceOf [LabelDef ])) {
3013- this
3014- } else newTyper(context.make(stat, exprOwner))
3015- // XXX this creates a spurious dead code warning if an exception is thrown
3016- // in a constructor, even if it is the only thing in the constructor.
3017- val result = checkDead(localTyper.typedByValueExpr(stat))
3018-
3019- if (treeInfo.isSelfOrSuperConstrCall(result)) {
3020- context.inConstructorSuffix = true
3021- if (treeInfo.isSelfConstrCall(result) && result.symbol.pos.pointOrElse(0 ) >= exprOwner.enclMethod.pos.pointOrElse(0 ))
3022- ConstructorsOrderError (stat)
3023- }
3024-
3025- if (! isPastTyper && treeInfo.isPureExprForWarningPurposes(result)) context.warning(stat.pos,
3026- " a pure expression does nothing in statement position; " +
3027- " you may be omitting necessary parentheses"
3028- )
3029- result
3030- }
2995+ def typedStat (stat : Tree ): Tree = stat match {
2996+ case s if context.owner.isRefinementClass && ! treeInfo.isDeclarationOrTypeDef(s) => OnlyDeclarationsError (s)
2997+ case imp @ Import (_, _) =>
2998+ imp.symbol.initialize
2999+ if (! imp.symbol.isError) {
3000+ context = context.make(imp)
3001+ typedImport(imp)
3002+ } else EmptyTree
3003+ // skip typechecking of statements in a sequence where some other statement includes the targetposition
3004+ case s if localTarget && ! includesTargetPos(s) => s
3005+ case _ =>
3006+ val localTyper = if (inBlock || (stat.isDef && ! stat.isInstanceOf [LabelDef ])) {
3007+ this
3008+ } else newTyper(context.make(stat, exprOwner))
3009+ // XXX this creates a spurious dead code warning if an exception is thrown
3010+ // in a constructor, even if it is the only thing in the constructor.
3011+ val result = checkDead(localTyper.typedByValueExpr(stat))
3012+
3013+ if (treeInfo.isSelfOrSuperConstrCall(result)) {
3014+ context.inConstructorSuffix = true
3015+ if (treeInfo.isSelfConstrCall(result) && result.symbol.pos.pointOrElse(0 ) >= exprOwner.enclMethod.pos.pointOrElse(0 ))
3016+ ConstructorsOrderError (stat)
30313017 }
3018+
3019+ if (! isPastTyper && treeInfo.isPureExprForWarningPurposes(result)) context.warning(stat.pos,
3020+ " a pure expression does nothing in statement position; " +
3021+ " you may be omitting necessary parentheses"
3022+ )
3023+ result
30323024 }
30333025
30343026 /* 'accessor' and 'accessed' are so similar it becomes very difficult to
0 commit comments