summaryrefslogtreecommitdiff
path: root/test/files/neg/t2796.scala
blob: 3bcc9df562606157a0da7d97721f522a6192496c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
trait Base {
  val abstractVal: String
  final val useAbstractVal = abstractVal
}

trait T1 extends {
  val abstractVal = "T1.abstractVal" // warn
} with Base

trait T2 extends {
  type X = Int                       // okay
} with Base


class C1 extends {
  val abstractVal = "C1.abstractVal" // okay
} with Base

object Test {
  def main(args: Array[String]) {
    assert(new C1 ().useAbstractVal == "C1.abstractVal")
    // This currently fails. a more ambitious approach to this ticket would add $earlyinit$
    // to traits and call it from the right places in the right order.
    //
    // For now, we'll just issue a warning.
    assert(new T1 {}.useAbstractVal == "T1.abstractVal")
  }
}