summaryrefslogtreecommitdiff
path: root/test/files/run/virtpatmat_switch.scala
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@epfl.ch>2012-02-13 11:54:10 +0100
committerAdriaan Moors <adriaan.moors@epfl.ch>2012-02-17 14:19:02 +0100
commita57ac60dbb115b90ca1ccc9944199bf3e82d517d (patch)
tree680f66ee9f6970e16d2d0ff89759d58010acc6bd /test/files/run/virtpatmat_switch.scala
parent5efc2df71a517b0cb7d0abc828a580936befe5aa (diff)
downloadscala-a57ac60dbb115b90ca1ccc9944199bf3e82d517d.tar.gz
scala-a57ac60dbb115b90ca1ccc9944199bf3e82d517d.tar.bz2
scala-a57ac60dbb115b90ca1ccc9944199bf3e82d517d.zip
[vpm] working type switch for try/catch
catch handlers are now also translated by the virtualizing pattern matcher emit type-based switches when possible, fallback to catch-all with full pattern match (the logic used to emit constant-based switches was generalized to type-based switches, abstracting out how to refer to the scrutinee and the shape of a default/catch-all case) this was the last missing piece of essential functionality now the virtualizing pattern matcher and the old one are mutually exclusive: -Yvirtpatmat disables the old matcher logic completely
Diffstat (limited to 'test/files/run/virtpatmat_switch.scala')
-rw-r--r--test/files/run/virtpatmat_switch.scala8
1 files changed, 7 insertions, 1 deletions
diff --git a/test/files/run/virtpatmat_switch.scala b/test/files/run/virtpatmat_switch.scala
index 2e2c31e8e5..1329c19d0f 100644
--- a/test/files/run/virtpatmat_switch.scala
+++ b/test/files/run/virtpatmat_switch.scala
@@ -14,9 +14,15 @@ object Test extends App {
case 'b' => "got b"
case _ => "got some letter"
}
+
+ def byteSwitch(x: Byte) = x match {
+ case 'a' => "got a"
+ case 'b' => "got b"
+ case _ => "got some letter"
+ }
println(charSwitch('a'))
- println(charSwitch('b'))
+ println(byteSwitch('b'))
println(charSwitch('z'))
def implicitDefault(x: Int) = x match {