diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-09-21 11:03:53 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2017-03-11 23:48:31 -0800 |
commit | a85521efbbf65161debc460ab5cb55562db051e9 (patch) | |
tree | 58b2c70aa32ab4d68512a3fc265adaadded99e70 /test/files/neg/warn-unused-privates.scala | |
parent | c9682121b6ed33fe67dad445ebc665d13b369bbb (diff) | |
download | scala-a85521efbbf65161debc460ab5cb55562db051e9.tar.gz scala-a85521efbbf65161debc460ab5cb55562db051e9.tar.bz2 scala-a85521efbbf65161debc460ab5cb55562db051e9.zip |
SI-8040 Warn patvars in casedefs
Collect bindings in casedefs unless "@-bound to _".
Also minor refactor to make it easier to see the cases
of `id @ _`. Tupled matching is supposed to be efficient
either now or soon.
Diffstat (limited to 'test/files/neg/warn-unused-privates.scala')
-rw-r--r-- | test/files/neg/warn-unused-privates.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/files/neg/warn-unused-privates.scala b/test/files/neg/warn-unused-privates.scala index f0580f02d5..777e0f1579 100644 --- a/test/files/neg/warn-unused-privates.scala +++ b/test/files/neg/warn-unused-privates.scala @@ -193,3 +193,19 @@ trait Forever { trait Ignorance { private val readResolve = 42 // ignore } + +trait CaseyKasem { + def f = 42 match { + case x if x < 25 => "no warn" + case y if toString.nonEmpty => "no warn" + y + case z => "warn" + } +} +trait CaseyAtTheBat { + def f = Option(42) match { + case Some(x) if x < 25 => "no warn" + case Some(y @ _) if toString.nonEmpty => "no warn" + case Some(z) => "warn" + case None => "no warn" + } +} |