Skip to content

Commit 2daa02b

Browse files
Update tests relating to inheritance of conflicting instantiations
1 parent 275497c commit 2daa02b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
object Test:
3+
trait A[T]
4+
trait B1 extends A[Int]
5+
trait B2 extends A[String]
6+
class D extends B1, B2 // error: cannot be instantiated since it has conflicting base types Test.A[Int] and Test.A[String]
7+
// NOTE this is not accepted in Scala 2 either

tests/neg/i11103.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,4 @@
99
case p: P =>
1010
new Foo // error
1111
}
12-
13-
class UpBndAndB extends UpBnd[Bar] with P
14-
// ClassCastException: Foo cannot be cast to Bar
15-
val x = pmatch(new UpBndAndB)
1612
}

tests/neg/i3989e.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
object Test extends App {
22
trait A[+X](val x: X)
3-
class B extends A(5) with A("hello") // error: A is extended twice
3+
class B extends A(5) with A("hello") // error: A is extended twice // error: class B cannot be instantiated since it has conflicting base types Test.A[Int] and Test.A[String]
44

55
def f(a: A[Int]): Int = a match {
66
case b: B => b.x

tests/pos/templateParents.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ object templateParents1 {
1414
trait D extends C[String]
1515
trait E extends C[Int]
1616

17-
val x = new D with E
17+
trait P[T]
1818

19-
val y: C[Int & String] = x
19+
val x = new D with P[Int]
2020
}
2121

0 commit comments

Comments
 (0)