aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/privates.scala11
-rw-r--r--tests/neg/templateParents.scala9
-rw-r--r--tests/pos/templateParents.scala12
3 files changed, 32 insertions, 0 deletions
diff --git a/tests/neg/privates.scala b/tests/neg/privates.scala
new file mode 100644
index 000000000..6cc1ab67f
--- /dev/null
+++ b/tests/neg/privates.scala
@@ -0,0 +1,11 @@
+trait T {
+ private def foo = 0;
+ private[this] def bar = 0
+
+}
+
+class C { self: T =>
+ foo
+ bar
+}
+
diff --git a/tests/neg/templateParents.scala b/tests/neg/templateParents.scala
new file mode 100644
index 000000000..637c6037a
--- /dev/null
+++ b/tests/neg/templateParents.scala
@@ -0,0 +1,9 @@
+object templateParentsNeg {
+
+ class C(x: String)
+ class C2
+ trait D extends C("a") // error: traits may not call class constructors
+
+ new C("b") with C2 // error: C2 is not a trait
+
+}
diff --git a/tests/pos/templateParents.scala b/tests/pos/templateParents.scala
new file mode 100644
index 000000000..530f8c148
--- /dev/null
+++ b/tests/pos/templateParents.scala
@@ -0,0 +1,12 @@
+object templateParents {
+
+// traits do not call a constructor
+ class C[+T](x: T)
+ trait D extends C[String]
+ trait E extends C[Int]
+ new C("abc") with D
+
+ //val x = new D with E
+
+ //val y: C = x
+} \ No newline at end of file