Skip to content

Commit e09a8a2

Browse files
committed
SI-4012 Mixin and specialization work well
The bug was fixed along with SI-7638 in 504b5f3.
1 parent 05681d4 commit e09a8a2

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

test/files/pos/SI-4012-a.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
trait C1[+A] {
2+
def head: A = sys.error("")
3+
}
4+
trait C2[@specialized +A] extends C1[A] {
5+
override def head: A = super.head
6+
}
7+
class C3 extends C2[Char]

test/files/pos/SI-4012-b.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
trait Super[@specialized(Int) A] {
2+
def superb = 0
3+
}
4+
5+
object Sub extends Super[Int] {
6+
// it is expected that super[Super].superb crashes, since
7+
// specialization does parent class rewiring, and the super
8+
// of Sub becomes Super$mcII$sp and not Super. But I consider
9+
// this normal behavior -- if you want, I can modify duplicatiors
10+
// to make this work, but I consider it's best to keep this
11+
// let the user know Super is not the superclass anymore.
12+
// super[Super].superb - Vlad
13+
super.superb // okay
14+
override def superb: Int = super.superb // okay
15+
}

0 commit comments

Comments
 (0)