Permalink
Browse files

Handled some of our new exhaustiveness warnings.

Who could have suspected it would actually be right most of the time?
  • Loading branch information...
paulp committed May 26, 2012
1 parent e4b8c06 commit bcc82808ecf056affecf11b14f3ad850ad21d773
@@ -1532,6 +1532,7 @@ abstract class GenJVM extends SubComponent with GenJVMUtil with GenAndroid with
case (NE, _) =>
jcode emitIFNONNULL labels(success)
jcode.emitGOTO_maybe_W(labels(failure), false)
case _ =>
}
} else {
(kind: @unchecked) match {
@@ -1553,7 +1553,7 @@ abstract class GenMSIL extends SubComponent {
}
def emitBrBool(cond: TestOp, dest: Label) {
cond match {
(cond: @unchecked) match {
// EQ -> Brfalse, NE -> Brtrue; this is because we come from
// a CZJUMP. If the value on the stack is 0 (e.g. a boolean
// method returned false), and we are in the case EQ, then
@@ -316,7 +316,6 @@ class Template(universe: doc.Universe, tpl: DocTemplateEntity) extends HtmlPage
def mbrCmt = mbr.comment.get
def paramCommentToHtml(prs: List[ParameterEntity]): NodeSeq = prs match {
case Nil => NodeSeq.Empty
case (tp: TypeParam) :: rest =>
val paramEntry: NodeSeq = {
@@ -329,6 +328,9 @@ class Template(universe: doc.Universe, tpl: DocTemplateEntity) extends HtmlPage
<dt class="param">{ vp.name }</dt><dd class="cmt">{ bodyToHtml(mbrCmt.valueParams(vp.name)) }</dd>
}
paramEntry ++ paramCommentToHtml(rest)
case _ =>
NodeSeq.Empty
}
if (mbr.comment.isEmpty) NodeSeq.Empty
@@ -678,7 +678,7 @@ abstract class CleanUp extends Transform with ast.TreeDSL {
// need to create a new block with inits and the old term
treeCopy.Block(term, newStaticInits.toList, term)
}
case None =>
case _ =>
// create new static ctor
val staticCtorSym = currentClass.newStaticConstructor(template.pos)
val rhs = Block(newStaticInits.toList, Literal(Constant(())))
@@ -807,9 +807,9 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R
for (i <- 0 until seenTypes.length) {
val baseClass = clazz.info.baseTypeSeq(i).typeSymbol
seenTypes(i) match {
case List() =>
case Nil =>
println("??? base "+baseClass+" not found in basetypes of "+clazz)
case List(_) =>
case _ :: Nil =>
;// OK
case tp1 :: tp2 :: _ =>
unit.error(clazz.pos, "illegal inheritance;\n " + clazz +
@@ -2523,7 +2523,7 @@ trait Typers extends Modes with Adaptations with Taggings {
def typedImport(imp : Import) : Import = (transformed remove imp) match {
case Some(imp1: Import) => imp1
case None => log("unhandled import: "+imp+" in "+unit); imp
case _ => log("unhandled import: "+imp+" in "+unit); imp
}
private def isWarnablePureExpression(tree: Tree) = tree match {
case EmptyTree | Literal(Constant(())) => false
@@ -4179,7 +4179,8 @@ trait Typers extends Modes with Adaptations with Taggings {
nme.update,
Apply(Select(mkCall(nme.apply), prefix) setPos fun.pos, args) setPos tree.pos
)
}
case _ => EmptyTree
}
}
val tree1 = qual match {
@@ -221,9 +221,9 @@ trait Unapplies extends ast.TreeDSL
val bodyTpe = funParamss.foldRight(classTpe)((params, restp) => gen.scalaFunctionConstr(params.map(_.tpt), restp))
val argss = copyParamss match {
case Nil => Nil
case ps :: Nil => mmap(ps :: funParamss)(toIdent)
}
case Nil => Nil
case ps :: _ => mmap(ps :: funParamss)(toIdent)
}
val body = funParamss.foldRight(New(classTpe, argss): Tree)(Function)
Some(atPos(cdef.pos.focus)(
@@ -88,6 +88,8 @@ abstract class Document {
case (i, b, DocGroup(d)) :: z =>
val fitsFlat = fits(width - k, (i, false, d) :: z)
fmt(k, (i, !fitsFlat, d) :: z)
case _ =>
()
}
fmt(0, (0, false, DocGroup(this)) :: Nil)
@@ -156,7 +156,7 @@ class ScalaSigPrinter(stream: PrintStream, printPrivates: Boolean) {
val printer = new ScalaSigPrinter(stream, printPrivates)
printer.printMethodType(m.infoType, false)(())
baos.toString
case None =>
case _ =>
""
}
}

1 comment on commit bcc8280

@adriaanm

This comment has been minimized.

Show comment
Hide comment
@adriaanm

adriaanm May 27, 2012

Member

exhaustivity's glad its advice is being heeded
unreachability jealously adds it found two actual bugs: one in scalacheck, one in itself

Member

adriaanm commented on bcc8280 May 27, 2012

exhaustivity's glad its advice is being heeded
unreachability jealously adds it found two actual bugs: one in scalacheck, one in itself

Please sign in to comment.