From 5989fddb67509266a809e2464aa9d81125f65462 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 16 Dec 2013 16:09:33 +0100 Subject: Negative typer tests. --- tests/neg/typers.scala | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 tests/neg/typers.scala (limited to 'tests/neg/typers.scala') 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 -- cgit v1.2.3