summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-04-03 09:08:51 -0700
committerPaul Phillips <paulp@improving.org>2013-04-03 09:08:51 -0700
commitc726682bc91e33ab0372492ba682bcfb864731fc (patch)
tree288be8381089f580c3d691112e49f8950dea57a1 /test
parent1ad75702a6b7e349b79bc7672034d42ecf34d8a1 (diff)
parent530f4a544b95d77eff378d31122615eea195618a (diff)
downloadscala-c726682bc91e33ab0372492ba682bcfb864731fc.tar.gz
scala-c726682bc91e33ab0372492ba682bcfb864731fc.tar.bz2
scala-c726682bc91e33ab0372492ba682bcfb864731fc.zip
Merge pull request #2337 from retronym/ticket/7110-2
SI-7110 Warn about naked try without catch/finally
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t7110.check6
-rw-r--r--test/files/neg/t7110.flags1
-rw-r--r--test/files/neg/t7110.scala6
3 files changed, 13 insertions, 0 deletions
diff --git a/test/files/neg/t7110.check b/test/files/neg/t7110.check
new file mode 100644
index 0000000000..e484dc4325
--- /dev/null
+++ b/test/files/neg/t7110.check
@@ -0,0 +1,6 @@
+t7110.scala:2: warning: A try without a catch or finally is equivalent to putting its body in a block; no exceptions are handled.
+ try { ??? } // warn
+ ^
+error: No warnings can be incurred under -Xfatal-warnings.
+one warning found
+one error found
diff --git a/test/files/neg/t7110.flags b/test/files/neg/t7110.flags
new file mode 100644
index 0000000000..e8fb65d50c
--- /dev/null
+++ b/test/files/neg/t7110.flags
@@ -0,0 +1 @@
+-Xfatal-warnings \ No newline at end of file
diff --git a/test/files/neg/t7110.scala b/test/files/neg/t7110.scala
new file mode 100644
index 0000000000..79ac325216
--- /dev/null
+++ b/test/files/neg/t7110.scala
@@ -0,0 +1,6 @@
+object Test {
+ try { ??? } // warn
+
+ try { ??? } finally ??? // no warn
+ try { ??? } catch { case _: Throwable => } // no warn
+}