aboutsummaryrefslogblamecommitdiff
path: root/tests/pos/boundspropagation.scala
blob: c2396c2c6ca3de6f3cfcb4a77f5cf119784a2e5f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                  

                       
 





                                                
// test contributed by @retronym
object test1 {
  class Base {
    type N

    class Tree[-T >: N]

    def f(x: Any): Tree[N] = x match {
      case y: Tree[_] => y
    }
  }
  class Derived extends Base {
    def g(x: Any): Tree[N] = x match {
      case y: Tree[_] => y // now succeeds in dotc
    }
  }
}
object test2 {
  class Tree[S, T <: S]

  class Base {
    def g(x: Any): Tree[_, _ <: Int] = x match {
      case y: Tree[Int @unchecked, _] => y
    }
  }
}