diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-14 20:55:26 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-14 20:55:26 +0000 |
commit | 69aa78bd1bc593f878e44b2abde61dbb56391204 (patch) | |
tree | e3399528a7fd7ed74fdd76f8f5c84ae25979a1da /src/compiler | |
parent | 799bd96931386ab3bfa160e738dbf10fb42c0efe (diff) | |
download | scala-69aa78bd1bc593f878e44b2abde61dbb56391204.tar.gz scala-69aa78bd1bc593f878e44b2abde61dbb56391204.tar.bz2 scala-69aa78bd1bc593f878e44b2abde61dbb56391204.zip |
Fixed various issues with -Ywarn-dead-code.
enjoy fewer spurious warnings. Closes #1681, no review.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 8ce26c92a1..0f87d6ba33 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -1791,7 +1791,7 @@ trait Typers { self: Analyzer => if (meth.isPrimaryConstructor && meth.isClassConstructor && phase.id <= currentRun.typerPhase.id && !reporter.hasErrors) computeParamAliases(meth.owner, vparamss1, rhs1) - if (tpt1.tpe.typeSymbol != NothingClass && !context.returnsSeen) rhs1 = checkDead(rhs1) + if (tpt1.tpe.typeSymbol != NothingClass && !context.returnsSeen && rhs1.tpe.typeSymbol != NothingClass) rhs1 = checkDead(rhs1) if (phase.id <= currentRun.typerPhase.id && meth.owner.isClass && meth.paramss.exists(ps => ps.exists(_.hasDefaultFlag) && isRepeatedParamType(ps.last.tpe))) @@ -2205,8 +2205,11 @@ trait Typers { self: Analyzer => else checkNoDoubleDefsAndAddSynthetics(result) } - def typedArg(arg: Tree, mode: Int, newmode: Int, pt: Type): Tree = - checkDead(constrTyperIf((mode & SCCmode) != 0).typed(arg, mode & stickyModes | newmode, pt)) + def typedArg(arg: Tree, mode: Int, newmode: Int, pt: Type): Tree = { + val t = constrTyperIf((mode & SCCmode) != 0).typed(arg, mode & stickyModes | newmode, pt) + if ((newmode & BYVALmode) != 0) t + else checkDead(t) + } def typedArgs(args: List[Tree], mode: Int) = args mapConserve (arg => typedArg(arg, mode, 0, WildcardType)) |