diff options
author | Burak Emir <emir@epfl.ch> | 2007-02-27 07:56:29 +0000 |
---|---|---|
committer | Burak Emir <emir@epfl.ch> | 2007-02-27 07:56:29 +0000 |
commit | 8c8bc695b79c7fc3ef406c149999c54dd6b4ab0e (patch) | |
tree | bd07a7e84694fb1b4c026fde352fb4670dea2e1a /src | |
parent | 016811518aa46922dfa4f3545c1906aec3978643 (diff) | |
download | scala-8c8bc695b79c7fc3ef406c149999c54dd6b4ab0e.tar.gz scala-8c8bc695b79c7fc3ef406c149999c54dd6b4ab0e.tar.bz2 scala-8c8bc695b79c7fc3ef406c149999c54dd6b4ab0e.zip |
fixed exhaustivity check for objects missing "c...
fixed exhaustivity check for objects missing "case", sealed hierarchies
containing abstract classes added sealed to xml.parsing.DFAContentModel
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/PatternNodes.scala | 15 | ||||
-rw-r--r-- | src/library/scala/xml/dtd/ContentModel.scala | 2 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala index ae8b7f78c7..25436e3ba8 100644 --- a/src/compiler/scala/tools/nsc/matching/PatternNodes.scala +++ b/src/compiler/scala/tools/nsc/matching/PatternNodes.scala @@ -343,8 +343,11 @@ trait PatternNodes requires transform.ExplicitOuter { return (false, null, emptySymbolSet) // only case _ def checkExCoverage(tpesym:Symbol): SymSet = - if(!tpesym.hasFlag(Flags.SEALED)) emptySymbolSet - else tpesym.children.flatMap { x => checkExCoverage(x) + x } + if(!tpesym.hasFlag(Flags.SEALED)) emptySymbolSet else + tpesym.children.flatMap { x => + val z = checkExCoverage(x) + if(x.hasFlag(Flags.ABSTRACT)) z else z + x + } def andIsUnguardedBody(p1:PatternNode) = p1.and match { case p: Body => p.hasUnguarded @@ -381,11 +384,11 @@ trait PatternNodes requires transform.ExplicitOuter { } // Nil is also a "constructor pattern" somehow - case VariablePat(tree) if (alts.getTpe.symbol.hasFlag(Flags.CASE)) => // Nil - coveredCases = coveredCases + alts.getTpe.symbol - remainingCases = remainingCases - alts.getTpe.symbol + case VariablePat(tree) if (tree.tpe.symbol.hasFlag(Flags.MODULE)) => // Nil + coveredCases = coveredCases + tree.tpe.symbol + remainingCases = remainingCases - tree.tpe.symbol cases = cases + 1 - + res = res && tree.tpe.symbol.hasFlag(Flags.CASE) case DefaultPat() => if(andIsUnguardedBody(alts) || alts.and.isInstanceOf[Header]) { coveredCases = emptySymbolSet diff --git a/src/library/scala/xml/dtd/ContentModel.scala b/src/library/scala/xml/dtd/ContentModel.scala index db82bea3a2..d1113b15b7 100644 --- a/src/library/scala/xml/dtd/ContentModel.scala +++ b/src/library/scala/xml/dtd/ContentModel.scala @@ -131,7 +131,7 @@ case object EMPTY extends ContentModel { case object ANY extends ContentModel { override def toString(sb:StringBuilder): StringBuilder = sb.append("ANY") } -abstract class DFAContentModel extends ContentModel { +sealed abstract class DFAContentModel extends ContentModel { import ContentModel.ElemName def r: ContentModel.RegExp private var _dfa: DetWordAutom[ContentModel.ElemName] = null |