summaryrefslogtreecommitdiff
path: root/test/files/pos/tcpoly_typesub.scala
blob: a56d0a25475cbbe107666391b671b3cb7c8e0d10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// contributed by Lauri Alanko
trait TypeSub {
  type l
  type u
  def castSub[f[+x]](fl : f[l]) : f[u]
  def castSuper[f[-x]](fu : f[u]) : f[l] = {
    type c[+y] = f[y] => f[l]
    castSub[c]{ fl : f[l] => fl }(fu)
  }
  def castValue[t](lt : l with t) : u with t = {
    type c[+y] = y with t
    castSub[c](lt)
  }
}