aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/pos/annot.scala1
-rw-r--r--tests/repl/overrides.check17
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/pos/annot.scala b/tests/pos/annot.scala
index dec6af945..bdaf82e12 100644
--- a/tests/pos/annot.scala
+++ b/tests/pos/annot.scala
@@ -24,5 +24,6 @@ class Test {
class C extends A @uncheckedVariance () with B @uncheckedVariance { val x = 10 }
+ val f: (Int => Int) @uncheckedVariance = ???
}
diff --git a/tests/repl/overrides.check b/tests/repl/overrides.check
new file mode 100644
index 000000000..2424c80ce
--- /dev/null
+++ b/tests/repl/overrides.check
@@ -0,0 +1,17 @@
+scala> class B { override def foo(i: Int): Unit = {}; }
+-- [E037] Reference Error: <console> -------------------------------------------
+4 |class B { override def foo(i: Int): Unit = {}; }
+ | ^
+ | method foo overrides nothing
+
+longer explanation available when compiling with `-explain`
+scala> class A { def foo: Unit = {}; }
+defined class A
+scala> class B extends A { override def foo(i: Int): Unit = {}; }
+-- [E038] Reference Error: <console> -------------------------------------------
+5 |class B extends A { override def foo(i: Int): Unit = {}; }
+ | ^
+ | method foo has a different signature than the overridden declaration
+
+longer explanation available when compiling with `-explain`
+scala> :quit