diff options
author | Som Snytt <som.snytt@gmail.com> | 2015-06-03 16:36:43 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2015-06-03 16:36:43 -0700 |
commit | 79436caa98ba46de644841a67ea9ff103831e574 (patch) | |
tree | 3c4f04bad8624e8ded8155ffd87d8028d5d5f9a7 /test/files/neg/t7623.check | |
parent | 70f0b1ded880ec9b3a9478d02f1898fcfeee230c (diff) | |
download | scala-79436caa98ba46de644841a67ea9ff103831e574.tar.gz scala-79436caa98ba46de644841a67ea9ff103831e574.tar.bz2 scala-79436caa98ba46de644841a67ea9ff103831e574.zip |
SI-9343 Xlint less strict on pattern sequences
-Xlint:stars-align warns only if elementarity > 0, that is,
if an extracted sequence is not matched entirely by a pattern
sequence, that is, in SLS 8.1.9 on pattern sequences, n = 1
and that pattern is a pattern sequence.
This is still only triggered if productarity > 0, that is,
a non-pattern-sequence pattern is required for the match.
This is a sensitive area because it borders on exhaustiveness
checking: it would be preferable to verify just that the match
is exhaustive, and to emit this warning only if it is not.
Diffstat (limited to 'test/files/neg/t7623.check')
-rw-r--r-- | test/files/neg/t7623.check | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/test/files/neg/t7623.check b/test/files/neg/t7623.check index db368dd369..de35023664 100644 --- a/test/files/neg/t7623.check +++ b/test/files/neg/t7623.check @@ -1,21 +1,15 @@ -t7623.scala:19: warning: A repeated case parameter or extracted sequence should be matched only by a sequence wildcard (_*). - def f = "" match { case X(s) => } +t7623.scala:21: warning: A repeated case parameter or extracted sequence is not matched by a sequence wildcard (_*), and may fail at runtime. + def g = "" match { case X(s, t) => } // warn ^ -t7623.scala:21: warning: A repeated case parameter or extracted sequence should be matched only by a sequence wildcard (_*). - def g = "" match { case X(s, t) => } +t7623.scala:23: warning: Sequence wildcard (_*) does not align with repeated case parameter or extracted sequence; the result may be unexpected. + def h = "" match { case X(s, t, u @ _*) => } // warn ^ -t7623.scala:23: warning: A repeated case parameter or extracted sequence should be matched only by a sequence wildcard (_*). - def h = "" match { case X(s, t, u @ _*) => } - ^ -t7623.scala:9: warning: A repeated case parameter or extracted sequence should be matched only by a sequence wildcard (_*). - def f = C("") match { case C(s) => } - ^ -t7623.scala:11: warning: A repeated case parameter or extracted sequence should be matched only by a sequence wildcard (_*). - def g = C("") match { case C(s, t) => } +t7623.scala:11: warning: A repeated case parameter or extracted sequence is not matched by a sequence wildcard (_*), and may fail at runtime. + def g = C("") match { case C(s, t) => } // warn ^ -t7623.scala:13: warning: A repeated case parameter or extracted sequence should be matched only by a sequence wildcard (_*). - def h = C("") match { case C(s, t, u @ _*) => } +t7623.scala:13: warning: Sequence wildcard (_*) does not align with repeated case parameter or extracted sequence; the result may be unexpected. + def h = C("") match { case C(s, t, u @ _*) => } // warn ^ error: No warnings can be incurred under -Xfatal-warnings. -6 warnings found +four warnings found one error found |