diff options
author | Paul Phillips <paulp@improving.org> | 2010-05-13 00:01:50 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-05-13 00:01:50 +0000 |
commit | 5f5660dd6ea1a885eaa95ead9a82b0a94ac09c97 (patch) | |
tree | 73d3579e37c019330ba5e8b6877944eb92cf881c /src/compiler | |
parent | 7c7c267d4e1efa2c85017751b448b31cf7e2a5b1 (diff) | |
download | scala-5f5660dd6ea1a885eaa95ead9a82b0a94ac09c97.tar.gz scala-5f5660dd6ea1a885eaa95ead9a82b0a94ac09c97.tar.bz2 scala-5f5660dd6ea1a885eaa95ead9a82b0a94ac09c97.zip |
Removed an assertion which was asserting an unt...
Removed an assertion which was asserting an untrue statement thus
causing chaos and strife. Closes #3411, no review.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/matching/Patterns.scala | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/Patterns.scala b/src/compiler/scala/tools/nsc/matching/Patterns.scala index d35049c1e5..a135655b9d 100644 --- a/src/compiler/scala/tools/nsc/matching/Patterns.scala +++ b/src/compiler/scala/tools/nsc/matching/Patterns.scala @@ -85,7 +85,8 @@ trait Patterns extends ast.TreeDSL { // 8.1.4 (a) case class ApplyIdentPattern(tree: Apply) extends ApplyPattern with NamePattern { - require (!isVarPattern(fn) && args.isEmpty) + // XXX - see bug 3411 for code which violates this assumption + // require (!isVarPattern(fn) && args.isEmpty) val ident @ Ident(name) = fn override def sufficientType = Pattern(ident).equalsCheck @@ -223,24 +224,12 @@ trait Patterns extends ast.TreeDSL { def isSameLength(other: SequenceLikePattern) = nonStarLength == other.nonStarLength } - abstract class SequencePattern extends Pattern with SequenceLikePattern { - val tree: ArrayValue + // 8.1.8 (b) (literal ArrayValues) + case class SequencePattern(tree: ArrayValue) extends Pattern with SequenceLikePattern { lazy val ArrayValue(elemtpt, elems) = tree override def subpatternsForVars: List[Pattern] = elemPatterns - override def description = "Seq(%s)".format(elemPatterns) - } - - // 8.1.8 (b) (literal ArrayValues) - case class SequenceNoStarPattern(tree: ArrayValue) extends SequencePattern { - require(!hasStar) - } - - // 8.1.8 (b) - case class SequenceStarPattern(tree: ArrayValue) extends SequencePattern { - require(hasStar) - - override def description = "Seq*(%s)".format(elemPatterns) + override def description = "Seq(%s)".format(elemPatterns mkString ", ") } // 8.1.8 (c) @@ -299,7 +288,7 @@ trait Patterns extends ast.TreeDSL { case x: Literal => LiteralPattern(x) case x: UnApply => UnapplyPattern(x) case x: Ident => if (isVarPattern(x)) VariablePattern(x) else SimpleIdPattern(x) - case x: ArrayValue => if (isRightIgnoring(x)) SequenceStarPattern(x) else SequenceNoStarPattern(x) + case x: ArrayValue => SequencePattern(x) case x: Select => StableIdPattern(x) case x: Star => StarPattern(x) case x: This => ThisPattern(x) // XXX ? |