summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/catch-all.check12
-rw-r--r--test/files/neg/catch-all.scala30
-rw-r--r--test/files/pos/exponential-spec.scala47
3 files changed, 74 insertions, 15 deletions
diff --git a/test/files/neg/catch-all.check b/test/files/neg/catch-all.check
index ab3d28777d..62f895cc7e 100644
--- a/test/files/neg/catch-all.check
+++ b/test/files/neg/catch-all.check
@@ -1,10 +1,10 @@
catch-all.scala:2: error: This catches all Throwables. If this is really intended, use `case _ : Throwable` to clear this warning.
- try { "warn" } catch { case _ => }
- ^
+ try { "warn" } catch { case _ => }
+ ^
catch-all.scala:4: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
- try { "warn" } catch { case x => }
- ^
+ try { "warn" } catch { case x => }
+ ^
catch-all.scala:6: error: This catches all Throwables. If this is really intended, use `case x : Throwable` to clear this warning.
- try { "warn" } catch { case _: RuntimeException => ; case x => }
- ^
+ try { "warn" } catch { case _: RuntimeException => ; case x => }
+ ^
three errors found
diff --git a/test/files/neg/catch-all.scala b/test/files/neg/catch-all.scala
index 35a6d7af91..c05be77044 100644
--- a/test/files/neg/catch-all.scala
+++ b/test/files/neg/catch-all.scala
@@ -1,19 +1,31 @@
object CatchAll {
- try { "warn" } catch { case _ => }
+ try { "warn" } catch { case _ => }
- try { "warn" } catch { case x => }
+ try { "warn" } catch { case x => }
- try { "warn" } catch { case _: RuntimeException => ; case x => }
+ try { "warn" } catch { case _: RuntimeException => ; case x => }
- try { "okay" } catch { case _: Throwable => }
+ val t = T
- try { "okay" } catch { case _: Exception => }
+ try { "okay" } catch { case T => }
- try { "okay" } catch { case okay: Throwable => }
+ try { "okay" } catch { case `t` => }
- try { "okay" } catch { case okay: Exception => }
+ try { "okay" } catch { case x @ T => }
- try { "okay" } catch { case _ if "".isEmpty => }
+ try { "okay" } catch { case x @ `t` => }
- "okay" match { case _ => "" }
+ try { "okay" } catch { case _: Throwable => }
+
+ try { "okay" } catch { case _: Exception => }
+
+ try { "okay" } catch { case okay: Throwable => }
+
+ try { "okay" } catch { case okay: Exception => }
+
+ try { "okay" } catch { case _ if "".isEmpty => }
+
+ "okay" match { case _ => "" }
}
+
+object T extends Throwable
diff --git a/test/files/pos/exponential-spec.scala b/test/files/pos/exponential-spec.scala
new file mode 100644
index 0000000000..83aef58f7e
--- /dev/null
+++ b/test/files/pos/exponential-spec.scala
@@ -0,0 +1,47 @@
+// a.scala
+// Sat Jun 30 19:51:17 PDT 2012
+
+trait Exp[T]
+
+object Test {
+ def f[T](exp: Exp[T]): Exp[T] = (
+ f[T] _
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T] // 4s
+ compose f[T] // 5s
+ compose f[T] // 5s
+ compose f[T] // 6s
+ compose f[T] // 7s
+ compose f[T] // 8s
+ compose f[T] // 11s
+ compose f[T] // 17s
+ compose f[T] // 29s
+ compose f[T] // 54s
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ compose f[T]
+ )(exp)
+}