summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/saito.check4
-rw-r--r--test/files/neg/saito.scala14
2 files changed, 18 insertions, 0 deletions
diff --git a/test/files/neg/saito.check b/test/files/neg/saito.check
new file mode 100644
index 0000000000..142ed903cc
--- /dev/null
+++ b/test/files/neg/saito.check
@@ -0,0 +1,4 @@
+saito.scala:10: error: class A cannot be instantiated because it does not conform to its self-type B
+ val a: A = new A; // should not be allowed
+ ^
+one error found
diff --git a/test/files/neg/saito.scala b/test/files/neg/saito.scala
new file mode 100644
index 0000000000..a8bcc79d65
--- /dev/null
+++ b/test/files/neg/saito.scala
@@ -0,0 +1,14 @@
+class B {}
+class A requires B {
+ def m(): B = {
+ this
+ }
+}
+
+object Exec{
+ def main(args: Array[String]): Unit = {
+ val a: A = new A; // should not be allowed
+ val b: B = a.m();
+ }
+}
+