aboutsummaryrefslogtreecommitdiff
path: root/tests/neg/typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-16 16:09:33 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-16 16:19:47 +0100
commit5989fddb67509266a809e2464aa9d81125f65462 (patch)
tree7ba745c9ca23f2b7ddb4b2d9135225cc1c15fda1 /tests/neg/typers.scala
parent58059264842fac39a27356d052680a09c2da7571 (diff)
downloaddotty-5989fddb67509266a809e2464aa9d81125f65462.tar.gz
dotty-5989fddb67509266a809e2464aa9d81125f65462.tar.bz2
dotty-5989fddb67509266a809e2464aa9d81125f65462.zip
Negative typer tests.
Diffstat (limited to 'tests/neg/typers.scala')
-rw-r--r--tests/neg/typers.scala41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/neg/typers.scala b/tests/neg/typers.scala
new file mode 100644
index 000000000..a8e008373
--- /dev/null
+++ b/tests/neg/typers.scala
@@ -0,0 +1,41 @@
+object typers {
+
+ class C {
+ val x: Int
+ val x: String
+ val y: Int
+ def y: String
+ val z: Int
+ def z(): String
+
+ def f(x: Any) = ()
+ def f(x: AnyRef): AnyRef
+
+ def g(x: Object): Unit
+ def g[T](x: T): T = x
+ }
+
+
+ object returns {
+
+ def foo(x: Int) = {
+ return 3
+ }
+
+ return 4
+ }
+
+ object tries {
+
+ val x = try {
+ "abc"
+ } catch {
+ case ex: String => // does not work yet. We should detect that the test is non-sensical, but don't.
+ 123
+ }
+ }
+
+ class Refinements {
+ val y: C { val x: T; type T }
+ }
+} \ No newline at end of file