blob: 7394d428c1f75177196c36622b1d9a2ac509374b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
package test
class Thing {
def info: Info[this.type] = InfoRepository.getInfo(this)
def info2: Info[this.type] = {
def self: this.type = this
InfoRepository.getInfo(self)
}
}
trait Info[T]
case class InfoImpl[T](thing: T) extends Info[T]
object InfoRepository {
def getInfo(t: Thing): Info[t.type] = InfoImpl(t)
}
|