summaryrefslogtreecommitdiff
path: root/test/files/pos/tcpoly_overloaded.scala
blob: 4240074d854100adcad9bdb702e47fb30a503c85 (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
trait Monad[T <: Bound[T], MyType[x <: Bound[x]], Bound[_]] {
  def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_],  
              Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]]
              (f: T => Result[S]): Result[S] 
  def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_],  
              Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]]
              (f: T => Result[S], foo: String): Result[S] 
  def flatMap[S <: Bound[S]]
              (f: T => MyType[S], foo: Int): MyType[S]
}

trait Test {
  def moo: MList[Int]
  class MList[T](el: T) extends Monad[T, List, Any] {
    def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_],  
            Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]]
            (f: T => Result[S]): Result[S] = error("foo")
    def flatMap[S <: RBound[S], RContainer[x <: RBound[x]], RBound[_],  
            Result[x <: RBound[x]] <: Monad[x, RContainer, RBound]]
            (f: T => Result[S], foo: String): Result[S]  = error("foo")
    def flatMap[S]
            (f: T => List[S], foo: Int): List[S]  = error("foo")              
  }
  val l: MList[String] = moo.flatMap[String, List, Any, MList]((x: Int) => new MList("String"))
}