aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/neg/templateParents.scala7
-rw-r--r--tests/pos/templateParents.scala19
2 files changed, 21 insertions, 5 deletions
diff --git a/tests/neg/templateParents.scala b/tests/neg/templateParents.scala
index 637c6037a..6ecc8c384 100644
--- a/tests/neg/templateParents.scala
+++ b/tests/neg/templateParents.scala
@@ -7,3 +7,10 @@ object templateParentsNeg {
new C("b") with C2 // error: C2 is not a trait
}
+object templateParentsNeg1 {
+ class C[T]
+ trait D extends C[String]
+ trait E extends C[Int]
+
+ val x = new D with E // error no type fits between inferred bounds
+} \ No newline at end of file
diff --git a/tests/pos/templateParents.scala b/tests/pos/templateParents.scala
index 530f8c148..845913270 100644
--- a/tests/pos/templateParents.scala
+++ b/tests/pos/templateParents.scala
@@ -1,12 +1,21 @@
object templateParents {
-// traits do not call a constructor
- class C[+T](x: T)
+ // 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
+object templateParents1 {
+ // tests inference of synthesized class type
+ class C[+T]
+ trait D extends C[String]
+ trait E extends C[Int]
+
+ val x = new D with E
+
+ val y: C[Int & String] = x
+}
- //val y: C = x
-} \ No newline at end of file